1. 1 :
  2. 2 :
  3. 3 : (function(root, factory) {
  4. 4 :
  5. 5 : if (typeof module === 'object' && module.exports) {
  6. 6 : // CommonJS-like environments that support module.exports, like Node.
  7. 7 : module.exports = factory(require('../ApiClient'), require('./InvocationContext'), require('../CommonUtil'), require('../ResponseWrapper'), require('./Base'), require('../OrbipayApiError'));
  8. 8 : }
  9. 9 : }(this, function(ApiClient, InvocationContext, CommonUtil, ResponseWrapper, Base, OrbipayApiError) {
  10. 10 : 'use strict';
  11. 11 :
  12. 12 : /**
  13. 13 : * The Address wrapper module.
  14. 14 : * @module wrappers/Address
  15. 15 : */
  16. 16 : var exports = function(address_line1, address_line2, address_city, address_state, address_country, address_zip1, address_zip2) {
  17. 17 : var _this = this;
  18. 18 : Base.call(_this);
  19. 19 : _this['address_line1'] = address_line1;
  20. 20 : _this['address_line2'] = address_line2;
  21. 21 : _this['address_city'] = address_city;
  22. 22 : _this['address_state'] = address_state;
  23. 23 : _this['address_country'] = address_country;
  24. 24 : _this['address_zip1'] = address_zip1;
  25. 25 : _this['address_zip2'] = address_zip2;
  26. 26 : };
  27. 27 :
  28. 28 : /**
  29. 29 : * Constructs a <code>Address</code> from a plain JavaScript object, optionally creating a new instance.
  30. 30 : * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
  31. 31 : * @param {Object} data The plain JavaScript object bearing properties of interest.
  32. 32 : * @param {module:wrappers/Address} obj Optional instance to populate.
  33. 33 : * @return {module:wrappers/Address} The populated <code>Address</code> instance.
  34. 34 : */
  35. 35 : exports.constructFromObject = function (data, obj) {
  36. 36 : if (data) {
  37. 37 : obj = obj || new exports();
  38. 38 : if (data.hasOwnProperty('address_line1')) {
  39. 39 : obj['address_line1'] = data['address_line1'];
  40. 40 : }
  41. 41 : if (data.hasOwnProperty('address_line2')) {
  42. 42 : obj['address_line2'] = data['address_line2'];
  43. 43 : }
  44. 44 : if (data.hasOwnProperty('address_city')) {
  45. 45 : obj['address_city'] = data['address_city'];
  46. 46 : }
  47. 47 : if (data.hasOwnProperty('address_state')) {
  48. 48 : obj['address_state'] = data['address_state'];
  49. 49 : }
  50. 50 : if (data.hasOwnProperty('address_country')) {
  51. 51 : obj['address_country'] = data['address_country'];
  52. 52 : }
  53. 53 : if (data.hasOwnProperty('address_zip1')) {
  54. 54 : obj['address_zip1'] = data['address_zip1'];
  55. 55 : }
  56. 56 : if (data.hasOwnProperty('address_zip2')) {
  57. 57 : obj['address_zip2'] = data['address_zip2'];
  58. 58 : }
  59. 59 : }
  60. 60 : return obj;
  61. 61 : };
  62. 62 :
  63. 63 :
  64. 64 : exports.prototype = Object.create(Base.prototype);
  65. 65 : exports.prototype.constructor = exports;
  66. 66 :
  67. 67 : /**
  68. 68 : * Line one of the address.
  69. 69 : * @member {String} address_line1
  70. 70 : */
  71. 71 : exports.prototype['address_line1'] = undefined;
  72. 72 : /**
  73. 73 : * Line two of the address.
  74. 74 : * @member {String} address_line2
  75. 75 : */
  76. 76 : exports.prototype['address_line2'] = undefined;
  77. 77 : /**
  78. 78 : * City of the address.
  79. 79 : * @member {String} address_city
  80. 80 : */
  81. 81 : exports.prototype['address_city'] = undefined;
  82. 82 : /**
  83. 83 : * The state or province code as per ISO_3166-2.
  84. 84 : * @member {String} address_state
  85. 85 : */
  86. 86 : exports.prototype['address_state'] = undefined;
  87. 87 : /**
  88. 88 : * The 3 letter country code as per ISO 3166-1 (alpha-3).
  89. 89 : * @member {String} address_country
  90. 90 : */
  91. 91 : exports.prototype['address_country'] = undefined;
  92. 92 : /**
  93. 93 : * The first part of the postal code for the address as per the system followed in the appropriate country where it belongs.
  94. 94 : * @member {String} address_zip1
  95. 95 : */
  96. 96 : exports.prototype['address_zip1'] = undefined;
  97. 97 : /**
  98. 98 : * The 4 digit add-on code used, in addition to the 5 digit postal code, by the US Postal Service.
  99. 99 : * @member {String} address_zip2
  100. 100 : */
  101. 101 : exports.prototype['address_zip2'] = undefined;
  102. 102 :
  103. 103 :
  104. 104 :
  105. 105 :
  106. 106 : return exports;
  107. 107 :
  108. 108 : }));