maxio-advanced-billing-sdk 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -45
  3. data/lib/advanced_billing/configuration.rb +2 -2
  4. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +24 -24
  5. data/lib/advanced_billing/controllers/api_exports_controller.rb +57 -57
  6. data/lib/advanced_billing/controllers/base_controller.rb +10 -10
  7. data/lib/advanced_billing/controllers/billing_portal_controller.rb +33 -32
  8. data/lib/advanced_billing/controllers/component_price_points_controller.rb +60 -60
  9. data/lib/advanced_billing/controllers/components_controller.rb +110 -107
  10. data/lib/advanced_billing/controllers/coupons_controller.rb +89 -89
  11. data/lib/advanced_billing/controllers/custom_fields_controller.rb +76 -76
  12. data/lib/advanced_billing/controllers/customers_controller.rb +45 -41
  13. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +53 -53
  14. data/lib/advanced_billing/controllers/events_controller.rb +16 -15
  15. data/lib/advanced_billing/controllers/insights_controller.rb +17 -17
  16. data/lib/advanced_billing/controllers/invoices_controller.rb +99 -99
  17. data/lib/advanced_billing/controllers/offers_controller.rb +18 -15
  18. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +107 -104
  19. data/lib/advanced_billing/controllers/product_families_controller.rb +26 -26
  20. data/lib/advanced_billing/controllers/product_price_points_controller.rb +62 -62
  21. data/lib/advanced_billing/controllers/products_controller.rb +37 -37
  22. data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +61 -61
  23. data/lib/advanced_billing/controllers/reason_codes_controller.rb +35 -35
  24. data/lib/advanced_billing/controllers/referral_codes_controller.rb +9 -8
  25. data/lib/advanced_billing/controllers/sales_commissions_controller.rb +13 -13
  26. data/lib/advanced_billing/controllers/sites_controller.rb +11 -10
  27. data/lib/advanced_billing/controllers/subscription_components_controller.rb +170 -161
  28. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +23 -23
  29. data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +21 -21
  30. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +54 -54
  31. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +37 -37
  32. data/lib/advanced_billing/controllers/subscription_notes_controller.rb +20 -16
  33. data/lib/advanced_billing/controllers/subscription_products_controller.rb +20 -18
  34. data/lib/advanced_billing/controllers/subscription_status_controller.rb +74 -74
  35. data/lib/advanced_billing/controllers/subscriptions_controller.rb +163 -160
  36. data/lib/advanced_billing/controllers/webhooks_controller.rb +45 -44
  37. data/lib/advanced_billing/exceptions/component_allocation_error_exception.rb +15 -15
  38. data/lib/advanced_billing/exceptions/component_price_point_error_exception.rb +15 -15
  39. data/lib/advanced_billing/exceptions/customer_error_response_exception.rb +15 -15
  40. data/lib/advanced_billing/exceptions/error_array_map_response_exception.rb +15 -15
  41. data/lib/advanced_billing/exceptions/error_list_response_exception.rb +15 -15
  42. data/lib/advanced_billing/exceptions/error_string_map_response_exception.rb +15 -15
  43. data/lib/advanced_billing/exceptions/event_based_billing_list_segments_errors_exception.rb +15 -15
  44. data/lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb +15 -15
  45. data/lib/advanced_billing/exceptions/event_based_billing_segment_exception.rb +15 -15
  46. data/lib/advanced_billing/exceptions/product_price_point_error_response_exception.rb +15 -15
  47. data/lib/advanced_billing/exceptions/proforma_bad_request_error_response_exception.rb +15 -15
  48. data/lib/advanced_billing/exceptions/refund_prepayment_base_errors_response_exception.rb +15 -15
  49. data/lib/advanced_billing/exceptions/single_error_response_exception.rb +15 -15
  50. data/lib/advanced_billing/exceptions/single_string_error_response_exception.rb +15 -15
  51. data/lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb +15 -15
  52. data/lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb +15 -15
  53. data/lib/advanced_billing/exceptions/subscription_group_create_error_response_exception.rb +15 -15
  54. data/lib/advanced_billing/exceptions/subscription_group_signup_error_response_exception.rb +15 -15
  55. data/lib/advanced_billing/exceptions/subscription_group_update_error_response_exception.rb +15 -15
  56. data/lib/advanced_billing/exceptions/subscription_remove_coupon_errors_exception.rb +15 -15
  57. data/lib/advanced_billing/exceptions/subscriptions_mrr_error_response_exception.rb +15 -15
  58. data/lib/advanced_billing/exceptions/too_many_management_link_requests_error_exception.rb +15 -15
  59. data/lib/advanced_billing/models/activate_event_based_component.rb +84 -0
  60. data/lib/advanced_billing/models/{current_vault.rb → all_vaults.rb} +28 -7
  61. data/lib/advanced_billing/models/allocation.rb +1 -0
  62. data/lib/advanced_billing/models/allocation_preview_item.rb +1 -0
  63. data/lib/advanced_billing/models/apple_pay_payment_profile.rb +232 -0
  64. data/lib/advanced_billing/models/apple_pay_vault.rb +20 -0
  65. data/lib/advanced_billing/models/bank_account_attributes.rb +2 -0
  66. data/lib/advanced_billing/models/bank_account_payment_profile.rb +25 -20
  67. data/lib/advanced_billing/models/bank_account_vault.rb +19 -9
  68. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +6 -6
  69. data/lib/advanced_billing/models/component.rb +1 -0
  70. data/lib/advanced_billing/models/component_custom_price.rb +33 -14
  71. data/lib/advanced_billing/models/component_price_point_item.rb +3 -1
  72. data/lib/advanced_billing/models/create_component_price_point.rb +3 -1
  73. data/lib/advanced_billing/models/create_customer.rb +11 -1
  74. data/lib/advanced_billing/models/create_metafield.rb +2 -1
  75. data/lib/advanced_billing/models/create_or_update_product.rb +7 -4
  76. data/lib/advanced_billing/models/create_payment_profile.rb +1 -1
  77. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +6 -5
  78. data/lib/advanced_billing/models/create_product_price_point.rb +5 -3
  79. data/lib/advanced_billing/models/create_subscription.rb +27 -25
  80. data/lib/advanced_billing/models/credit_card_payment_profile.rb +17 -16
  81. data/lib/advanced_billing/models/credit_card_vault.rb +117 -0
  82. data/lib/advanced_billing/models/credit_note.rb +2 -2
  83. data/lib/advanced_billing/models/customer.rb +11 -1
  84. data/lib/advanced_billing/models/customer_attributes.rb +12 -1
  85. data/lib/advanced_billing/models/ebb_component.rb +1 -0
  86. data/lib/advanced_billing/models/{extended_interval_unit.rb → expiration_interval_unit.rb} +4 -4
  87. data/lib/advanced_billing/models/full_subscription_group_response.rb +65 -50
  88. data/lib/advanced_billing/models/get_one_time_token_payment_profile.rb +1 -1
  89. data/lib/advanced_billing/models/invoice.rb +19 -9
  90. data/lib/advanced_billing/models/invoice_consolidation_level.rb +2 -2
  91. data/lib/advanced_billing/models/invoice_refund.rb +13 -1
  92. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  93. data/lib/advanced_billing/models/invoice_tax.rb +29 -0
  94. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +101 -1
  95. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  96. data/lib/advanced_billing/models/metered_component.rb +4 -3
  97. data/lib/advanced_billing/models/offer_item.rb +3 -1
  98. data/lib/advanced_billing/models/on_off_component.rb +3 -2
  99. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  100. data/lib/advanced_billing/models/pay_pal_vault.rb +29 -0
  101. data/lib/advanced_billing/models/payment_profile_attributes.rb +5 -5
  102. data/lib/advanced_billing/models/payment_profile_response.rb +3 -3
  103. data/lib/advanced_billing/models/payment_type.rb +4 -1
  104. data/lib/advanced_billing/models/paypal_payment_profile.rb +242 -0
  105. data/lib/advanced_billing/models/prepaid_usage_component.rb +5 -4
  106. data/lib/advanced_billing/models/product.rb +2 -2
  107. data/lib/advanced_billing/models/product_price_point.rb +2 -2
  108. data/lib/advanced_billing/models/proforma_invoice.rb +6 -6
  109. data/lib/advanced_billing/models/quantity_based_component.rb +4 -3
  110. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -4
  111. data/lib/advanced_billing/models/resent_invitation.rb +36 -0
  112. data/lib/advanced_billing/models/subscription.rb +13 -10
  113. data/lib/advanced_billing/models/subscription_component.rb +1 -0
  114. data/lib/advanced_billing/models/subscription_component_subscription.rb +26 -20
  115. data/lib/advanced_billing/models/subscription_custom_price.rb +5 -2
  116. data/lib/advanced_billing/models/subscription_group_bank_account.rb +2 -0
  117. data/lib/advanced_billing/models/subscription_group_credit_card.rb +1 -1
  118. data/lib/advanced_billing/models/subscription_group_signup_response.rb +39 -30
  119. data/lib/advanced_billing/models/subscription_state.rb +30 -30
  120. data/lib/advanced_billing/models/tax_configuration.rb +1 -2
  121. data/lib/advanced_billing/models/update_component_price_point.rb +3 -1
  122. data/lib/advanced_billing/models/update_customer.rb +12 -1
  123. data/lib/advanced_billing/models/update_payment_profile.rb +1 -1
  124. data/lib/advanced_billing/utilities/file_wrapper.rb +9 -9
  125. data/lib/advanced_billing/utilities/union_type_lookup.rb +17 -3
  126. data/lib/advanced_billing.rb +10 -4
  127. metadata +16 -10
