PageRenderTime 59ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/PayPalInvoiceSDK/Invoice/PayPalInvoiceModel.cs

https://github.com/josearis/invoice-sdk-dotnet
C# | 8249 lines | 5894 code | 915 blank | 1440 comment | 839 complexity | 8779ac375f46d1b301ccc77378a52e23 MD5 | raw file
Possible License(s): BitTorrent-1.0

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Stub objects for Invoice
  3. * AUTO_GENERATED_CODE
  4. */
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Globalization;
  10. using System.Text;
  11. using System.Text.RegularExpressions;
  12. using System.Web;
  13. using System.Xml;
  14. using PayPal.Util;
  15. namespace PayPal.Invoice.Model
  16. {
  17. /// <summary>
  18. /// Utility class for Enums with descriptions
  19. /// </summary>
  20. public static class EnumUtils
  21. {
  22. /// <summary>
  23. /// Get description for a give enum value
  24. /// </summary>
  25. public static string GetDescription(Enum value)
  26. {
  27. string description = "";
  28. DescriptionAttribute[] attributes = (DescriptionAttribute[])value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
  29. if (attributes.Length > 0)
  30. {
  31. description= attributes[0].Description;
  32. }
  33. return description;
  34. }
  35. /// <summary>
  36. /// Convert a string to an enum object
  37. /// </summary>
  38. public static object GetValue(string value,Type enumType)
  39. {
  40. string[] names = Enum.GetNames(enumType);
  41. foreach(string name in names)
  42. {
  43. if (GetDescription((Enum)Enum.Parse(enumType, name)).Equals(value))
  44. {
  45. return Enum.Parse(enumType, name);
  46. }
  47. }
  48. return null;
  49. }
  50. }
  51. /// <summary>
  52. ///
  53. /// </summary>
  54. public partial class BaseAddress {
  55. // Default US culture info
  56. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  57. /// <summary>
  58. ///
  59. /// </summary>
  60. private string line1Field;
  61. public string line1
  62. {
  63. get
  64. {
  65. return this.line1Field;
  66. }
  67. set
  68. {
  69. this.line1Field = value;
  70. }
  71. }
  72. /// <summary>
  73. ///
  74. /// </summary>
  75. private string line2Field;
  76. public string line2
  77. {
  78. get
  79. {
  80. return this.line2Field;
  81. }
  82. set
  83. {
  84. this.line2Field = value;
  85. }
  86. }
  87. /// <summary>
  88. ///
  89. /// </summary>
  90. private string cityField;
  91. public string city
  92. {
  93. get
  94. {
  95. return this.cityField;
  96. }
  97. set
  98. {
  99. this.cityField = value;
  100. }
  101. }
  102. /// <summary>
  103. ///
  104. /// </summary>
  105. private string stateField;
  106. public string state
  107. {
  108. get
  109. {
  110. return this.stateField;
  111. }
  112. set
  113. {
  114. this.stateField = value;
  115. }
  116. }
  117. /// <summary>
  118. ///
  119. /// </summary>
  120. private string postalCodeField;
  121. public string postalCode
  122. {
  123. get
  124. {
  125. return this.postalCodeField;
  126. }
  127. set
  128. {
  129. this.postalCodeField = value;
  130. }
  131. }
  132. /// <summary>
  133. ///
  134. /// </summary>
  135. private string countryCodeField;
  136. public string countryCode
  137. {
  138. get
  139. {
  140. return this.countryCodeField;
  141. }
  142. set
  143. {
  144. this.countryCodeField = value;
  145. }
  146. }
  147. /// <summary>
  148. ///
  149. /// </summary>
  150. private string typeField;
  151. public string type
  152. {
  153. get
  154. {
  155. return this.typeField;
  156. }
  157. set
  158. {
  159. this.typeField = value;
  160. }
  161. }
  162. /// <summary>
  163. /// Constructor with arguments
  164. /// </summary>
  165. public BaseAddress(string line1, string city, string countryCode)
  166. {
  167. this.line1 = line1;
  168. this.city = city;
  169. this.countryCode = countryCode;
  170. }
  171. /// <summary>
  172. /// Default Constructor
  173. /// </summary>
  174. public BaseAddress()
  175. {
  176. }
  177. public string ToNVPString(string prefix)
  178. {
  179. StringBuilder sb = new StringBuilder();
  180. if (this.line1 != null)
  181. {
  182. sb.Append(prefix).Append("line1").Append("=").Append(HttpUtility.UrlEncode(this.line1, BaseConstants.ENCODING_FORMAT)).Append("&");
  183. }
  184. if (this.line2 != null)
  185. {
  186. sb.Append(prefix).Append("line2").Append("=").Append(HttpUtility.UrlEncode(this.line2, BaseConstants.ENCODING_FORMAT)).Append("&");
  187. }
  188. if (this.city != null)
  189. {
  190. sb.Append(prefix).Append("city").Append("=").Append(HttpUtility.UrlEncode(this.city, BaseConstants.ENCODING_FORMAT)).Append("&");
  191. }
  192. if (this.state != null)
  193. {
  194. sb.Append(prefix).Append("state").Append("=").Append(HttpUtility.UrlEncode(this.state, BaseConstants.ENCODING_FORMAT)).Append("&");
  195. }
  196. if (this.postalCode != null)
  197. {
  198. sb.Append(prefix).Append("postalCode").Append("=").Append(HttpUtility.UrlEncode(this.postalCode, BaseConstants.ENCODING_FORMAT)).Append("&");
  199. }
  200. if (this.countryCode != null)
  201. {
  202. sb.Append(prefix).Append("countryCode").Append("=").Append(HttpUtility.UrlEncode(this.countryCode, BaseConstants.ENCODING_FORMAT)).Append("&");
  203. }
  204. if (this.type != null)
  205. {
  206. sb.Append(prefix).Append("type").Append("=").Append(HttpUtility.UrlEncode(this.type, BaseConstants.ENCODING_FORMAT)).Append("&");
  207. }
  208. return sb.ToString();
  209. }
  210. /// <summary>
  211. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  212. /// </summary>
  213. /// <param name="map">NVP map as returned by an API call</param>
  214. /// <param name="prefix">NVP prefix for this class in the response</param>
  215. /// <param name="index">For array elements, index of this element in the response</param>
  216. /// <returns>
  217. /// A new BaseAddress object created from the passed in NVP map
  218. /// </returns>
  219. public static BaseAddress CreateInstance(Dictionary<string, string> map, string prefix, int index)
  220. {
  221. BaseAddress baseAddress = null;
  222. string key;
  223. int i = 0;
  224. if(index != -1)
  225. {
  226. if (prefix.Length > 0 && !prefix.EndsWith("."))
  227. {
  228. prefix = prefix + "(" + index + ").";
  229. }
  230. }
  231. else
  232. {
  233. if (prefix.Length > 0 && !prefix.EndsWith("."))
  234. {
  235. prefix = prefix + ".";
  236. }
  237. }
  238. key = prefix + "line1";
  239. if (map.ContainsKey(key))
  240. {
  241. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  242. baseAddress.line1 = map[key];
  243. }
  244. key = prefix + "line2";
  245. if (map.ContainsKey(key))
  246. {
  247. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  248. baseAddress.line2 = map[key];
  249. }
  250. key = prefix + "city";
  251. if (map.ContainsKey(key))
  252. {
  253. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  254. baseAddress.city = map[key];
  255. }
  256. key = prefix + "state";
  257. if (map.ContainsKey(key))
  258. {
  259. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  260. baseAddress.state = map[key];
  261. }
  262. key = prefix + "postalCode";
  263. if (map.ContainsKey(key))
  264. {
  265. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  266. baseAddress.postalCode = map[key];
  267. }
  268. key = prefix + "countryCode";
  269. if (map.ContainsKey(key))
  270. {
  271. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  272. baseAddress.countryCode = map[key];
  273. }
  274. key = prefix + "type";
  275. if (map.ContainsKey(key))
  276. {
  277. baseAddress = (baseAddress == null) ? new BaseAddress() : baseAddress;
  278. baseAddress.type = map[key];
  279. }
  280. return baseAddress;
  281. }
  282. }
  283. /// <summary>
  284. /// This type contains the detailed error information resulting
  285. /// from the service operation.
  286. /// </summary>
  287. public partial class ErrorData {
  288. // Default US culture info
  289. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  290. /// <summary>
  291. ///
  292. /// </summary>
  293. private long? errorIdField;
  294. public long? errorId
  295. {
  296. get
  297. {
  298. return this.errorIdField;
  299. }
  300. set
  301. {
  302. this.errorIdField = value;
  303. }
  304. }
  305. /// <summary>
  306. ///
  307. /// </summary>
  308. private string domainField;
  309. public string domain
  310. {
  311. get
  312. {
  313. return this.domainField;
  314. }
  315. set
  316. {
  317. this.domainField = value;
  318. }
  319. }
  320. /// <summary>
  321. ///
  322. /// </summary>
  323. private string subdomainField;
  324. public string subdomain
  325. {
  326. get
  327. {
  328. return this.subdomainField;
  329. }
  330. set
  331. {
  332. this.subdomainField = value;
  333. }
  334. }
  335. /// <summary>
  336. ///
  337. /// </summary>
  338. private ErrorSeverity? severityField;
  339. public ErrorSeverity? severity
  340. {
  341. get
  342. {
  343. return this.severityField;
  344. }
  345. set
  346. {
  347. this.severityField = value;
  348. }
  349. }
  350. /// <summary>
  351. ///
  352. /// </summary>
  353. private ErrorCategory? categoryField;
  354. public ErrorCategory? category
  355. {
  356. get
  357. {
  358. return this.categoryField;
  359. }
  360. set
  361. {
  362. this.categoryField = value;
  363. }
  364. }
  365. /// <summary>
  366. ///
  367. /// </summary>
  368. private string messageField;
  369. public string message
  370. {
  371. get
  372. {
  373. return this.messageField;
  374. }
  375. set
  376. {
  377. this.messageField = value;
  378. }
  379. }
  380. /// <summary>
  381. ///
  382. /// </summary>
  383. private string exceptionIdField;
  384. public string exceptionId
  385. {
  386. get
  387. {
  388. return this.exceptionIdField;
  389. }
  390. set
  391. {
  392. this.exceptionIdField = value;
  393. }
  394. }
  395. /// <summary>
  396. ///
  397. /// </summary>
  398. private List<ErrorParameter> parameterField = new List<ErrorParameter>();
  399. public List<ErrorParameter> parameter
  400. {
  401. get
  402. {
  403. return this.parameterField;
  404. }
  405. set
  406. {
  407. this.parameterField = value;
  408. }
  409. }
  410. /// <summary>
  411. /// Default Constructor
  412. /// </summary>
  413. public ErrorData()
  414. {
  415. }
  416. /// <summary>
  417. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  418. /// </summary>
  419. /// <param name="map">NVP map as returned by an API call</param>
  420. /// <param name="prefix">NVP prefix for this class in the response</param>
  421. /// <param name="index">For array elements, index of this element in the response</param>
  422. /// <returns>
  423. /// A new ErrorData object created from the passed in NVP map
  424. /// </returns>
  425. public static ErrorData CreateInstance(Dictionary<string, string> map, string prefix, int index)
  426. {
  427. ErrorData errorData = null;
  428. string key;
  429. int i = 0;
  430. if(index != -1)
  431. {
  432. if (prefix.Length > 0 && !prefix.EndsWith("."))
  433. {
  434. prefix = prefix + "(" + index + ").";
  435. }
  436. }
  437. else
  438. {
  439. if (prefix.Length > 0 && !prefix.EndsWith("."))
  440. {
  441. prefix = prefix + ".";
  442. }
  443. }
  444. key = prefix + "errorId";
  445. if (map.ContainsKey(key))
  446. {
  447. errorData = (errorData == null) ? new ErrorData() : errorData;
  448. errorData.errorId = System.Convert.ToInt64(map[key], DefaultCulture);
  449. }
  450. key = prefix + "domain";
  451. if (map.ContainsKey(key))
  452. {
  453. errorData = (errorData == null) ? new ErrorData() : errorData;
  454. errorData.domain = map[key];
  455. }
  456. key = prefix + "subdomain";
  457. if (map.ContainsKey(key))
  458. {
  459. errorData = (errorData == null) ? new ErrorData() : errorData;
  460. errorData.subdomain = map[key];
  461. }
  462. key = prefix + "severity";
  463. if (map.ContainsKey(key))
  464. {
  465. errorData = (errorData == null) ? new ErrorData() : errorData;
  466. errorData.severity = (ErrorSeverity)EnumUtils.GetValue(map[key],typeof(ErrorSeverity));
  467. }
  468. key = prefix + "category";
  469. if (map.ContainsKey(key))
  470. {
  471. errorData = (errorData == null) ? new ErrorData() : errorData;
  472. errorData.category = (ErrorCategory)EnumUtils.GetValue(map[key],typeof(ErrorCategory));
  473. }
  474. key = prefix + "message";
  475. if (map.ContainsKey(key))
  476. {
  477. errorData = (errorData == null) ? new ErrorData() : errorData;
  478. errorData.message = map[key];
  479. }
  480. key = prefix + "exceptionId";
  481. if (map.ContainsKey(key))
  482. {
  483. errorData = (errorData == null) ? new ErrorData() : errorData;
  484. errorData.exceptionId = map[key];
  485. }
  486. i = 0;
  487. while(true)
  488. {
  489. ErrorParameter parameter = ErrorParameter.CreateInstance(map, prefix + "parameter", i);
  490. if (parameter != null)
  491. {
  492. errorData = (errorData == null) ? new ErrorData() : errorData;
  493. errorData.parameter.Add(parameter);
  494. i++;
  495. }
  496. else
  497. {
  498. break;
  499. }
  500. }
  501. return errorData;
  502. }
  503. }
  504. /// <summary>
  505. ///
  506. /// </summary>
  507. public partial class ErrorParameter {
  508. // Default US culture info
  509. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  510. /// <summary>
  511. ///
  512. /// </summary>
  513. private string nameField;
  514. public string name
  515. {
  516. get
  517. {
  518. return this.nameField;
  519. }
  520. set
  521. {
  522. this.nameField = value;
  523. }
  524. }
  525. /// <summary>
  526. ///
  527. /// </summary>
  528. private string valueField;
  529. public string value
  530. {
  531. get
  532. {
  533. return this.valueField;
  534. }
  535. set
  536. {
  537. this.valueField = value;
  538. }
  539. }
  540. /// <summary>
  541. /// Default Constructor
  542. /// </summary>
  543. public ErrorParameter()
  544. {
  545. }
  546. /// <summary>
  547. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  548. /// </summary>
  549. /// <param name="map">NVP map as returned by an API call</param>
  550. /// <param name="prefix">NVP prefix for this class in the response</param>
  551. /// <param name="index">For array elements, index of this element in the response</param>
  552. /// <returns>
  553. /// A new ErrorParameter object created from the passed in NVP map
  554. /// </returns>
  555. public static ErrorParameter CreateInstance(Dictionary<string, string> map, string prefix, int index)
  556. {
  557. ErrorParameter errorParameter = null;
  558. string key;
  559. int i = 0;
  560. if(index != -1)
  561. {
  562. if (prefix.Length > 0 && !prefix.EndsWith("."))
  563. {
  564. prefix = prefix + "(" + index + ").";
  565. }
  566. }
  567. else
  568. {
  569. if (prefix.Length > 0 && !prefix.EndsWith("."))
  570. {
  571. prefix = prefix + ".";
  572. }
  573. }
  574. key = prefix + "name";
  575. if (map.ContainsKey(key))
  576. {
  577. errorParameter = (errorParameter == null) ? new ErrorParameter() : errorParameter;
  578. errorParameter.name = map[key];
  579. }
  580. key = prefix.Substring(0, prefix.Length - 1);
  581. if (map.ContainsKey(key))
  582. {
  583. errorParameter = (errorParameter == null) ? new ErrorParameter() : errorParameter;
  584. errorParameter.value = map[key];
  585. }
  586. return errorParameter;
  587. }
  588. }
  589. /// <summary>
  590. /// This specifies a fault, encapsulating error data, with
  591. /// specific error codes.
  592. /// </summary>
  593. public partial class FaultMessage {
  594. // Default US culture info
  595. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  596. /// <summary>
  597. ///
  598. /// </summary>
  599. private ResponseEnvelope responseEnvelopeField;
  600. public ResponseEnvelope responseEnvelope
  601. {
  602. get
  603. {
  604. return this.responseEnvelopeField;
  605. }
  606. set
  607. {
  608. this.responseEnvelopeField = value;
  609. }
  610. }
  611. /// <summary>
  612. ///
  613. /// </summary>
  614. private List<ErrorData> errorField = new List<ErrorData>();
  615. public List<ErrorData> error
  616. {
  617. get
  618. {
  619. return this.errorField;
  620. }
  621. set
  622. {
  623. this.errorField = value;
  624. }
  625. }
  626. /// <summary>
  627. /// Default Constructor
  628. /// </summary>
  629. public FaultMessage()
  630. {
  631. }
  632. /// <summary>
  633. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  634. /// </summary>
  635. /// <param name="map">NVP map as returned by an API call</param>
  636. /// <param name="prefix">NVP prefix for this class in the response</param>
  637. /// <param name="index">For array elements, index of this element in the response</param>
  638. /// <returns>
  639. /// A new FaultMessage object created from the passed in NVP map
  640. /// </returns>
  641. public static FaultMessage CreateInstance(Dictionary<string, string> map, string prefix, int index)
  642. {
  643. FaultMessage faultMessage = null;
  644. string key;
  645. int i = 0;
  646. if(index != -1)
  647. {
  648. if (prefix.Length > 0 && !prefix.EndsWith("."))
  649. {
  650. prefix = prefix + "(" + index + ").";
  651. }
  652. }
  653. else
  654. {
  655. if (prefix.Length > 0 && !prefix.EndsWith("."))
  656. {
  657. prefix = prefix + ".";
  658. }
  659. }
  660. ResponseEnvelope responseEnvelope = ResponseEnvelope.CreateInstance(map, prefix + "responseEnvelope", -1);
  661. if (responseEnvelope != null)
  662. {
  663. faultMessage = (faultMessage == null) ? new FaultMessage() : faultMessage;
  664. faultMessage.responseEnvelope = responseEnvelope;
  665. }
  666. i = 0;
  667. while(true)
  668. {
  669. ErrorData error = ErrorData.CreateInstance(map, prefix + "error", i);
  670. if (error != null)
  671. {
  672. faultMessage = (faultMessage == null) ? new FaultMessage() : faultMessage;
  673. faultMessage.error.Add(error);
  674. i++;
  675. }
  676. else
  677. {
  678. break;
  679. }
  680. }
  681. return faultMessage;
  682. }
  683. }
  684. /// <summary>
  685. /// This specifies the list of parameters with every request to
  686. /// the service.
  687. /// </summary>
  688. public partial class RequestEnvelope {
  689. // Default US culture info
  690. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  691. /// <summary>
  692. ///
  693. /// </summary>
  694. private DetailLevelCode? detailLevelField;
  695. public DetailLevelCode? detailLevel
  696. {
  697. get
  698. {
  699. return this.detailLevelField;
  700. }
  701. set
  702. {
  703. this.detailLevelField = value;
  704. }
  705. }
  706. /// <summary>
  707. ///
  708. /// </summary>
  709. private string errorLanguageField;
  710. public string errorLanguage
  711. {
  712. get
  713. {
  714. return this.errorLanguageField;
  715. }
  716. set
  717. {
  718. this.errorLanguageField = value;
  719. }
  720. }
  721. /// <summary>
  722. /// Default Constructor
  723. /// </summary>
  724. public RequestEnvelope()
  725. {
  726. }
  727. public string ToNVPString(string prefix)
  728. {
  729. StringBuilder sb = new StringBuilder();
  730. if (this.detailLevel != null)
  731. {
  732. sb.Append(prefix).Append("detailLevel").Append("=").Append(EnumUtils.GetDescription(this.detailLevel));
  733. sb.Append("&");
  734. }
  735. if (this.errorLanguage != null)
  736. {
  737. sb.Append(prefix).Append("errorLanguage").Append("=").Append(HttpUtility.UrlEncode(this.errorLanguage, BaseConstants.ENCODING_FORMAT)).Append("&");
  738. }
  739. return sb.ToString();
  740. }
  741. }
  742. /// <summary>
  743. /// This specifies a list of parameters with every response from
  744. /// a service.
  745. /// </summary>
  746. public partial class ResponseEnvelope {
  747. // Default US culture info
  748. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  749. /// <summary>
  750. ///
  751. /// </summary>
  752. private string timestampField;
  753. public string timestamp
  754. {
  755. get
  756. {
  757. return this.timestampField;
  758. }
  759. set
  760. {
  761. this.timestampField = value;
  762. }
  763. }
  764. /// <summary>
  765. ///
  766. /// </summary>
  767. private AckCode? ackField;
  768. public AckCode? ack
  769. {
  770. get
  771. {
  772. return this.ackField;
  773. }
  774. set
  775. {
  776. this.ackField = value;
  777. }
  778. }
  779. /// <summary>
  780. ///
  781. /// </summary>
  782. private string correlationIdField;
  783. public string correlationId
  784. {
  785. get
  786. {
  787. return this.correlationIdField;
  788. }
  789. set
  790. {
  791. this.correlationIdField = value;
  792. }
  793. }
  794. /// <summary>
  795. ///
  796. /// </summary>
  797. private string buildField;
  798. public string build
  799. {
  800. get
  801. {
  802. return this.buildField;
  803. }
  804. set
  805. {
  806. this.buildField = value;
  807. }
  808. }
  809. /// <summary>
  810. /// Default Constructor
  811. /// </summary>
  812. public ResponseEnvelope()
  813. {
  814. }
  815. /// <summary>
  816. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  817. /// </summary>
  818. /// <param name="map">NVP map as returned by an API call</param>
  819. /// <param name="prefix">NVP prefix for this class in the response</param>
  820. /// <param name="index">For array elements, index of this element in the response</param>
  821. /// <returns>
  822. /// A new ResponseEnvelope object created from the passed in NVP map
  823. /// </returns>
  824. public static ResponseEnvelope CreateInstance(Dictionary<string, string> map, string prefix, int index)
  825. {
  826. ResponseEnvelope responseEnvelope = null;
  827. string key;
  828. int i = 0;
  829. if(index != -1)
  830. {
  831. if (prefix.Length > 0 && !prefix.EndsWith("."))
  832. {
  833. prefix = prefix + "(" + index + ").";
  834. }
  835. }
  836. else
  837. {
  838. if (prefix.Length > 0 && !prefix.EndsWith("."))
  839. {
  840. prefix = prefix + ".";
  841. }
  842. }
  843. key = prefix + "timestamp";
  844. if (map.ContainsKey(key))
  845. {
  846. responseEnvelope = (responseEnvelope == null) ? new ResponseEnvelope() : responseEnvelope;
  847. responseEnvelope.timestamp = map[key];
  848. }
  849. key = prefix + "ack";
  850. if (map.ContainsKey(key))
  851. {
  852. responseEnvelope = (responseEnvelope == null) ? new ResponseEnvelope() : responseEnvelope;
  853. responseEnvelope.ack = (AckCode)EnumUtils.GetValue(map[key],typeof(AckCode));
  854. }
  855. key = prefix + "correlationId";
  856. if (map.ContainsKey(key))
  857. {
  858. responseEnvelope = (responseEnvelope == null) ? new ResponseEnvelope() : responseEnvelope;
  859. responseEnvelope.correlationId = map[key];
  860. }
  861. key = prefix + "build";
  862. if (map.ContainsKey(key))
  863. {
  864. responseEnvelope = (responseEnvelope == null) ? new ResponseEnvelope() : responseEnvelope;
  865. responseEnvelope.build = map[key];
  866. }
  867. return responseEnvelope;
  868. }
  869. }
  870. /// <summary>
  871. /// AckCodeType This code identifies the
  872. /// acknowledgment code types that could be used to
  873. /// communicate the status of processing a (request)
  874. /// message to an application. This code would be
  875. /// used as part of a response message that contains
  876. /// an application level acknowledgment element.
  877. ///
  878. /// </summary>
  879. [Serializable]
  880. public enum AckCode {
  881. [Description("Success")]SUCCESS,
  882. [Description("Failure")]FAILURE,
  883. [Description("Warning")]WARNING,
  884. [Description("SuccessWithWarning")]SUCCESSWITHWARNING,
  885. [Description("FailureWithWarning")]FAILUREWITHWARNING
  886. }
  887. /// <summary>
  888. /// DetailLevelCodeType
  889. ///
  890. /// </summary>
  891. [Serializable]
  892. public enum DetailLevelCode {
  893. [Description("ReturnAll")]RETURNALL
  894. }
  895. /// <summary>
  896. ///
  897. /// </summary>
  898. [Serializable]
  899. public enum ErrorCategory {
  900. [Description("System")]SYSTEM,
  901. [Description("Application")]APPLICATION,
  902. [Description("Request")]REQUEST
  903. }
  904. /// <summary>
  905. ///
  906. /// </summary>
  907. [Serializable]
  908. public enum ErrorSeverity {
  909. [Description("Error")]ERROR,
  910. [Description("Warning")]WARNING
  911. }
  912. /// <summary>
  913. /// Specifies the payment terms for this invoice.
  914. ///
  915. /// </summary>
  916. [Serializable]
  917. public enum PaymentTermsType {
  918. [Description("NoDueDate")]NODUEDATE,
  919. [Description("DueOnReceipt")]DUEONRECEIPT,
  920. [Description("DueOnDateSpecified")]DUEONDATESPECIFIED,
  921. [Description("Net10")]NET1,
  922. [Description("Net15")]NET2,
  923. [Description("Net30")]NET3,
  924. [Description("Net45")]NET4
  925. }
  926. /// <summary>
  927. /// Specifies the payment methods that can be used to mark an
  928. /// invoice as paid.
  929. ///
  930. /// </summary>
  931. [Serializable]
  932. public enum PaymentMethodsType {
  933. [Description("BankTransfer")]BANKTRANSFER,
  934. [Description("Cash")]CASH,
  935. [Description("Check")]CHECK,
  936. [Description("CreditCard")]CREDITCARD,
  937. [Description("DebitCard")]DEBITCARD,
  938. [Description("Other")]OTHER,
  939. [Description("PayPal")]PAYPAL,
  940. [Description("WireTransfer")]WIRETRANSFER
  941. }
  942. /// <summary>
  943. /// Specifies the invoice status.
  944. ///
  945. /// </summary>
  946. [Serializable]
  947. public enum StatusType {
  948. [Description("Draft")]DRAFT,
  949. [Description("Sent")]SENT,
  950. [Description("Paid")]PAID,
  951. [Description("MarkedAsPaid")]MARKEDASPAID,
  952. [Description("Canceled")]CANCELED,
  953. [Description("Refunded")]REFUNDED,
  954. [Description("PartiallyRefunded")]PARTIALLYREFUNDED,
  955. [Description("MarkedAsRefunded")]MARKEDASREFUNDED
  956. }
  957. /// <summary>
  958. /// Specifies the merchant or payer.
  959. ///
  960. /// </summary>
  961. [Serializable]
  962. public enum OriginType {
  963. [Description("Web")]WEB,
  964. [Description("API")]API
  965. }
  966. /// <summary>
  967. /// Specifies the merchant or payer.
  968. ///
  969. /// </summary>
  970. [Serializable]
  971. public enum ActorType {
  972. [Description("Merchant")]MERCHANT,
  973. [Description("Payer")]PAYER
  974. }
  975. /// <summary>
  976. /// Contact information for a company participating in the
  977. /// invoicing system.
  978. /// </summary>
  979. public partial class BusinessInfoType {
  980. // Default US culture info
  981. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  982. /// <summary>
  983. ///
  984. /// </summary>
  985. private string firstNameField;
  986. public string firstName
  987. {
  988. get
  989. {
  990. return this.firstNameField;
  991. }
  992. set
  993. {
  994. this.firstNameField = value;
  995. }
  996. }
  997. /// <summary>
  998. ///
  999. /// </summary>
  1000. private string lastNameField;
  1001. public string lastName
  1002. {
  1003. get
  1004. {
  1005. return this.lastNameField;
  1006. }
  1007. set
  1008. {
  1009. this.lastNameField = value;
  1010. }
  1011. }
  1012. /// <summary>
  1013. ///
  1014. /// </summary>
  1015. private string businessNameField;
  1016. public string businessName
  1017. {
  1018. get
  1019. {
  1020. return this.businessNameField;
  1021. }
  1022. set
  1023. {
  1024. this.businessNameField = value;
  1025. }
  1026. }
  1027. /// <summary>
  1028. ///
  1029. /// </summary>
  1030. private string phoneField;
  1031. public string phone
  1032. {
  1033. get
  1034. {
  1035. return this.phoneField;
  1036. }
  1037. set
  1038. {
  1039. this.phoneField = value;
  1040. }
  1041. }
  1042. /// <summary>
  1043. ///
  1044. /// </summary>
  1045. private string faxField;
  1046. public string fax
  1047. {
  1048. get
  1049. {
  1050. return this.faxField;
  1051. }
  1052. set
  1053. {
  1054. this.faxField = value;
  1055. }
  1056. }
  1057. /// <summary>
  1058. ///
  1059. /// </summary>
  1060. private string websiteField;
  1061. public string website
  1062. {
  1063. get
  1064. {
  1065. return this.websiteField;
  1066. }
  1067. set
  1068. {
  1069. this.websiteField = value;
  1070. }
  1071. }
  1072. /// <summary>
  1073. ///
  1074. /// </summary>
  1075. private string languageField;
  1076. public string language
  1077. {
  1078. get
  1079. {
  1080. return this.languageField;
  1081. }
  1082. set
  1083. {
  1084. this.languageField = value;
  1085. }
  1086. }
  1087. /// <summary>
  1088. ///
  1089. /// </summary>
  1090. private string taxIdField;
  1091. public string taxId
  1092. {
  1093. get
  1094. {
  1095. return this.taxIdField;
  1096. }
  1097. set
  1098. {
  1099. this.taxIdField = value;
  1100. }
  1101. }
  1102. /// <summary>
  1103. ///
  1104. /// </summary>
  1105. private string customValueField;
  1106. public string customValue
  1107. {
  1108. get
  1109. {
  1110. return this.customValueField;
  1111. }
  1112. set
  1113. {
  1114. this.customValueField = value;
  1115. }
  1116. }
  1117. /// <summary>
  1118. ///
  1119. /// </summary>
  1120. private BaseAddress addressField;
  1121. public BaseAddress address
  1122. {
  1123. get
  1124. {
  1125. return this.addressField;
  1126. }
  1127. set
  1128. {
  1129. this.addressField = value;
  1130. }
  1131. }
  1132. /// <summary>
  1133. /// Default Constructor
  1134. /// </summary>
  1135. public BusinessInfoType()
  1136. {
  1137. }
  1138. public string ToNVPString(string prefix)
  1139. {
  1140. StringBuilder sb = new StringBuilder();
  1141. if (this.firstName != null)
  1142. {
  1143. sb.Append(prefix).Append("firstName").Append("=").Append(HttpUtility.UrlEncode(this.firstName, BaseConstants.ENCODING_FORMAT)).Append("&");
  1144. }
  1145. if (this.lastName != null)
  1146. {
  1147. sb.Append(prefix).Append("lastName").Append("=").Append(HttpUtility.UrlEncode(this.lastName, BaseConstants.ENCODING_FORMAT)).Append("&");
  1148. }
  1149. if (this.businessName != null)
  1150. {
  1151. sb.Append(prefix).Append("businessName").Append("=").Append(HttpUtility.UrlEncode(this.businessName, BaseConstants.ENCODING_FORMAT)).Append("&");
  1152. }
  1153. if (this.phone != null)
  1154. {
  1155. sb.Append(prefix).Append("phone").Append("=").Append(HttpUtility.UrlEncode(this.phone, BaseConstants.ENCODING_FORMAT)).Append("&");
  1156. }
  1157. if (this.fax != null)
  1158. {
  1159. sb.Append(prefix).Append("fax").Append("=").Append(HttpUtility.UrlEncode(this.fax, BaseConstants.ENCODING_FORMAT)).Append("&");
  1160. }
  1161. if (this.website != null)
  1162. {
  1163. sb.Append(prefix).Append("website").Append("=").Append(HttpUtility.UrlEncode(this.website, BaseConstants.ENCODING_FORMAT)).Append("&");
  1164. }
  1165. if (this.language != null)
  1166. {
  1167. sb.Append(prefix).Append("language").Append("=").Append(HttpUtility.UrlEncode(this.language, BaseConstants.ENCODING_FORMAT)).Append("&");
  1168. }
  1169. if (this.taxId != null)
  1170. {
  1171. sb.Append(prefix).Append("taxId").Append("=").Append(HttpUtility.UrlEncode(this.taxId, BaseConstants.ENCODING_FORMAT)).Append("&");
  1172. }
  1173. if (this.customValue != null)
  1174. {
  1175. sb.Append(prefix).Append("customValue").Append("=").Append(HttpUtility.UrlEncode(this.customValue, BaseConstants.ENCODING_FORMAT)).Append("&");
  1176. }
  1177. if (this.address != null)
  1178. {
  1179. string newPrefix = prefix + "address" + ".";
  1180. sb.Append(this.addressField.ToNVPString(newPrefix));
  1181. }
  1182. return sb.ToString();
  1183. }
  1184. /// <summary>
  1185. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  1186. /// </summary>
  1187. /// <param name="map">NVP map as returned by an API call</param>
  1188. /// <param name="prefix">NVP prefix for this class in the response</param>
  1189. /// <param name="index">For array elements, index of this element in the response</param>
  1190. /// <returns>
  1191. /// A new BusinessInfoType object created from the passed in NVP map
  1192. /// </returns>
  1193. public static BusinessInfoType CreateInstance(Dictionary<string, string> map, string prefix, int index)
  1194. {
  1195. BusinessInfoType businessInfoType = null;
  1196. string key;
  1197. int i = 0;
  1198. if(index != -1)
  1199. {
  1200. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1201. {
  1202. prefix = prefix + "(" + index + ").";
  1203. }
  1204. }
  1205. else
  1206. {
  1207. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1208. {
  1209. prefix = prefix + ".";
  1210. }
  1211. }
  1212. key = prefix + "firstName";
  1213. if (map.ContainsKey(key))
  1214. {
  1215. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1216. businessInfoType.firstName = map[key];
  1217. }
  1218. key = prefix + "lastName";
  1219. if (map.ContainsKey(key))
  1220. {
  1221. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1222. businessInfoType.lastName = map[key];
  1223. }
  1224. key = prefix + "businessName";
  1225. if (map.ContainsKey(key))
  1226. {
  1227. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1228. businessInfoType.businessName = map[key];
  1229. }
  1230. key = prefix + "phone";
  1231. if (map.ContainsKey(key))
  1232. {
  1233. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1234. businessInfoType.phone = map[key];
  1235. }
  1236. key = prefix + "fax";
  1237. if (map.ContainsKey(key))
  1238. {
  1239. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1240. businessInfoType.fax = map[key];
  1241. }
  1242. key = prefix + "website";
  1243. if (map.ContainsKey(key))
  1244. {
  1245. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1246. businessInfoType.website = map[key];
  1247. }
  1248. key = prefix + "language";
  1249. if (map.ContainsKey(key))
  1250. {
  1251. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1252. businessInfoType.language = map[key];
  1253. }
  1254. key = prefix + "taxId";
  1255. if (map.ContainsKey(key))
  1256. {
  1257. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1258. businessInfoType.taxId = map[key];
  1259. }
  1260. key = prefix + "customValue";
  1261. if (map.ContainsKey(key))
  1262. {
  1263. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1264. businessInfoType.customValue = map[key];
  1265. }
  1266. BaseAddress address = BaseAddress.CreateInstance(map, prefix + "address", -1);
  1267. if (address != null)
  1268. {
  1269. businessInfoType = (businessInfoType == null) ? new BusinessInfoType() : businessInfoType;
  1270. businessInfoType.address = address;
  1271. }
  1272. return businessInfoType;
  1273. }
  1274. }
  1275. /// <summary>
  1276. /// Item information about a service or product listed in the
  1277. /// invoice.
  1278. /// </summary>
  1279. public partial class InvoiceItemType {
  1280. // Default US culture info
  1281. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  1282. /// <summary>
  1283. ///
  1284. /// </summary>
  1285. private string nameField;
  1286. public string name
  1287. {
  1288. get
  1289. {
  1290. return this.nameField;
  1291. }
  1292. set
  1293. {
  1294. this.nameField = value;
  1295. }
  1296. }
  1297. /// <summary>
  1298. ///
  1299. /// </summary>
  1300. private string descriptionField;
  1301. public string description
  1302. {
  1303. get
  1304. {
  1305. return this.descriptionField;
  1306. }
  1307. set
  1308. {
  1309. this.descriptionField = value;
  1310. }
  1311. }
  1312. /// <summary>
  1313. ///
  1314. /// </summary>
  1315. private string dateField;
  1316. public string date
  1317. {
  1318. get
  1319. {
  1320. return this.dateField;
  1321. }
  1322. set
  1323. {
  1324. this.dateField = value;
  1325. }
  1326. }
  1327. /// <summary>
  1328. ///
  1329. /// </summary>
  1330. private decimal? quantityField;
  1331. public decimal? quantity
  1332. {
  1333. get
  1334. {
  1335. return this.quantityField;
  1336. }
  1337. set
  1338. {
  1339. this.quantityField = value;
  1340. }
  1341. }
  1342. /// <summary>
  1343. ///
  1344. /// </summary>
  1345. private decimal? unitPriceField;
  1346. public decimal? unitPrice
  1347. {
  1348. get
  1349. {
  1350. return this.unitPriceField;
  1351. }
  1352. set
  1353. {
  1354. this.unitPriceField = value;
  1355. }
  1356. }
  1357. /// <summary>
  1358. ///
  1359. /// </summary>
  1360. private decimal? discountPercentField;
  1361. public decimal? discountPercent
  1362. {
  1363. get
  1364. {
  1365. return this.discountPercentField;
  1366. }
  1367. set
  1368. {
  1369. this.discountPercentField = value;
  1370. }
  1371. }
  1372. /// <summary>
  1373. ///
  1374. /// </summary>
  1375. private decimal? discountAmountField;
  1376. public decimal? discountAmount
  1377. {
  1378. get
  1379. {
  1380. return this.discountAmountField;
  1381. }
  1382. set
  1383. {
  1384. this.discountAmountField = value;
  1385. }
  1386. }
  1387. /// <summary>
  1388. ///
  1389. /// </summary>
  1390. private string taxNameField;
  1391. public string taxName
  1392. {
  1393. get
  1394. {
  1395. return this.taxNameField;
  1396. }
  1397. set
  1398. {
  1399. this.taxNameField = value;
  1400. }
  1401. }
  1402. /// <summary>
  1403. ///
  1404. /// </summary>
  1405. private decimal? taxRateField;
  1406. public decimal? taxRate
  1407. {
  1408. get
  1409. {
  1410. return this.taxRateField;
  1411. }
  1412. set
  1413. {
  1414. this.taxRateField = value;
  1415. }
  1416. }
  1417. /// <summary>
  1418. ///
  1419. /// </summary>
  1420. private decimal? taxAmountField;
  1421. public decimal? taxAmount
  1422. {
  1423. get
  1424. {
  1425. return this.taxAmountField;
  1426. }
  1427. set
  1428. {
  1429. this.taxAmountField = value;
  1430. }
  1431. }
  1432. /// <summary>
  1433. ///
  1434. /// </summary>
  1435. private string imageUrlField;
  1436. public string imageUrl
  1437. {
  1438. get
  1439. {
  1440. return this.imageUrlField;
  1441. }
  1442. set
  1443. {
  1444. this.imageUrlField = value;
  1445. }
  1446. }
  1447. /// <summary>
  1448. /// Constructor with arguments
  1449. /// </summary>
  1450. public InvoiceItemType(string name, decimal? quantity, decimal? unitPrice)
  1451. {
  1452. this.name = name;
  1453. this.quantity = quantity;
  1454. this.unitPrice = unitPrice;
  1455. }
  1456. /// <summary>
  1457. /// Default Constructor
  1458. /// </summary>
  1459. public InvoiceItemType()
  1460. {
  1461. }
  1462. public string ToNVPString(string prefix)
  1463. {
  1464. StringBuilder sb = new StringBuilder();
  1465. if (this.name != null)
  1466. {
  1467. sb.Append(prefix).Append("name").Append("=").Append(HttpUtility.UrlEncode(this.name, BaseConstants.ENCODING_FORMAT)).Append("&");
  1468. }
  1469. if (this.description != null)
  1470. {
  1471. sb.Append(prefix).Append("description").Append("=").Append(HttpUtility.UrlEncode(this.description, BaseConstants.ENCODING_FORMAT)).Append("&");
  1472. }
  1473. if (this.date != null)
  1474. {
  1475. sb.Append(prefix).Append("date").Append("=").Append(HttpUtility.UrlEncode(this.date, BaseConstants.ENCODING_FORMAT)).Append("&");
  1476. }
  1477. if (this.quantity != null)
  1478. {
  1479. sb.Append(prefix).Append("quantity").Append("=").Append(Convert.ToString(this.quantity, DefaultCulture)).Append("&");
  1480. }
  1481. if (this.unitPrice != null)
  1482. {
  1483. sb.Append(prefix).Append("unitPrice").Append("=").Append(Convert.ToString(this.unitPrice, DefaultCulture)).Append("&");
  1484. }
  1485. if (this.discountPercent != null)
  1486. {
  1487. sb.Append(prefix).Append("discountPercent").Append("=").Append(Convert.ToString(this.discountPercent, DefaultCulture)).Append("&");
  1488. }
  1489. if (this.discountAmount != null)
  1490. {
  1491. sb.Append(prefix).Append("discountAmount").Append("=").Append(Convert.ToString(this.discountAmount, DefaultCulture)).Append("&");
  1492. }
  1493. if (this.taxName != null)
  1494. {
  1495. sb.Append(prefix).Append("taxName").Append("=").Append(HttpUtility.UrlEncode(this.taxName, BaseConstants.ENCODING_FORMAT)).Append("&");
  1496. }
  1497. if (this.taxRate != null)
  1498. {
  1499. sb.Append(prefix).Append("taxRate").Append("=").Append(Convert.ToString(this.taxRate, DefaultCulture)).Append("&");
  1500. }
  1501. if (this.taxAmount != null)
  1502. {
  1503. sb.Append(prefix).Append("taxAmount").Append("=").Append(Convert.ToString(this.taxAmount, DefaultCulture)).Append("&");
  1504. }
  1505. if (this.imageUrl != null)
  1506. {
  1507. sb.Append(prefix).Append("imageUrl").Append("=").Append(HttpUtility.UrlEncode(this.imageUrl, BaseConstants.ENCODING_FORMAT)).Append("&");
  1508. }
  1509. return sb.ToString();
  1510. }
  1511. /// <summary>
  1512. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  1513. /// </summary>
  1514. /// <param name="map">NVP map as returned by an API call</param>
  1515. /// <param name="prefix">NVP prefix for this class in the response</param>
  1516. /// <param name="index">For array elements, index of this element in the response</param>
  1517. /// <returns>
  1518. /// A new InvoiceItemType object created from the passed in NVP map
  1519. /// </returns>
  1520. public static InvoiceItemType CreateInstance(Dictionary<string, string> map, string prefix, int index)
  1521. {
  1522. InvoiceItemType invoiceItemType = null;
  1523. string key;
  1524. int i = 0;
  1525. if(index != -1)
  1526. {
  1527. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1528. {
  1529. prefix = prefix + "(" + index + ").";
  1530. }
  1531. }
  1532. else
  1533. {
  1534. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1535. {
  1536. prefix = prefix + ".";
  1537. }
  1538. }
  1539. key = prefix + "name";
  1540. if (map.ContainsKey(key))
  1541. {
  1542. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1543. invoiceItemType.name = map[key];
  1544. }
  1545. key = prefix + "description";
  1546. if (map.ContainsKey(key))
  1547. {
  1548. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1549. invoiceItemType.description = map[key];
  1550. }
  1551. key = prefix + "date";
  1552. if (map.ContainsKey(key))
  1553. {
  1554. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1555. invoiceItemType.date = map[key];
  1556. }
  1557. key = prefix + "quantity";
  1558. if (map.ContainsKey(key))
  1559. {
  1560. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1561. invoiceItemType.quantity = System.Convert.ToDecimal(map[key], DefaultCulture);
  1562. }
  1563. key = prefix + "unitPrice";
  1564. if (map.ContainsKey(key))
  1565. {
  1566. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1567. invoiceItemType.unitPrice = System.Convert.ToDecimal(map[key], DefaultCulture);
  1568. }
  1569. key = prefix + "discountPercent";
  1570. if (map.ContainsKey(key))
  1571. {
  1572. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1573. invoiceItemType.discountPercent = System.Convert.ToDecimal(map[key], DefaultCulture);
  1574. }
  1575. key = prefix + "discountAmount";
  1576. if (map.ContainsKey(key))
  1577. {
  1578. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1579. invoiceItemType.discountAmount = System.Convert.ToDecimal(map[key], DefaultCulture);
  1580. }
  1581. key = prefix + "taxName";
  1582. if (map.ContainsKey(key))
  1583. {
  1584. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1585. invoiceItemType.taxName = map[key];
  1586. }
  1587. key = prefix + "taxRate";
  1588. if (map.ContainsKey(key))
  1589. {
  1590. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1591. invoiceItemType.taxRate = System.Convert.ToDecimal(map[key], DefaultCulture);
  1592. }
  1593. key = prefix + "taxAmount";
  1594. if (map.ContainsKey(key))
  1595. {
  1596. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1597. invoiceItemType.taxAmount = System.Convert.ToDecimal(map[key], DefaultCulture);
  1598. }
  1599. key = prefix + "imageUrl";
  1600. if (map.ContainsKey(key))
  1601. {
  1602. invoiceItemType = (invoiceItemType == null) ? new InvoiceItemType() : invoiceItemType;
  1603. invoiceItemType.imageUrl = map[key];
  1604. }
  1605. return invoiceItemType;
  1606. }
  1607. }
  1608. /// <summary>
  1609. /// A list of invoice items.
  1610. /// </summary>
  1611. public partial class InvoiceItemListType {
  1612. // Default US culture info
  1613. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  1614. /// <summary>
  1615. ///
  1616. /// </summary>
  1617. private List<InvoiceItemType> itemField = new List<InvoiceItemType>();
  1618. public List<InvoiceItemType> item
  1619. {
  1620. get
  1621. {
  1622. return this.itemField;
  1623. }
  1624. set
  1625. {
  1626. this.itemField = value;
  1627. }
  1628. }
  1629. /// <summary>
  1630. /// Constructor with arguments
  1631. /// </summary>
  1632. public InvoiceItemListType(List<InvoiceItemType> item)
  1633. {
  1634. this.item = item;
  1635. }
  1636. /// <summary>
  1637. /// Default Constructor
  1638. /// </summary>
  1639. public InvoiceItemListType()
  1640. {
  1641. }
  1642. public string ToNVPString(string prefix)
  1643. {
  1644. StringBuilder sb = new StringBuilder();
  1645. for (int i = 0; i < this.item.Count; i++)
  1646. {
  1647. if (this.item[i] != null)
  1648. {
  1649. string newPrefix = prefix + "item" + "(" + i + ").";
  1650. sb.Append(this.item[i].ToNVPString(newPrefix));
  1651. }
  1652. }
  1653. return sb.ToString();
  1654. }
  1655. /// <summary>
  1656. /// Factory method for creating new object instances. For use by the de-serialization classes only.
  1657. /// </summary>
  1658. /// <param name="map">NVP map as returned by an API call</param>
  1659. /// <param name="prefix">NVP prefix for this class in the response</param>
  1660. /// <param name="index">For array elements, index of this element in the response</param>
  1661. /// <returns>
  1662. /// A new InvoiceItemListType object created from the passed in NVP map
  1663. /// </returns>
  1664. public static InvoiceItemListType CreateInstance(Dictionary<string, string> map, string prefix, int index)
  1665. {
  1666. InvoiceItemListType invoiceItemListType = null;
  1667. string key;
  1668. int i = 0;
  1669. if(index != -1)
  1670. {
  1671. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1672. {
  1673. prefix = prefix + "(" + index + ").";
  1674. }
  1675. }
  1676. else
  1677. {
  1678. if (prefix.Length > 0 && !prefix.EndsWith("."))
  1679. {
  1680. prefix = prefix + ".";
  1681. }
  1682. }
  1683. i = 0;
  1684. while(true)
  1685. {
  1686. InvoiceItemType item = InvoiceItemType.CreateInstance(map, prefix + "item", i);
  1687. if (item != null)
  1688. {
  1689. invoiceItemListType = (invoiceItemListType == null) ? new InvoiceItemListType() : invoiceItemListType;
  1690. invoiceItemListType.item.Add(item);
  1691. i++;
  1692. }
  1693. else
  1694. {
  1695. break;
  1696. }
  1697. }
  1698. return invoiceItemListType;
  1699. }
  1700. }
  1701. /// <summary>
  1702. /// Invoice details about the merchant, payer, totals and terms.
  1703. ///
  1704. /// </summary>
  1705. public partial class InvoiceType {
  1706. // Default US culture info
  1707. private static CultureInfo DefaultCulture = new CultureInfo("en-US");
  1708. /// <summary>
  1709. ///
  1710. /// </summary>
  1711. private string merchantEmailField;
  1712. public string merchantEmail
  1713. {
  1714. get
  1715. {
  1716. return this.merchantEmailField;
  1717. }
  1718. set
  1719. {
  1720. this.merchantEmailField = value;
  1721. }
  1722. }
  1723. /// <summary>
  1724. ///
  1725. /// </summary>
  1726. private string payerEmailField;
  1727. public string payerEmail
  1728. {
  1729. get
  1730. {
  1731. return this.payerEmailField;
  1732. }
  1733. set
  1734. {
  1735. this.payerEmailField = value;
  1736. }
  1737. }
  1738. /// <summary>
  1739. ///
  1740. /// </summary>
  1741. private string numberField;
  1742. public string number
  1743. {
  1744. get
  1745. {
  1746. return this.numberField;
  1747. }
  1748. set
  1749. {
  1750. this.numberField = value;
  1751. }
  1752. }
  1753. /// <summary>
  1754. ///
  1755. /// </summary>
  1756. private BusinessInfoType merchantInfoField;
  1757. public BusinessInfoType merchantInfo
  1758. {
  1759. get
  1760. {
  1761. return this.merchantInfoField;
  1762. }
  1763. set
  1764. {
  1765. this.merchantInfoField = value;
  1766. }
  1767. }
  1768. /// <summary>
  1769. ///
  1770. /// </summary>
  1771. private InvoiceItemListType itemListField;
  1772. public InvoiceItemListType itemList
  1773. {
  1774. get
  1775. {
  1776. return this.itemListField;
  1777. }
  1778. set
  1779. {
  1780. this.itemListField = value;
  1781. }
  1782. }
  1783. /// <summary>
  1784. ///
  1785. /// </summary>
  1786. private bool? taxCalculatedAfterDiscountField;
  1787. public bool? taxCalculatedAfterDiscount
  1788. {
  1789. get
  1790. {
  1791. return this.taxCalculatedAfterDiscountField;
  1792. }
  1793. set
  1794. {
  1795. this.taxCalculatedAfterDiscountField = value;
  1796. }
  1797. }
  1798. /// <summary>
  1799. ///
  1800. /// </summary>
  1801. private string currencyCodeField;
  1802. public string currencyCode
  1803. {
  1804. get
  1805. {
  1806. return this.currencyCodeField;
  1807. }
  1808. set
  1809. {
  1810. this.currencyCodeField = value;
  1811. }
  1812. }
  1813. /// <summary>
  1814. ///
  1815. /// </summary>
  1816. private string invoiceDateField;
  1817. public string invoiceDate
  1818. {
  1819. get
  1820. {
  1821. return this.invoiceDateField;
  1822. }
  1823. set
  1824. {
  1825. this.invoiceDateField = value;
  1826. }
  1827. }
  1828. /// <summary>
  1829. ///
  1830. /// </summary>
  1831. private string dueDateField;
  1832. public string dueDate
  1833. {
  1834. get
  1835. {
  1836. return this.dueDateField;
  1837. }
  1838. set
  1839. {
  1840. this.dueDateField = value;
  1841. }
  1842. }
  1843. /// <summary>
  1844. ///
  1845. /// </summary>
  1846. private PaymentTermsType? paymentTermsField;
  1847. public PaymentTermsType? paymentTerms
  1848. {
  1849. get
  1850. {
  1851. return this.paymentTermsField;
  1852. }
  1853. set
  1854. {
  1855. this.paymentTermsField = value;
  1856. }
  1857. }
  1858. /// <summary>
  1859. ///
  1860. /// </summary>
  1861. private decimal? discountPercentField;
  1862. public decimal? discountPercent
  1863. {
  1864. get
  1865. {
  1866. return this.discountPercentField;
  1867. }
  1868. set
  1869. {
  1870. this.discountPercentField = value;
  1871. }
  1872. }
  1873. /// <summary>
  1874. ///
  1875. /// </summary>
  1876. private decimal? discountAmountField;
  1877. public decimal? discountAmount
  1878. {
  1879. get
  1880. {
  1881. return this.discountAmountField;
  1882. }
  1883. set
  1884. {
  1885. this.discountAmountField = value;
  1886. }
  1887. }
  1888. /// <summary>
  1889. ///
  1890. /// </summary>
  1891. private decimal? totalItemDiscountAmountField;
  1892. public decimal? totalItemDiscountAmount
  1893. {
  1894. get
  1895. {
  1896. return this.totalItemDiscountAmountField;
  1897. }
  1898. set
  1899. {
  1900. this.totalItemDiscountAmountField = value;
  1901. }
  1902. }
  1903. /// <summary>
  1904. ///
  1905. /// </summary>
  1906. private bool? taxInclusiveField;
  1907. public bool? taxInclusive
  1908. {
  1909. get
  1910. {
  1911. return this.taxInclusiveField;
  1912. }
  1913. set
  1914. {
  1915. this.taxInclusiveField = value;
  1916. }
  1917. }
  1918. /// <summary>
  1919. ///
  1920. /// </summary>
  1921. private string termsField;
  1922. public string terms
  1923. {
  1924. get
  1925. {
  1926. return this.termsField;
  1927. }
  1928. set
  1929. {
  1930. this.termsField = value;
  1931. }
  1932. }
  1933. /// <summary>
  1934. ///
  1935. /// </summary>
  1936. private string noteField;
  1937. public string note
  1938. {
  1939. get
  1940. {
  1941. return this.noteField;
  1942. }
  1943. set
  1944. {
  1945. this.noteField = value;
  1946. }
  1947. }
  1948. /// <summary>
  1949. ///
  1950. /// </summary>
  1951. private string merchantMemoField;
  1952. public string merchantMemo
  1953. {
  1954. get
  1955. {
  1956. return this.merchantMemoField;
  1957. }
  1958. set
  1959. {
  1960. this.merchantMemoField = value;
  1961. }
  1962. }
  1963. /// <summary>
  1964. ///
  1965. /// </summary>
  1966. private string receiptDetailsField;
  1967. public string receiptDetails
  1968. {
  1969. get
  1970. {
  1971. return this.receiptDetailsField;
  1972. }
  1973. set
  1974. {
  1975. this.receiptDetailsField = value;
  1976. }
  1977. }
  1978. /// <summary>
  1979. ///
  1980. /// </summary>
  1981. private BusinessInfoType billingInfoField;
  1982. public BusinessInfoType billingInfo
  1983. {
  1984. get
  1985. {
  1986. return this.billingInfoField;
  1987. }
  1988. set
  1989. {
  1990. this.billingInfoField = value;
  1991. }
  1992. }
  1993. /// <summary>
  1994. ///
  1995. /// </summary>
  1996. private BusinessInfoType shippingInfoField;
  1997. public BusinessInfoType shippingInfo
  1998. {
  1999. get
  2000. {
  2001. return this.shippingInfoField;
  2002. }
  2003. set
  2004. {
  2005. this.shippingInfoField = value;
  2006. }
  2007. }
  2008. /// <summary>
  2009. ///
  2010. /// </summary>
  2011. private decimal? shippingAmountField;
  2012. public decimal? shippingAmount
  2013. {
  2014. get
  2015. {
  2016. return this.shippingAmountField;
  2017. }
  2018. set
  2019. {
  2020. this.shippingAmountField = value;
  2021. }
  2022. }
  2023. /// <summary>
  2024. ///
  2025. /// </summary>
  2026. private string shippingTaxNameField;
  2027. public string shippingTaxName
  2028. {
  2029. get
  2030. {
  2031. return this.shippingTaxNameField;
  2032. }
  2033. set
  2034. {
  2035. this.shippingTaxNameField = value;
  2036. }
  2037. }
  2038. /// <summary>
  2039. ///
  2040. /// </summary>
  2041. private decimal? shippingTaxRateField;
  2042. public decimal? shippingTaxRate
  2043. {
  2044. get
  2045. {
  2046. return this.shippingTaxRateField;
  2047. }
  2048. set
  2049. {
  2050. this.shippingTaxRateField = value;
  2051. }
  2052. }
  2053. /// <summary>
  2054. ///
  2055. /// </summary>
  2056. private decimal? shippingTaxAmountField;
  2057. public decimal? shippingTaxAmount
  2058. {
  2059. get
  2060. {
  2061. return this.shippingTaxAmountField;
  2062. }
  2063. set
  2064. {
  2065. this.shippingTaxAmountField = value;
  2066. }
  2067. }
  2068. /// <summary>
  2069. ///
  2070. /// </summary>
  2071. private string logoUrlField;
  2072. public string logoUrl
  2073. {
  2074. get
  2075. {
  2076. return this.logoUrlField;
  2077. }
  2078. set
  2079. {
  2080. this.logoUrlField = value;
  2081. }
  2082. }
  2083. /// <summary>
  2084. ///
  2085. /// </summary>
  2086. private string referrerCodeField;
  2087. public string referrerCode
  2088. {
  2089. get
  2090. {
  2091. return this.referrerCodeField;
  2092. }
  2093. set
  2094. {
  2095. this.referrerCodeField = value;
  2096. }
  2097. }
  2098. /// <summary>
  2099. ///
  2100. /// </summary>
  2101. private string customAmountLabelField;
  2102. public string customAmountLabel
  2103. {
  2104. get
  2105. {
  2106. return this.customAmountLabelField;
  2107. }
  2108. set
  2109. {
  2110. this.customAmountLabelField = value;
  2111. }
  2112. }
  2113. /// <summary>
  2114. ///
  2115. /// </summary>
  2116. private decimal? customAmountValueField;
  2117. public decimal? customAmountValue
  2118. {
  2119. get
  2120. {
  2121. return this.customAmountValueField;
  2122. }
  2123. set
  2124. {
  2125. this.customAmountValueField = value;
  2126. }
  2127. }
  2128. /// <summary>
  2129. /// Constructor with arguments
  2130. /// </summary>
  2131. public InvoiceType(string merchantEmail, string payerEmail, InvoiceItemListType itemList, string currencyCode)
  2132. {
  2133. this.merchantEmail = merchantEmail;
  2134. this.payerEmail = payerEmail;
  2135. this.itemList = itemList;
  2136. this.currencyCode = currencyCode;
  2137. }
  2138. /// <summary>
  2139. /// Default Constructor
  2140. /// </summary>
  2141. public InvoiceType()
  2142. {
  2143. }
  2144. public string ToNVPString(string prefix)
  2145. {
  2146. StringBuilder sb = new StringBuilder();
  2147. if (this.merchantEmail != null)
  2148. {
  2149. sb.Append(prefix).Append("merchantEmail").Append("=").Append(HttpUtility.UrlEncode(this.merchantEmail, BaseConstants.ENCODING_FORMAT)).Append("&");
  2150. }
  2151. if (this.payerEmail != null)
  2152. {
  2153. sb.Append(prefix).Append("payerEmail").Append("=").Append(HttpUtility.UrlEncode(this.payerEmail, BaseConstants.ENCODING_FORMAT)).Append("&");
  2154. }
  2155. if (this.number != null)
  2156. {
  2157. sb.Append(prefix).Append("number").Append("=").Append(HttpUtility.UrlEncode(this.number, BaseConstants.ENCODING_FORMAT)).Append("&");
  2158. }
  2159. if (this.merchantInfo != null)
  2160. {
  2161. string newPrefix = prefix + "merchantInfo" + ".";
  2162. sb.Append(this.merchantInfoField.ToNVPString(newPrefix));
  2163. }
  2164. if (this.itemList != null)
  2165. {
  2166. string newPrefix = prefix + "itemList" + ".";
  2167. sb.Append(this.itemListField.ToNVPString(newPrefix));
  2168. }
  2169. if (this.taxCalculatedAfterDiscount != null)
  2170. {
  2171. sb.Append(prefix).Append("taxCalculatedAfterDiscount").Append("=").Append(Convert.ToString(this.taxCalculatedAfterDiscount, DefaultCulture)).Append("&");
  2172. }
  2173. if (this.currencyCode != null)
  2174. {
  2175. sb.Append(prefix).Append("currencyCode").Append("=").Append(HttpUtility.UrlEncode(this.currencyCode, BaseConstants.ENCODING_FORMAT)).Append("&");
  2176. }
  2177. if (this.invoiceDate != null)
  2178. {
  2179. sb.Append(prefix).Append("invoiceDate").Append("=").Append(HttpUtility.UrlEncode(this.invoiceDate, BaseConstants.ENCODING_FORMAT)).Append("&");
  2180. }
  2181. if (this.dueDate != null)
  2182. {
  2183. sb.Append(prefix).Append("dueDate").Append("=").Append(HttpUtility.UrlEncode(this.dueDate, BaseConstants.ENCODING_FORMAT)).Append("&");
  2184. }
  2185. if (this.paymentTerms != null)
  2186. {
  2187. sb.Append(prefix)

Large files files are truncated, but you can click here to view the full file