@@ -27,7 +27,8 @@ module AdvancedBilling
27
27
  # @return [MetafieldInput]
28
28
  attr_accessor :input_type
29
29
 
30
- # Only applicable when input_type is radio or dropdown
30
+ # Only applicable when input_type is radio or dropdown. Empty strings will
31
+ # not be submitted.
31
32
  # @return [Array[String]]
32
33
  attr_accessor :enum
33
34
 
@@ -72,12 +72,12 @@ module AdvancedBilling
72
72
  attr_accessor :expiration_interval
73
73
 
74
74
  # A string representing the expiration interval unit for this product,
75
- # either month or day
76
- # @return [IntervalUnit]
75
+ # either month, day or never
76
+ # @return [ExpirationIntervalUnit]
77
77
  attr_accessor :expiration_interval_unit
78
78
 
79
79
  # A string representing the expiration interval unit for this product,
80
- # either month or day
80
+ # either month, day or never
81
81
  # @return [TrueClass | FalseClass]
82
82
  attr_accessor :auto_create_signup_page
83
83
 
@@ -128,7 +128,10 @@ module AdvancedBilling
128
128
 
129
129
  # An array for nullable fields
130
130
  def self.nullables
131
- []
131
+ %w[
132
+ trial_interval_unit
133
+ expiration_interval_unit
134
+ ]
132
135
  end
133
136
 
134
137
  def initialize(name:, description:, price_in_cents:, interval:,
@@ -94,7 +94,7 @@ module AdvancedBilling
94
94
 
95
95
  # The vault that stores the payment profile with the provided `vault_token`.
96
96
  # Use `bogus` for testing.
97
- # @return [CurrentVault]
97
+ # @return [AllVaults]
98
98
  attr_accessor :current_vault
99
99
 
100
100
  # The “token” provided by your vault storage for an already stored payment
@@ -56,10 +56,9 @@ module AdvancedBilling
56
56
  # @return [Float]
57
57
  attr_accessor :expiration_interval
58
58
 
59
- # (only for prepaid usage components where rollover_prepaid_remainder is
60
- # true) The number of `expiration_interval_unit`s after which rollover
61
- # amounts should expire
62
- # @return [IntervalUnit]
59
+ # A string representing the expiration interval unit for this component,
60
+ # either month or day
61
+ # @return [ExpirationIntervalUnit]
63
62
  attr_accessor :expiration_interval_unit
64
63
 
65
64
  # A mapping from model property names to API property names.
@@ -92,7 +91,9 @@ module AdvancedBilling
92
91
 
93
92
  # An array for nullable fields
94
93
  def self.nullables
95
- []
94
+ %w[
95
+ expiration_interval_unit
96
+ ]
96
97
  end
97
98
 
98
99
  def initialize(name:, pricing_scheme:, prices:, overage_pricing:,
@@ -67,8 +67,8 @@ module AdvancedBilling
67
67
  attr_accessor :expiration_interval
68
68
 
69
69
  # A string representing the expiration interval unit for this product price
70
- # point, either month or day
71
- # @return [IntervalUnit]
70
+ # point, either month, day or never
71
+ # @return [ExpirationIntervalUnit]
72
72
  attr_accessor :expiration_interval_unit
73
73
 
74
74
  # Whether or not to use the site's exchange rate or define your own pricing
@@ -114,7 +114,9 @@ module AdvancedBilling
114
114
 
115
115
  # An array for nullable fields
116
116
  def self.nullables
117
- []
117
+ %w[
118
+ expiration_interval_unit
119
+ ]
118
120
  end
119
121
 
120
122
  def initialize(name:, price_in_cents:, interval:, interval_unit:,
@@ -70,16 +70,17 @@ module AdvancedBilling
70
70
  # (Optional) Set this attribute to a future date/time to sync imported
71
71
  # subscriptions to your existing renewal schedule. See the notes on
72
72
  # “Date/Time Format” in our [subscription import
73
- # documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/540486
74
- # 3655821#date-format). If you provide a next_billing_at timestamp that is
75
- # in the future, no trial or initial charges will be applied when you create
76
- # the subscription. In fact, no payment will be captured at all. The first
77
- # payment will be captured, according to the prices defined by the product,
78
- # near the time specified by next_billing_at. If you do not provide a value
79
- # for next_billing_at, any trial and/or initial charges will be assessed and
80
- # charged at the time of subscription creation. If the card cannot be
81
- # successfully charged, the subscription will not be created. See further
82
- # notes in the section on Importing Subscriptions.
73
+ # documentation](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-
74
+ # Advanced-Billing-Subscription-Imports#date-format). If you provide a
75
+ # next_billing_at timestamp that is in the future, no trial or initial
76
+ # charges will be applied when you create the subscription. In fact, no
77
+ # payment will be captured at all. The first payment will be captured,
78
+ # according to the prices defined by the product, near the time specified by
79
+ # next_billing_at. If you do not provide a value for next_billing_at, any
80
+ # trial and/or initial charges will be assessed and charged at the time of
81
+ # subscription creation. If the card cannot be successfully charged, the
82
+ # subscription will not be created. See further notes in the section on
83
+ # Importing Subscriptions.
83
84
  # @return [DateTime]
84
85
  attr_accessor :next_billing_at
85
86
 
@@ -87,16 +88,17 @@ module AdvancedBilling
87
88
  # subscription in the "Awaiting Signup" state, rather than "Active" or
88
89
  # "Trialing". See the notes on “Date/Time Format” in our [subscription
89
90
  # import
90
- # documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/540486
91
- # 3655821#date-format). In the "Awaiting Signup" state, a subscription
92
- # behaves like any other. It can be canceled, allocated to, had its billing
93
- # date changed. etc. When the initial_billing_at date hits, the subscription
94
- # will transition to the expected state. If the product has a trial, the
95
- # subscription will enter a trial, otherwise it will go active. Setup fees
96
- # will be respected either before or after the trial, as configured on the
97
- # price point. If the payment is due at the initial_billing_at and it fails
98
- # the subscription will be immediately canceled. See further notes in the
99
- # section on Delayed Signups.
91
+ # documentation](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-
92
+ # Advanced-Billing-Subscription-Imports#date-format). In the "Awaiting
93
+ # Signup" state, a subscription behaves like any other. It can be canceled,
94
+ # allocated to, had its billing date changed. etc. When the
95
+ # initial_billing_at date hits, the subscription will transition to the
96
+ # expected state. If the product has a trial, the subscription will enter a
97
+ # trial, otherwise it will go active. Setup fees will be respected either
98
+ # before or after the trial, as configured on the price point. If the
99
+ # payment is due at the initial_billing_at and it fails the subscription
100
+ # will be immediately canceled. See further notes in the section on Delayed
101
+ # Signups.
100
102
  # @return [DateTime]
101
103
  attr_accessor :initial_billing_at
102
104
 
@@ -146,8 +148,8 @@ module AdvancedBilling
146
148
 
147
149
  # (Optional) An array of component ids and quantities to be added to the
148
150
  # subscription. See
149
- # [Components](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050206
150
- # 25677) for more information.
151
+ # [Components](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Co
152
+ # mponents-Overview) for more information.
151
153
  # @return [Array[CreateSubscriptionComponent]]
152
154
  attr_accessor :components
153
155
 
@@ -174,9 +176,9 @@ module AdvancedBilling
174
176
  attr_accessor :group
175
177
 
176
178
  # A valid referral code. (optional, see
177
- # [Referrals](https://maxio-chargify.zendesk.com/hc/en-us/articles/540542020
178
- # 4045-Referrals-Reference#how-to-obtain-referral-codes) for more details).
179
- # If supplied, must be valid, or else subscription creation will fail.
179
+ # [Referrals](https://maxio.zendesk.com/hc/en-us/articles/24286981223693-Ref
180
+ # errals-Reference#how-to-obtain-referral-codes) for more details). If
181
+ # supplied, must be valid, or else subscription creation will fail.
180
182
  # @return [String]
181
183
  attr_accessor :ref
182
184
 
@@ -48,7 +48,7 @@ module AdvancedBilling
48
48
 
49
49
  # The vault that stores the payment profile with the provided `vault_token`.
50
50
  # Use `bogus` for testing.
51
- # @return [CurrentVault]
51
+ # @return [CreditCardVault]
52
52
  attr_accessor :current_vault
53
53
 
54
54
  # The “token” provided by your vault storage for an already stored payment
@@ -143,6 +143,7 @@ module AdvancedBilling
143
143
  id
144
144
  first_name
145
145
  last_name
146
+ masked_card_number
146
147
  card_type
147
148
  expiration_month
148
149
  expiration_year
@@ -156,7 +157,6 @@ module AdvancedBilling
156
157
  billing_country
157
158
  customer_vault_token
158
159
  billing_address_2
159
- payment_type
160
160
  disabled
161
161
  chargify_token
162
162
  site_gateway_setting_id
@@ -180,20 +180,21 @@ module AdvancedBilling
180
180
  ]
181
181
  end
182
182
 
183
- def initialize(masked_card_number:, id: SKIP, first_name: SKIP,
184
- last_name: SKIP, card_type: SKIP, expiration_month: SKIP,
183
+ def initialize(payment_type: PaymentType::CREDIT_CARD, id: SKIP,
184
+ first_name: SKIP, last_name: SKIP, masked_card_number: SKIP,
185
+ card_type: SKIP, expiration_month: SKIP,
185
186
  expiration_year: SKIP, customer_id: SKIP,
186
187
  current_vault: SKIP, vault_token: SKIP,
187
188
  billing_address: SKIP, billing_city: SKIP,
188
189
  billing_state: SKIP, billing_zip: SKIP,
189
190
  billing_country: SKIP, customer_vault_token: SKIP,
190
- billing_address_2: SKIP, payment_type: SKIP, disabled: SKIP,
191
+ billing_address_2: SKIP, disabled: SKIP,
191
192
  chargify_token: SKIP, site_gateway_setting_id: SKIP,
192
193
  gateway_handle: SKIP, additional_properties: {})
193
194
  @id = id unless id == SKIP
194
195
  @first_name = first_name unless first_name == SKIP
195
196
  @last_name = last_name unless last_name == SKIP
196
- @masked_card_number = masked_card_number
197
+ @masked_card_number = masked_card_number unless masked_card_number == SKIP
197
198
  @card_type = card_type unless card_type == SKIP
198
199
  @expiration_month = expiration_month unless expiration_month == SKIP
199
200
  @expiration_year = expiration_year unless expiration_year == SKIP
@@ -207,7 +208,7 @@ module AdvancedBilling
207
208
  @billing_country = billing_country unless billing_country == SKIP
208
209
  @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
209
210
  @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP
210
- @payment_type = payment_type unless payment_type == SKIP
211
+ @payment_type = payment_type
211
212
  @disabled = disabled unless disabled == SKIP
212
213
  @chargify_token = chargify_token unless chargify_token == SKIP
213
214
  @site_gateway_setting_id = site_gateway_setting_id unless site_gateway_setting_id == SKIP
@@ -224,11 +225,12 @@ module AdvancedBilling
224
225
  return nil unless hash
225
226
 
226
227
  # Extract variables from the hash.
227
- masked_card_number =
228
- hash.key?('masked_card_number') ? hash['masked_card_number'] : nil
228
+ payment_type = hash['payment_type'] ||= PaymentType::CREDIT_CARD
229
229
  id = hash.key?('id') ? hash['id'] : SKIP
230
230
  first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
231
231
  last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
232
+ masked_card_number =
233
+ hash.key?('masked_card_number') ? hash['masked_card_number'] : SKIP
232
234
  card_type = hash.key?('card_type') ? hash['card_type'] : SKIP
233
235
  expiration_month =
234
236
  hash.key?('expiration_month') ? hash['expiration_month'] : SKIP
@@ -248,7 +250,6 @@ module AdvancedBilling
248
250
  hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP
249
251
  billing_address_2 =
250
252
  hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP
251
- payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
252
253
  disabled = hash.key?('disabled') ? hash['disabled'] : SKIP
253
254
  chargify_token =
254
255
  hash.key?('chargify_token') ? hash['chargify_token'] : SKIP
@@ -261,10 +262,11 @@ module AdvancedBilling
261
262
  names.each_value { |k| hash.delete(k) }
262
263
 
263
264
  # Create object from extracted values.
264
- CreditCardPaymentProfile.new(masked_card_number: masked_card_number,
265
+ CreditCardPaymentProfile.new(payment_type: payment_type,
265
266
  id: id,
266
267
  first_name: first_name,
267
268
  last_name: last_name,
269
+ masked_card_number: masked_card_number,
268
270
  card_type: card_type,
269
271
  expiration_month: expiration_month,
270
272
  expiration_year: expiration_year,
@@ -278,7 +280,6 @@ module AdvancedBilling
278
280
  billing_country: billing_country,
279
281
  customer_vault_token: customer_vault_token,
280
282
  billing_address_2: billing_address_2,
281
- payment_type: payment_type,
282
283
  disabled: disabled,
283
284
  chargify_token: chargify_token,
284
285
  site_gateway_setting_id: site_gateway_setting_id,
@@ -290,14 +291,14 @@ module AdvancedBilling
290
291
  # @param [CreditCardPaymentProfile | Hash] The value against the validation is performed.
291
292
  def self.validate(value)
292
293
  if value.instance_of? self
293
- return APIHelper.valid_type?(value.masked_card_number,
294
- ->(val) { val.instance_of? String })
294
+ return APIHelper.valid_type?(value.payment_type,
295
+ ->(val) { PaymentType.validate(val) })
295
296
  end
296
297
 
297
298
  return false unless value.instance_of? Hash
298
299
 
299
- APIHelper.valid_type?(value['masked_card_number'],
300
- ->(val) { val.instance_of? String })
300
+ APIHelper.valid_type?(value['payment_type'],
301
+ ->(val) { PaymentType.validate(val) })
301
302
  end
302
303
  end
303
304
  end
@@ -0,0 +1,117 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # The vault that stores the payment profile with the provided `vault_token`.
8
+ # Use `bogus` for testing.
9
+ class CreditCardVault
10
+ CREDIT_CARD_VAULT = [
11
+ # TODO: Write general description for ADYEN
12
+ ADYEN = 'adyen'.freeze,
13
+
14
+ # TODO: Write general description for AUTHORIZENET
15
+ AUTHORIZENET = 'authorizenet'.freeze,
16
+
17
+ # TODO: Write general description for BEANSTREAM
18
+ BEANSTREAM = 'beanstream'.freeze,
19
+
20
+ # TODO: Write general description for BLUE_SNAP
21
+ BLUE_SNAP = 'blue_snap'.freeze,
22
+
23
+ # TODO: Write general description for BOGUS
24
+ BOGUS = 'bogus'.freeze,
25
+
26
+ # TODO: Write general description for BRAINTREE1
27
+ BRAINTREE1 = 'braintree1'.freeze,
28
+
29
+ # TODO: Write general description for BRAINTREE_BLUE
30
+ BRAINTREE_BLUE = 'braintree_blue'.freeze,
31
+
32
+ # TODO: Write general description for CHECKOUT
33
+ CHECKOUT = 'checkout'.freeze,
34
+
35
+ # TODO: Write general description for CYBERSOURCE
36
+ CYBERSOURCE = 'cybersource'.freeze,
37
+
38
+ # TODO: Write general description for ELAVON
39
+ ELAVON = 'elavon'.freeze,
40
+
41
+ # TODO: Write general description for EWAY
42
+ EWAY = 'eway'.freeze,
43
+
44
+ # TODO: Write general description for EWAY_RAPID
45
+ EWAY_RAPID = 'eway_rapid'.freeze,
46
+
47
+ # TODO: Write general description for EWAY_RAPID_STD
48
+ EWAY_RAPID_STD = 'eway_rapid_std'.freeze,
49
+
50
+ # TODO: Write general description for FIRSTDATA
51
+ FIRSTDATA = 'firstdata'.freeze,
52
+
53
+ # TODO: Write general description for FORTE
54
+ FORTE = 'forte'.freeze,
55
+
56
+ # TODO: Write general description for LITLE
57
+ LITLE = 'litle'.freeze,
58
+
59
+ # TODO: Write general description for MAXIO_PAYMENTS
60
+ MAXIO_PAYMENTS = 'maxio_payments'.freeze,
61
+
62
+ # TODO: Write general description for MAXP
63
+ MAXP = 'maxp'.freeze,
64
+
65
+ # TODO: Write general description for MODUSLINK
66
+ MODUSLINK = 'moduslink'.freeze,
67
+
68
+ # TODO: Write general description for MONERIS
69
+ MONERIS = 'moneris'.freeze,
70
+
71
+ # TODO: Write general description for NMI
72
+ NMI = 'nmi'.freeze,
73
+
74
+ # TODO: Write general description for ORBITAL
75
+ ORBITAL = 'orbital'.freeze,
76
+
77
+ # TODO: Write general description for PAYMENT_EXPRESS
78
+ PAYMENT_EXPRESS = 'payment_express'.freeze,
79
+
80
+ # TODO: Write general description for PAYMILL
81
+ PAYMILL = 'paymill'.freeze,
82
+
83
+ # TODO: Write general description for PAYPAL
84
+ PAYPAL = 'paypal'.freeze,
85
+
86
+ # TODO: Write general description for PAYPAL_COMPLETE
87
+ PAYPAL_COMPLETE = 'paypal_complete'.freeze,
88
+
89
+ # TODO: Write general description for PIN
90
+ PIN = 'pin'.freeze,
91
+
92
+ # TODO: Write general description for SQUARE
93
+ SQUARE = 'square'.freeze,
94
+
95
+ # TODO: Write general description for STRIPE
96
+ STRIPE = 'stripe'.freeze,
97
+
98
+ # TODO: Write general description for STRIPE_CONNECT
99
+ STRIPE_CONNECT = 'stripe_connect'.freeze,
100
+
101
+ # TODO: Write general description for TRUST_COMMERCE
102
+ TRUST_COMMERCE = 'trust_commerce'.freeze,
103
+
104
+ # TODO: Write general description for UNIPAAS
105
+ UNIPAAS = 'unipaas'.freeze,
106
+
107
+ # TODO: Write general description for WIRECARD
108
+ WIRECARD = 'wirecard'.freeze
109
+ ].freeze
110
+
111
+ def self.validate(value)
112
+ return false if value.nil?
113
+
114
+ CREDIT_CARD_VAULT.include?(value)
115
+ end
116
+ end
117
+ end
@@ -147,8 +147,8 @@ module AdvancedBilling
147
147
 
148
148
  # An array of origin invoices for the credit note. Learn more about [Origin
149
149
  # Invoice from our
150
- # docs](https://chargify.zendesk.com/hc/en-us/articles/4407753036699#origin-
151
- # invoices)
150
+ # docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-No
151
+ # tes-Proration#origin-invoices)
152
152
  # @return [Array[OriginInvoice]]
153
153
  attr_accessor :origin_invoices
154
154
 
@@ -129,6 +129,10 @@ module AdvancedBilling
129
129
  # @return [String]
130
130
  attr_accessor :default_subscription_group_uid
131
131
 
132
+ # The Salesforce ID for the customer
133
+ # @return [String]
134
+ attr_accessor :salesforce_id
135
+
132
136
  # A mapping from model property names to API property names.
133
137
  def self.names
134
138
  @_hash = {} if @_hash.nil?
@@ -161,6 +165,7 @@ module AdvancedBilling
161
165
  @_hash['locale'] = 'locale'
162
166
  @_hash['default_subscription_group_uid'] =
163
167
  'default_subscription_group_uid'
168
+ @_hash['salesforce_id'] = 'salesforce_id'
164
169
  @_hash
165
170
  end
166
171
 
@@ -194,6 +199,7 @@ module AdvancedBilling
194
199
  parent_id
195
200
  locale
196
201
  default_subscription_group_uid
202
+ salesforce_id
197
203
  ]
198
204
  end
199
205
 
@@ -220,6 +226,7 @@ module AdvancedBilling
220
226
  parent_id
221
227
  locale
222
228
  default_subscription_group_uid
229
+ salesforce_id
223
230
  ]
224
231
  end
225
232
 
@@ -232,7 +239,7 @@ module AdvancedBilling
232
239
  portal_invite_last_sent_at: SKIP,
233
240
  portal_invite_last_accepted_at: SKIP, tax_exempt: SKIP,
234
241
  vat_number: SKIP, parent_id: SKIP, locale: SKIP,
235
- default_subscription_group_uid: SKIP,
242
+ default_subscription_group_uid: SKIP, salesforce_id: SKIP,
236
243
  additional_properties: {})
237
244
  @first_name = first_name unless first_name == SKIP
238
245
  @last_name = last_name unless last_name == SKIP
@@ -273,6 +280,7 @@ module AdvancedBilling
273
280
  @default_subscription_group_uid =
274
281
  default_subscription_group_uid
275
282
  end
283
+ @salesforce_id = salesforce_id unless salesforce_id == SKIP
276
284
 
277
285
  # Add additional model properties to the instance.
278
286
  additional_properties.each do |_name, _value|
@@ -333,6 +341,7 @@ module AdvancedBilling
333
341
  locale = hash.key?('locale') ? hash['locale'] : SKIP
334
342
  default_subscription_group_uid =
335
343
  hash.key?('default_subscription_group_uid') ? hash['default_subscription_group_uid'] : SKIP
344
+ salesforce_id = hash.key?('salesforce_id') ? hash['salesforce_id'] : SKIP
336
345
 
337
346
  # Clean out expected properties from Hash.
338
347
  names.each_value { |k| hash.delete(k) }
@@ -365,6 +374,7 @@ module AdvancedBilling
365
374
  parent_id: parent_id,
366
375
  locale: locale,
367
376
  default_subscription_group_uid: default_subscription_group_uid,
377
+ salesforce_id: salesforce_id,
368
378
  additional_properties: hash)
369
379
  end
370
380
 
@@ -101,6 +101,10 @@ module AdvancedBilling
101
101
  # @return [Integer]
102
102
  attr_accessor :parent_id
103
103
 
104
+ # (Optional) The Salesforce ID of the customer.
105
+ # @return [String]
106
+ attr_accessor :salesforce_id
107
+
104
108
  # A mapping from model property names to API property names.
105
109
  def self.names
106
110
  @_hash = {} if @_hash.nil?
@@ -122,6 +126,7 @@ module AdvancedBilling
122
126
  @_hash['vat_number'] = 'vat_number'
123
127
  @_hash['metafields'] = 'metafields'
124
128
  @_hash['parent_id'] = 'parent_id'
129
+ @_hash['salesforce_id'] = 'salesforce_id'
125
130
  @_hash
126
131
  end
127
132
 
@@ -146,6 +151,7 @@ module AdvancedBilling
146
151
  vat_number
147
152
  metafields
148
153
  parent_id
154
+ salesforce_id
149
155
  ]
150
156
  end
151
157
 
@@ -154,6 +160,7 @@ module AdvancedBilling
154
160
  %w[
155
161
  address_2
156
162
  parent_id
163
+ salesforce_id
157
164
  ]
158
165
  end
159
166
 
@@ -162,7 +169,8 @@ module AdvancedBilling
162
169
  address: SKIP, address_2: SKIP, city: SKIP, state: SKIP,
163
170
  zip: SKIP, country: SKIP, phone: SKIP, verified: SKIP,
164
171
  tax_exempt: SKIP, vat_number: SKIP, metafields: SKIP,
165
- parent_id: SKIP, additional_properties: {})
172
+ parent_id: SKIP, salesforce_id: SKIP,
173
+ additional_properties: {})
166
174
  @first_name = first_name unless first_name == SKIP
167
175
  @last_name = last_name unless last_name == SKIP
168
176
  @email = email unless email == SKIP
@@ -181,6 +189,7 @@ module AdvancedBilling
181
189
  @vat_number = vat_number unless vat_number == SKIP
182
190
  @metafields = metafields unless metafields == SKIP
183
191
  @parent_id = parent_id unless parent_id == SKIP
192
+ @salesforce_id = salesforce_id unless salesforce_id == SKIP
184
193
 
185
194
  # Add additional model properties to the instance.
186
195
  additional_properties.each do |_name, _value|
@@ -211,6 +220,7 @@ module AdvancedBilling
211
220
  vat_number = hash.key?('vat_number') ? hash['vat_number'] : SKIP
212
221
  metafields = hash.key?('metafields') ? hash['metafields'] : SKIP
213
222
  parent_id = hash.key?('parent_id') ? hash['parent_id'] : SKIP
223
+ salesforce_id = hash.key?('salesforce_id') ? hash['salesforce_id'] : SKIP
214
224
 
215
225
  # Clean out expected properties from Hash.
216
226
  names.each_value { |k| hash.delete(k) }
@@ -234,6 +244,7 @@ module AdvancedBilling
234
244
  vat_number: vat_number,
235
245
  metafields: metafields,
236
246
  parent_id: parent_id,
247
+ salesforce_id: salesforce_id,
237
248
  additional_properties: hash)
238
249
  end
239
250
 
@@ -157,6 +157,7 @@ module AdvancedBilling
157
157
  %w[
158
158
  upgrade_charge
159
159
  downgrade_credit
160
+ interval_unit
160
161
  ]
161
162
  end
162
163
 
@@ -4,9 +4,9 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module AdvancedBilling
7
- # Extended Interval Unit.
8
- class ExtendedIntervalUnit
9
- EXTENDED_INTERVAL_UNIT = [
7
+ # Expiration Interval Unit.
8
+ class ExpirationIntervalUnit
9
+ EXPIRATION_INTERVAL_UNIT = [
10
10
  # TODO: Write general description for DAY
11
11
  DAY = 'day'.freeze,
12
12
 
@@ -20,7 +20,7 @@ module AdvancedBilling
20
20
  def self.validate(value)
21
21
  return false if value.nil?
22
22
 
23
- EXTENDED_INTERVAL_UNIT.include?(value)
23
+ EXPIRATION_INTERVAL_UNIT.include?(value)
24
24
  end
25
25
  end
26
26
  end