flowcommerce 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  # Generated by apidoc - http://www.apidoc.me
2
2
  # Service version: 0.2.87
3
- # apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.89/ruby_client
3
+ # apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.92/ruby_client
4
4
 
5
5
  require 'cgi'
6
6
  require 'net/http'
@@ -25,7 +25,7 @@ module Io
25
25
 
26
26
  BASE_URL = 'https://api.flow.io' unless defined?(Constants::BASE_URL)
27
27
  NAMESPACE = 'io.flow.v0' unless defined?(Constants::NAMESPACE)
28
- USER_AGENT = 'apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.89/ruby_client' unless defined?(Constants::USER_AGENT)
28
+ USER_AGENT = 'apidoc:0.11.76 http://www.apidoc.me/flow/api/0.2.92/ruby_client' unless defined?(Constants::USER_AGENT)
29
29
  VERSION = '0.2.87' unless defined?(Constants::VERSION)
30
30
  VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
31
31
 
@@ -180,6 +180,10 @@ module Io
180
180
  @cards ||= ::Io::Flow::V0::Clients::Cards.new(self)
181
181
  end
182
182
 
183
+ def payments
184
+ @payments ||= ::Io::Flow::V0::Clients::Payments.new(self)
185
+ end
186
+
183
187
  def public_keys
184
188
  @public_keys ||= ::Io::Flow::V0::Clients::PublicKeys.new(self)
185
189
  end
@@ -664,6 +668,14 @@ module Io
664
668
  ::Io::Flow::V0::Models::Pricing.new(r)
665
669
  end
666
670
 
671
+ # Get available promotions for the experience
672
+ def get_promotions_and_available_by_key(organization, key)
673
+ HttpClient::Preconditions.assert_class('organization', organization, String)
674
+ HttpClient::Preconditions.assert_class('key', key, String)
675
+ r = @client.request("/#{CGI.escape(organization)}/experiences/#{CGI.escape(key)}/promotions/available").get
676
+ r.map { |x| ::Io::Flow::V0::Models::AvailablePromotion.from_json(x) }
677
+ end
678
+
667
679
  # Formats the requested amount using the formatting settings for the
668
680
  # experience.
669
681
  def get_conversions_by_base_and_amount(organization, base, amount, incoming={})
@@ -860,7 +872,8 @@ module Io
860
872
  :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
861
873
  :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
862
874
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
863
- :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
875
+ :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)),
876
+ :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
864
877
  }.delete_if { |k, v| v.nil? }
865
878
  HttpClient::Preconditions.assert_class('order_form', order_form, ::Io::Flow::V0::Models::OrderForm)
866
879
  r = @client.request("/#{CGI.escape(organization)}/orders").with_query(query).with_json(order_form.to_json).post
@@ -891,7 +904,8 @@ module Io
891
904
  :country => (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String)),
892
905
  :ip => (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String)),
893
906
  :currency => (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String)),
894
- :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
907
+ :language => (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String)),
908
+ :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
895
909
  }.delete_if { |k, v| v.nil? }
896
910
  HttpClient::Preconditions.assert_class('order_put_form', order_put_form, ::Io::Flow::V0::Models::OrderPutForm)
897
911
  r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}").with_query(query).with_json(order_put_form.to_json).put
@@ -920,10 +934,14 @@ module Io
920
934
  end
921
935
 
922
936
  # Returns information about a specific order using an identifier number
923
- def get_identifier_by_identifier_number(organization, identifier_number)
937
+ def get_identifier_by_identifier_number(organization, identifier_number, incoming={})
924
938
  HttpClient::Preconditions.assert_class('organization', organization, String)
925
939
  HttpClient::Preconditions.assert_class('identifier_number', identifier_number, String)
926
- r = @client.request("/#{CGI.escape(organization)}/orders/identifier/#{CGI.escape(identifier_number)}").get
940
+ opts = HttpClient::Helper.symbolize_keys(incoming)
941
+ query = {
942
+ :expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
943
+ }.delete_if { |k, v| v.nil? }
944
+ r = @client.request("/#{CGI.escape(organization)}/orders/identifier/#{CGI.escape(identifier_number)}").with_query(query).get
927
945
  ::Io::Flow::V0::Models::Order.new(r)
928
946
  end
929
947
 
@@ -2253,6 +2271,68 @@ module Io
2253
2271
 
2254
2272
  end
2255
2273
 
2274
+ class Payments
2275
+
2276
+ def initialize(client)
2277
+ @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
2278
+ end
2279
+
2280
+ def get(organization, incoming={})
2281
+ HttpClient::Preconditions.assert_class('organization', organization, String)
2282
+ opts = HttpClient::Helper.symbolize_keys(incoming)
2283
+ query = {
2284
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
2285
+ :payment_method => (x = opts.delete(:payment_method); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment_method', x, String)),
2286
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
2287
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
2288
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
2289
+ }.delete_if { |k, v| v.nil? }
2290
+ r = @client.request("/#{CGI.escape(organization)}/payments").with_query(query).get
2291
+ r.map { |x| ::Io::Flow::V0::Models::Payment.from_json(x) }
2292
+ end
2293
+
2294
+ # Create a new payment. Note that when using JSONP to submit a payment, you do
2295
+ # not need to authenticate.
2296
+ def post(organization, payment_form)
2297
+ HttpClient::Preconditions.assert_class('organization', organization, String)
2298
+ HttpClient::Preconditions.assert_class('payment_form', payment_form, ::Io::Flow::V0::Models::PaymentForm)
2299
+ r = @client.request("/#{CGI.escape(organization)}/payments").with_json(payment_form.to_json).post
2300
+ ::Io::Flow::V0::Models::Payment.from_json(r)
2301
+ end
2302
+
2303
+ # Returns information about a specific payment.
2304
+ def get_by_id(organization, id)
2305
+ HttpClient::Preconditions.assert_class('organization', organization, String)
2306
+ HttpClient::Preconditions.assert_class('id', id, String)
2307
+ r = @client.request("/#{CGI.escape(organization)}/payments/#{CGI.escape(id)}").get
2308
+ ::Io::Flow::V0::Models::Payment.from_json(r)
2309
+ end
2310
+
2311
+ # Deletes the specified payment
2312
+ def delete_by_id(organization, id)
2313
+ HttpClient::Preconditions.assert_class('organization', organization, String)
2314
+ HttpClient::Preconditions.assert_class('id', id, String)
2315
+ r = @client.request("/#{CGI.escape(organization)}/payments/#{CGI.escape(id)}").delete
2316
+ nil
2317
+ end
2318
+
2319
+ # Provides visibility into recent changes of each object, including deletion
2320
+ def get_versions(organization, incoming={})
2321
+ HttpClient::Preconditions.assert_class('organization', organization, String)
2322
+ opts = HttpClient::Helper.symbolize_keys(incoming)
2323
+ query = {
2324
+ :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
2325
+ :payment_id => (x = opts.delete(:payment_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment_id', x, Array).map { |v| HttpClient::Preconditions.assert_class('payment_id', v, String) }),
2326
+ :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
2327
+ :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
2328
+ :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "journal_timestamp" : x), String)
2329
+ }.delete_if { |k, v| v.nil? }
2330
+ r = @client.request("/#{CGI.escape(organization)}/payments/versions").with_query(query).get
2331
+ r.map { |x| ::Io::Flow::V0::Models::PaymentVersion.new(x) }
2332
+ end
2333
+
2334
+ end
2335
+
2256
2336
  class PublicKeys
2257
2337
 
2258
2338
  def initialize(client)
@@ -4268,10 +4348,8 @@ module Io
4268
4348
  DIRECT_AUTHORIZATION_FORM = 'direct_authorization_form' unless defined?(DIRECT_AUTHORIZATION_FORM)
4269
4349
  # Enables card payments with Flow as Merchant of Record
4270
4350
  MERCHANT_OF_RECORD_AUTHORIZATION_FORM = 'merchant_of_record_authorization_form' unless defined?(MERCHANT_OF_RECORD_AUTHORIZATION_FORM)
4271
- # Enables online alternative payment methods
4272
- DIRECT_ONLINE_PAYMENT_FORM = 'direct_online_payment_form' unless defined?(DIRECT_ONLINE_PAYMENT_FORM)
4273
- # Enables online alternative payment methods with Flow as Merchant of Record
4274
- MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM = 'merchant_of_record_online_payment_form' unless defined?(MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM)
4351
+ # Enables authorization via paypal
4352
+ PAYPAL_AUTHORIZATION_FORM = 'paypal_authorization_form' unless defined?(PAYPAL_AUTHORIZATION_FORM)
4275
4353
  end
4276
4354
 
4277
4355
  attr_reader :discriminator
@@ -4283,7 +4361,7 @@ module Io
4283
4361
  end
4284
4362
 
4285
4363
  def subtype_to_hash
4286
- raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: direct_authorization_form, merchant_of_record_authorization_form, direct_online_payment_form, merchant_of_record_online_payment_form'
4364
+ raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: direct_authorization_form, merchant_of_record_authorization_form, paypal_authorization_form'
4287
4365
  end
4288
4366
 
4289
4367
  def to_hash
@@ -4299,8 +4377,7 @@ module Io
4299
4377
  case discriminator
4300
4378
  when Types::DIRECT_AUTHORIZATION_FORM; DirectAuthorizationForm.new(hash)
4301
4379
  when Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM; MerchantOfRecordAuthorizationForm.new(hash)
4302
- when Types::DIRECT_ONLINE_PAYMENT_FORM; DirectOnlinePaymentForm.new(hash)
4303
- when Types::MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM; MerchantOfRecordOnlinePaymentForm.new(hash)
4380
+ when Types::PAYPAL_AUTHORIZATION_FORM; PaypalAuthorizationForm.new(hash)
4304
4381
  else AuthorizationFormUndefinedType.new(:discriminator => discriminator)
4305
4382
  end
4306
4383
  end
@@ -4533,6 +4610,8 @@ module Io
4533
4610
  SUBCATALOG_ITEM_DELETED = 'subcatalog_item_deleted' unless defined?(SUBCATALOG_ITEM_DELETED)
4534
4611
  RATE_DELETED = 'rate_deleted' unless defined?(RATE_DELETED)
4535
4612
  RATE_UPSERTED = 'rate_upserted' unless defined?(RATE_UPSERTED)
4613
+ AVAILABLE_PROMOTIONS_UPSERTED = 'available_promotions_upserted' unless defined?(AVAILABLE_PROMOTIONS_UPSERTED)
4614
+ AVAILABLE_PROMOTIONS_DELETED = 'available_promotions_deleted' unless defined?(AVAILABLE_PROMOTIONS_DELETED)
4536
4615
  EXPERIENCE_DELETED = 'experience_deleted' unless defined?(EXPERIENCE_DELETED)
4537
4616
  EXPERIENCE_UPSERTED = 'experience_upserted' unless defined?(EXPERIENCE_UPSERTED)
4538
4617
  ITEM_MARGIN_DELETED = 'item_margin_deleted' unless defined?(ITEM_MARGIN_DELETED)
@@ -4591,7 +4670,7 @@ module Io
4591
4670
  end
4592
4671
 
4593
4672
  def subtype_to_hash
4594
- raise 'Cannot serialize an instance of event directly - must use one of the specific types: attribute_upserted, attribute_deleted, catalog_upserted, catalog_deleted, subcatalog_upserted, subcatalog_deleted, catalog_item_upserted, catalog_item_deleted, subcatalog_item_upserted, subcatalog_item_deleted, rate_deleted, rate_upserted, experience_deleted, experience_upserted, item_margin_deleted, item_margin_upserted, item_sales_margin_deleted, item_sales_margin_upserted, label_format_deleted, label_format_upserted, order_deleted, order_upserted, order_identifier_deleted, order_identifier_upserted, pricing_deleted, pricing_upserted, tier_upserted, tier_deleted, hs6_code_upserted, hs6_code_deleted, hs10_code_upserted, hs10_code_deleted, item_origin_upserted, item_origin_deleted, harmonized_item_upserted, harmonized_item_deleted, snapshot_upserted, snapshot_deleted, label_upserted, notification_upserted, notification_deleted, localized_item_upserted, localized_item_deleted, localized_item_snapshot, membership_upserted, membership_deleted, organization_upserted, organization_deleted, authorization_upserted, authorization_deleted, capture_upserted, card_upserted, card_deleted, refund_upserted, return_upserted, return_deleted, targeting_item_upserted, targeting_item_deleted, tracking_label_event_upserted'
4673
+ raise 'Cannot serialize an instance of event directly - must use one of the specific types: attribute_upserted, attribute_deleted, catalog_upserted, catalog_deleted, subcatalog_upserted, subcatalog_deleted, catalog_item_upserted, catalog_item_deleted, subcatalog_item_upserted, subcatalog_item_deleted, rate_deleted, rate_upserted, available_promotions_upserted, available_promotions_deleted, experience_deleted, experience_upserted, item_margin_deleted, item_margin_upserted, item_sales_margin_deleted, item_sales_margin_upserted, label_format_deleted, label_format_upserted, order_deleted, order_upserted, order_identifier_deleted, order_identifier_upserted, pricing_deleted, pricing_upserted, tier_upserted, tier_deleted, hs6_code_upserted, hs6_code_deleted, hs10_code_upserted, hs10_code_deleted, item_origin_upserted, item_origin_deleted, harmonized_item_upserted, harmonized_item_deleted, snapshot_upserted, snapshot_deleted, label_upserted, notification_upserted, notification_deleted, localized_item_upserted, localized_item_deleted, localized_item_snapshot, membership_upserted, membership_deleted, organization_upserted, organization_deleted, authorization_upserted, authorization_deleted, capture_upserted, card_upserted, card_deleted, refund_upserted, return_upserted, return_deleted, targeting_item_upserted, targeting_item_deleted, tracking_label_event_upserted'
4595
4674
  end
4596
4675
 
4597
4676
  def to_hash
@@ -4617,6 +4696,8 @@ module Io
4617
4696
  when Types::SUBCATALOG_ITEM_DELETED; SubcatalogItemDeleted.new(hash)
4618
4697
  when Types::RATE_DELETED; RateDeleted.new(hash)
4619
4698
  when Types::RATE_UPSERTED; RateUpserted.new(hash)
4699
+ when Types::AVAILABLE_PROMOTIONS_UPSERTED; AvailablePromotionsUpserted.new(hash)
4700
+ when Types::AVAILABLE_PROMOTIONS_DELETED; AvailablePromotionsDeleted.new(hash)
4620
4701
  when Types::EXPERIENCE_DELETED; ExperienceDeleted.new(hash)
4621
4702
  when Types::EXPERIENCE_UPSERTED; ExperienceUpserted.new(hash)
4622
4703
  when Types::ITEM_MARGIN_DELETED; ItemMarginDeleted.new(hash)
@@ -5351,6 +5432,128 @@ module Io
5351
5432
 
5352
5433
  end
5353
5434
 
5435
+ # Represents data for a specific online payment method
5436
+ class Payment
5437
+
5438
+ module Types
5439
+ PAYMENT_PAYPAL = 'payment_paypal' unless defined?(PAYMENT_PAYPAL)
5440
+ end
5441
+
5442
+ attr_reader :discriminator
5443
+
5444
+ def initialize(incoming={})
5445
+ opts = HttpClient::Helper.symbolize_keys(incoming)
5446
+ HttpClient::Preconditions.require_keys(opts, [:discriminator], 'Payment')
5447
+ @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
5448
+ end
5449
+
5450
+ def subtype_to_hash
5451
+ raise 'Cannot serialize an instance of payment directly - must use one of the specific types: payment_paypal'
5452
+ end
5453
+
5454
+ def to_hash
5455
+ subtype_to_hash.merge(:discriminator => @discriminator)
5456
+ end
5457
+
5458
+ def Payment.from_json(hash)
5459
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
5460
+ discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
5461
+ if discriminator.empty?
5462
+ raise "Union type[payment] requires a field named 'discriminator'"
5463
+ end
5464
+ case discriminator
5465
+ when Types::PAYMENT_PAYPAL; PaymentPaypal.new(hash)
5466
+ else PaymentUndefinedType.new(:discriminator => discriminator)
5467
+ end
5468
+ end
5469
+
5470
+ end
5471
+
5472
+ class PaymentUndefinedType < Payment
5473
+
5474
+ attr_reader :name
5475
+
5476
+ def initialize(incoming={})
5477
+ super(:discriminator => 'undefined_type')
5478
+ opts = HttpClient::Helper.symbolize_keys(incoming)
5479
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
5480
+ end
5481
+
5482
+ def subtype_to_hash
5483
+ raise 'Unable to serialize undefined type to json'
5484
+ end
5485
+
5486
+ def copy(incoming={})
5487
+ raise 'Operation not supported for undefined type'
5488
+ end
5489
+
5490
+ def to_hash
5491
+ raise 'Operation not supported for undefined type'
5492
+ end
5493
+
5494
+ end
5495
+
5496
+ # Represents the data needed to initiate an online payment
5497
+ class PaymentForm
5498
+
5499
+ module Types
5500
+ MERCHANT_OF_RECORD_PAYMENT_FORM = 'merchant_of_record_payment_form' unless defined?(MERCHANT_OF_RECORD_PAYMENT_FORM)
5501
+ end
5502
+
5503
+ attr_reader :discriminator
5504
+
5505
+ def initialize(incoming={})
5506
+ opts = HttpClient::Helper.symbolize_keys(incoming)
5507
+ HttpClient::Preconditions.require_keys(opts, [:discriminator], 'PaymentForm')
5508
+ @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
5509
+ end
5510
+
5511
+ def subtype_to_hash
5512
+ raise 'Cannot serialize an instance of payment_form directly - must use one of the specific types: merchant_of_record_payment_form'
5513
+ end
5514
+
5515
+ def to_hash
5516
+ subtype_to_hash.merge(:discriminator => @discriminator)
5517
+ end
5518
+
5519
+ def PaymentForm.from_json(hash)
5520
+ HttpClient::Preconditions.assert_class('hash', hash, Hash)
5521
+ discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
5522
+ if discriminator.empty?
5523
+ raise "Union type[payment_form] requires a field named 'discriminator'"
5524
+ end
5525
+ case discriminator
5526
+ when Types::MERCHANT_OF_RECORD_PAYMENT_FORM; MerchantOfRecordPaymentForm.new(hash)
5527
+ else PaymentFormUndefinedType.new(:discriminator => discriminator)
5528
+ end
5529
+ end
5530
+
5531
+ end
5532
+
5533
+ class PaymentFormUndefinedType < PaymentForm
5534
+
5535
+ attr_reader :name
5536
+
5537
+ def initialize(incoming={})
5538
+ super(:discriminator => 'undefined_type')
5539
+ opts = HttpClient::Helper.symbolize_keys(incoming)
5540
+ @name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
5541
+ end
5542
+
5543
+ def subtype_to_hash
5544
+ raise 'Unable to serialize undefined type to json'
5545
+ end
5546
+
5547
+ def copy(incoming={})
5548
+ raise 'Operation not supported for undefined type'
5549
+ end
5550
+
5551
+ def to_hash
5552
+ raise 'Operation not supported for undefined type'
5553
+ end
5554
+
5555
+ end
5556
+
5354
5557
  class Session
5355
5558
 
5356
5559
  module Types
@@ -6864,7 +7067,7 @@ module Io
6864
7067
  end
6865
7068
 
6866
7069
  def EventType.ALL
6867
- @@all ||= [EventType.attribute_upserted, EventType.attribute_deleted, EventType.catalog_upserted, EventType.catalog_deleted, EventType.subcatalog_upserted, EventType.subcatalog_deleted, EventType.catalog_item_upserted, EventType.catalog_item_deleted, EventType.subcatalog_item_upserted, EventType.subcatalog_item_deleted, EventType.rate_deleted, EventType.rate_upserted, EventType.experience_deleted, EventType.experience_upserted, EventType.item_margin_deleted, EventType.item_margin_upserted, EventType.item_sales_margin_deleted, EventType.item_sales_margin_upserted, EventType.label_format_deleted, EventType.label_format_upserted, EventType.order_deleted, EventType.order_upserted, EventType.order_identifier_deleted, EventType.order_identifier_upserted, EventType.pricing_deleted, EventType.pricing_upserted, EventType.tier_upserted, EventType.tier_deleted, EventType.hs6_code_upserted, EventType.hs6_code_deleted, EventType.hs10_code_upserted, EventType.hs10_code_deleted, EventType.item_origin_upserted, EventType.item_origin_deleted, EventType.harmonized_item_upserted, EventType.harmonized_item_deleted, EventType.snapshot_upserted, EventType.snapshot_deleted, EventType.label_upserted, EventType.notification_upserted, EventType.notification_deleted, EventType.localized_item_upserted, EventType.localized_item_deleted, EventType.localized_item_snapshot, EventType.membership_upserted, EventType.membership_deleted, EventType.organization_upserted, EventType.organization_deleted, EventType.authorization_upserted, EventType.authorization_deleted, EventType.capture_upserted, EventType.card_upserted, EventType.card_deleted, EventType.refund_upserted, EventType.return_upserted, EventType.return_deleted, EventType.targeting_item_upserted, EventType.targeting_item_deleted, EventType.tracking_label_event_upserted]
7070
+ @@all ||= [EventType.attribute_upserted, EventType.attribute_deleted, EventType.catalog_upserted, EventType.catalog_deleted, EventType.subcatalog_upserted, EventType.subcatalog_deleted, EventType.catalog_item_upserted, EventType.catalog_item_deleted, EventType.subcatalog_item_upserted, EventType.subcatalog_item_deleted, EventType.rate_deleted, EventType.rate_upserted, EventType.available_promotions_upserted, EventType.available_promotions_deleted, EventType.experience_deleted, EventType.experience_upserted, EventType.item_margin_deleted, EventType.item_margin_upserted, EventType.item_sales_margin_deleted, EventType.item_sales_margin_upserted, EventType.label_format_deleted, EventType.label_format_upserted, EventType.order_deleted, EventType.order_upserted, EventType.order_identifier_deleted, EventType.order_identifier_upserted, EventType.pricing_deleted, EventType.pricing_upserted, EventType.tier_upserted, EventType.tier_deleted, EventType.hs6_code_upserted, EventType.hs6_code_deleted, EventType.hs10_code_upserted, EventType.hs10_code_deleted, EventType.item_origin_upserted, EventType.item_origin_deleted, EventType.harmonized_item_upserted, EventType.harmonized_item_deleted, EventType.snapshot_upserted, EventType.snapshot_deleted, EventType.label_upserted, EventType.notification_upserted, EventType.notification_deleted, EventType.localized_item_upserted, EventType.localized_item_deleted, EventType.localized_item_snapshot, EventType.membership_upserted, EventType.membership_deleted, EventType.organization_upserted, EventType.organization_deleted, EventType.authorization_upserted, EventType.authorization_deleted, EventType.capture_upserted, EventType.card_upserted, EventType.card_deleted, EventType.refund_upserted, EventType.return_upserted, EventType.return_deleted, EventType.targeting_item_upserted, EventType.targeting_item_deleted, EventType.tracking_label_event_upserted]
6868
7071
  end
6869
7072
 
6870
7073
  def EventType.attribute_upserted
@@ -6915,6 +7118,14 @@ module Io
6915
7118
  @@_rate_upserted ||= EventType.new('rate_upserted')
6916
7119
  end
6917
7120
 
7121
+ def EventType.available_promotions_upserted
7122
+ @@_available_promotions_upserted ||= EventType.new('available_promotions_upserted')
7123
+ end
7124
+
7125
+ def EventType.available_promotions_deleted
7126
+ @@_available_promotions_deleted ||= EventType.new('available_promotions_deleted')
7127
+ end
7128
+
6918
7129
  def EventType.experience_deleted
6919
7130
  @@_experience_deleted ||= EventType.new('experience_deleted')
6920
7131
  end
@@ -7949,6 +8160,78 @@ module Io
7949
8160
 
7950
8161
  end
7951
8162
 
8163
+ class PaymentErrorCode
8164
+
8165
+ attr_reader :value
8166
+
8167
+ def initialize(value)
8168
+ @value = HttpClient::Preconditions.assert_class('value', value, String)
8169
+ end
8170
+
8171
+ # Returns the instance of PaymentErrorCode for this value, creating a new instance for an unknown value
8172
+ def PaymentErrorCode.apply(value)
8173
+ if value.instance_of?(PaymentErrorCode)
8174
+ value
8175
+ else
8176
+ HttpClient::Preconditions.assert_class_or_nil('value', value, String)
8177
+ value.nil? ? nil : (from_string(value) || PaymentErrorCode.new(value))
8178
+ end
8179
+ end
8180
+
8181
+ # Returns the instance of PaymentErrorCode for this value, or nil if not found
8182
+ def PaymentErrorCode.from_string(value)
8183
+ HttpClient::Preconditions.assert_class('value', value, String)
8184
+ PaymentErrorCode.ALL.find { |v| v.value == value }
8185
+ end
8186
+
8187
+ def PaymentErrorCode.ALL
8188
+ @@all ||= [PaymentErrorCode.invalid_amount, PaymentErrorCode.invalid_currency, PaymentErrorCode.invalid_method, PaymentErrorCode.invalid_order, PaymentErrorCode.invalid_customer, PaymentErrorCode.invalid_destination, PaymentErrorCode.unknown]
8189
+ end
8190
+
8191
+ # Amount is not valid (e.g. for merchant of record payments, the amount
8192
+ # specified must match the order). This typically is handled by refreshing the
8193
+ # order amount and reconfirming with the user as something has changed.
8194
+ def PaymentErrorCode.invalid_amount
8195
+ @@_invalid_amount ||= PaymentErrorCode.new('invalid_amount')
8196
+ end
8197
+
8198
+ # Currency is either not known or invalid (e.g. for merchant of record payments,
8199
+ # the currency specified must match the order).
8200
+ def PaymentErrorCode.invalid_currency
8201
+ @@_invalid_currency ||= PaymentErrorCode.new('invalid_currency')
8202
+ end
8203
+
8204
+ # Invalid payment method
8205
+ def PaymentErrorCode.invalid_method
8206
+ @@_invalid_method ||= PaymentErrorCode.new('invalid_method')
8207
+ end
8208
+
8209
+ # The specified order number was not found
8210
+ def PaymentErrorCode.invalid_order
8211
+ @@_invalid_order ||= PaymentErrorCode.new('invalid_order')
8212
+ end
8213
+
8214
+ # Customer information is invalid (e.g. email specified but not a valid email)
8215
+ def PaymentErrorCode.invalid_customer
8216
+ @@_invalid_customer ||= PaymentErrorCode.new('invalid_customer')
8217
+ end
8218
+
8219
+ # Destination/shipping address is not valid
8220
+ def PaymentErrorCode.invalid_destination
8221
+ @@_invalid_destination ||= PaymentErrorCode.new('invalid_destination')
8222
+ end
8223
+
8224
+ # Failed due to another reason (details not known)
8225
+ def PaymentErrorCode.unknown
8226
+ @@_unknown ||= PaymentErrorCode.new('unknown')
8227
+ end
8228
+
8229
+ def to_hash
8230
+ value
8231
+ end
8232
+
8233
+ end
8234
+
7952
8235
  class PaymentMethodType
7953
8236
 
7954
8237
  attr_reader :value
@@ -10320,6 +10603,74 @@ module Io
10320
10603
 
10321
10604
  end
10322
10605
 
10606
+ class AvailablePromotionsDeleted < Event
10607
+
10608
+ attr_reader :event_id, :timestamp, :organization, :experience_key
10609
+
10610
+ def initialize(incoming={})
10611
+ super(:discriminator => Event::Types::AVAILABLE_PROMOTIONS_DELETED)
10612
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10613
+ HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :experience_key], 'AvailablePromotionsDeleted')
10614
+ @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
10615
+ @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
10616
+ @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
10617
+ @experience_key = HttpClient::Preconditions.assert_class('experience_key', opts.delete(:experience_key), String)
10618
+ end
10619
+
10620
+ def to_json
10621
+ JSON.dump(to_hash)
10622
+ end
10623
+
10624
+ def copy(incoming={})
10625
+ AvailablePromotionsDeleted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10626
+ end
10627
+
10628
+ def subtype_to_hash
10629
+ {
10630
+ :event_id => event_id,
10631
+ :timestamp => timestamp,
10632
+ :organization => organization,
10633
+ :experience_key => experience_key
10634
+ }
10635
+ end
10636
+
10637
+ end
10638
+
10639
+ class AvailablePromotionsUpserted < Event
10640
+
10641
+ attr_reader :event_id, :timestamp, :organization, :experience_key, :available_promotions
10642
+
10643
+ def initialize(incoming={})
10644
+ super(:discriminator => Event::Types::AVAILABLE_PROMOTIONS_UPSERTED)
10645
+ opts = HttpClient::Helper.symbolize_keys(incoming)
10646
+ HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :experience_key, :available_promotions], 'AvailablePromotionsUpserted')
10647
+ @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
10648
+ @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
10649
+ @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
10650
+ @experience_key = HttpClient::Preconditions.assert_class('experience_key', opts.delete(:experience_key), String)
10651
+ @available_promotions = HttpClient::Preconditions.assert_class('available_promotions', opts.delete(:available_promotions), Array).map { |v| HttpClient::Preconditions.assert_class('available_promotions', HttpClient::Helper.to_object(v), Hash) }
10652
+ end
10653
+
10654
+ def to_json
10655
+ JSON.dump(to_hash)
10656
+ end
10657
+
10658
+ def copy(incoming={})
10659
+ AvailablePromotionsUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
10660
+ end
10661
+
10662
+ def subtype_to_hash
10663
+ {
10664
+ :event_id => event_id,
10665
+ :timestamp => timestamp,
10666
+ :organization => organization,
10667
+ :experience_key => experience_key,
10668
+ :available_promotions => available_promotions
10669
+ }
10670
+ end
10671
+
10672
+ end
10673
+
10323
10674
  # Representation of a service level available at a center and the special pickup
10324
10675
  # times during the week. If pickup schedules are not provided, assumption is
10325
10676
  # once a day during the weekdays.
@@ -12344,47 +12695,6 @@ module Io
12344
12695
 
12345
12696
  end
12346
12697
 
12347
- class DirectOnlinePaymentForm < AuthorizationForm
12348
-
12349
- attr_reader :method, :amount, :currency, :customer, :key, :attributes, :destination, :ip
12350
-
12351
- def initialize(incoming={})
12352
- super(:discriminator => AuthorizationForm::Types::DIRECT_ONLINE_PAYMENT_FORM)
12353
- opts = HttpClient::Helper.symbolize_keys(incoming)
12354
- HttpClient::Preconditions.require_keys(opts, [:method, :amount, :currency], 'DirectOnlinePaymentForm')
12355
- @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
12356
- @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
12357
- @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
12358
- @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x)))
12359
- @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
12360
- @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
12361
- @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
12362
- @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
12363
- end
12364
-
12365
- def to_json
12366
- JSON.dump(to_hash)
12367
- end
12368
-
12369
- def copy(incoming={})
12370
- DirectOnlinePaymentForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
12371
- end
12372
-
12373
- def subtype_to_hash
12374
- {
12375
- :method => method,
12376
- :amount => amount,
12377
- :currency => currency,
12378
- :customer => customer.nil? ? nil : customer.to_hash,
12379
- :key => key,
12380
- :attributes => attributes.nil? ? nil : attributes,
12381
- :destination => destination.nil? ? nil : destination.to_hash,
12382
- :ip => ip
12383
- }
12384
- end
12385
-
12386
- end
12387
-
12388
12698
  # Represents a duration of time.
12389
12699
  class Duration
12390
12700
 
@@ -12897,6 +13207,64 @@ module Io
12897
13207
 
12898
13208
  end
12899
13209
 
13210
+ # Represents a single experiment / test (e.g. for an incremental rollout or AB
13211
+ # Test)
13212
+ class Experiment
13213
+
13214
+ attr_reader :id, :key
13215
+
13216
+ def initialize(incoming={})
13217
+ opts = HttpClient::Helper.symbolize_keys(incoming)
13218
+ HttpClient::Preconditions.require_keys(opts, [:id, :key], 'Experiment')
13219
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
13220
+ @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
13221
+ end
13222
+
13223
+ def to_json
13224
+ JSON.dump(to_hash)
13225
+ end
13226
+
13227
+ def copy(incoming={})
13228
+ Experiment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
13229
+ end
13230
+
13231
+ def to_hash
13232
+ {
13233
+ :id => id,
13234
+ :key => key
13235
+ }
13236
+ end
13237
+
13238
+ end
13239
+
13240
+ # Represents a single instance of an experiment (e.g. page request) resulting in
13241
+ # a decision as to the status of a given experiment
13242
+ class ExperimentStatus
13243
+
13244
+ attr_reader :enabled
13245
+
13246
+ def initialize(incoming={})
13247
+ opts = HttpClient::Helper.symbolize_keys(incoming)
13248
+ HttpClient::Preconditions.require_keys(opts, [:enabled], 'ExperimentStatus')
13249
+ @enabled = HttpClient::Preconditions.assert_boolean('enabled', opts.delete(:enabled))
13250
+ end
13251
+
13252
+ def to_json
13253
+ JSON.dump(to_hash)
13254
+ end
13255
+
13256
+ def copy(incoming={})
13257
+ ExperimentStatus.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
13258
+ end
13259
+
13260
+ def to_hash
13261
+ {
13262
+ :enabled => enabled
13263
+ }
13264
+ end
13265
+
13266
+ end
13267
+
12900
13268
  # The month and year at which a card expires
12901
13269
  class Expiration
12902
13270
 
@@ -16165,14 +16533,15 @@ module Io
16165
16533
  # will be presented here
16166
16534
  class LocalSession
16167
16535
 
16168
- attr_reader :country, :currency, :language, :experience
16536
+ attr_reader :country, :currency, :language, :locale, :experience
16169
16537
 
16170
16538
  def initialize(incoming={})
16171
16539
  opts = HttpClient::Helper.symbolize_keys(incoming)
16172
- HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language, :experience], 'LocalSession')
16540
+ HttpClient::Preconditions.require_keys(opts, [:country, :currency, :language, :locale, :experience], 'LocalSession')
16173
16541
  @country = (x = opts.delete(:country); x.is_a?(::Io::Flow::V0::Models::Country) ? x : ::Io::Flow::V0::Models::Country.new(x))
16174
16542
  @currency = (x = opts.delete(:currency); x.is_a?(::Io::Flow::V0::Models::Currency) ? x : ::Io::Flow::V0::Models::Currency.new(x))
16175
16543
  @language = (x = opts.delete(:language); x.is_a?(::Io::Flow::V0::Models::Language) ? x : ::Io::Flow::V0::Models::Language.new(x))
16544
+ @locale = (x = opts.delete(:locale); x.is_a?(::Io::Flow::V0::Models::Locale) ? x : ::Io::Flow::V0::Models::Locale.new(x))
16176
16545
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceKeyReference) ? x : ::Io::Flow::V0::Models::ExperienceKeyReference.new(x))
16177
16546
  end
16178
16547
 
@@ -16189,6 +16558,7 @@ module Io
16189
16558
  :country => country.to_hash,
16190
16559
  :currency => currency.to_hash,
16191
16560
  :language => language.to_hash,
16561
+ :locale => locale.to_hash,
16192
16562
  :experience => experience.to_hash
16193
16563
  }
16194
16564
  end
@@ -16897,21 +17267,19 @@ module Io
16897
17267
 
16898
17268
  end
16899
17269
 
16900
- class MerchantOfRecordOnlinePaymentForm < AuthorizationForm
17270
+ # Creates an online payment
17271
+ class MerchantOfRecordPaymentForm < PaymentForm
16901
17272
 
16902
- attr_reader :method, :order_number, :amount, :currency, :key, :attributes, :ip
17273
+ attr_reader :method, :order_number, :amount, :currency
16903
17274
 
16904
17275
  def initialize(incoming={})
16905
- super(:discriminator => AuthorizationForm::Types::MERCHANT_OF_RECORD_ONLINE_PAYMENT_FORM)
17276
+ super(:discriminator => PaymentForm::Types::MERCHANT_OF_RECORD_PAYMENT_FORM)
16906
17277
  opts = HttpClient::Helper.symbolize_keys(incoming)
16907
- HttpClient::Preconditions.require_keys(opts, [:method, :order_number, :amount, :currency], 'MerchantOfRecordOnlinePaymentForm')
17278
+ HttpClient::Preconditions.require_keys(opts, [:method, :order_number, :amount, :currency], 'MerchantOfRecordPaymentForm')
16908
17279
  @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
16909
17280
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
16910
17281
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
16911
17282
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
16912
- @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
16913
- @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
16914
- @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
16915
17283
  end
16916
17284
 
16917
17285
  def to_json
@@ -16919,7 +17287,7 @@ module Io
16919
17287
  end
16920
17288
 
16921
17289
  def copy(incoming={})
16922
- MerchantOfRecordOnlinePaymentForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
17290
+ MerchantOfRecordPaymentForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
16923
17291
  end
16924
17292
 
16925
17293
  def subtype_to_hash
@@ -16927,10 +17295,7 @@ module Io
16927
17295
  :method => method,
16928
17296
  :order_number => order_number,
16929
17297
  :amount => amount,
16930
- :currency => currency,
16931
- :key => key,
16932
- :attributes => attributes.nil? ? nil : attributes,
16933
- :ip => ip
17298
+ :currency => currency
16934
17299
  }
16935
17300
  end
16936
17301
 
@@ -17119,15 +17484,15 @@ module Io
17119
17484
 
17120
17485
  class OnlineAuthorization < Authorization
17121
17486
 
17122
- attr_reader :id, :key, :method, :amount, :currency, :customer, :attributes, :destination, :order, :ip, :result, :created_at
17487
+ attr_reader :id, :key, :payment, :amount, :currency, :customer, :attributes, :destination, :order, :ip, :created_at
17123
17488
 
17124
17489
  def initialize(incoming={})
17125
17490
  super(:discriminator => Authorization::Types::ONLINE_AUTHORIZATION)
17126
17491
  opts = HttpClient::Helper.symbolize_keys(incoming)
17127
- HttpClient::Preconditions.require_keys(opts, [:id, :key, :method, :amount, :currency, :customer, :attributes, :result, :created_at], 'OnlineAuthorization')
17492
+ HttpClient::Preconditions.require_keys(opts, [:id, :key, :payment, :amount, :currency, :customer, :attributes, :created_at], 'OnlineAuthorization')
17128
17493
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
17129
17494
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
17130
- @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
17495
+ @payment = (x = opts.delete(:payment); x.is_a?(::Io::Flow::V0::Models::PaymentReference) ? x : ::Io::Flow::V0::Models::PaymentReference.new(x))
17131
17496
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
17132
17497
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
17133
17498
  @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::Customer) ? x : ::Io::Flow::V0::Models::Customer.new(x))
@@ -17135,7 +17500,6 @@ module Io
17135
17500
  @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
17136
17501
  @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
17137
17502
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
17138
- @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
17139
17503
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
17140
17504
  end
17141
17505
 
@@ -17151,7 +17515,7 @@ module Io
17151
17515
  {
17152
17516
  :id => id,
17153
17517
  :key => key,
17154
- :method => method,
17518
+ :payment => payment.to_hash,
17155
17519
  :amount => amount,
17156
17520
  :currency => currency,
17157
17521
  :customer => customer.to_hash,
@@ -17159,7 +17523,6 @@ module Io
17159
17523
  :destination => destination.nil? ? nil : destination.to_hash,
17160
17524
  :order => order.nil? ? nil : order.to_hash,
17161
17525
  :ip => ip,
17162
- :result => result.to_hash,
17163
17526
  :created_at => created_at
17164
17527
  }
17165
17528
  end
@@ -18778,6 +19141,37 @@ module Io
18778
19141
 
18779
19142
  end
18780
19143
 
19144
+ # Details for why a payment failed
19145
+ class PaymentError
19146
+
19147
+ attr_reader :code, :messages, :codes
19148
+
19149
+ def initialize(incoming={})
19150
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19151
+ HttpClient::Preconditions.require_keys(opts, [:messages, :codes], 'PaymentError')
19152
+ @code = HttpClient::Preconditions.assert_class('code', (x = opts.delete(:code); x.nil? ? "payment_error" : x), String)
19153
+ @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
19154
+ @codes = HttpClient::Preconditions.assert_class('codes', opts.delete(:codes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentErrorCode) ? x : ::Io::Flow::V0::Models::PaymentErrorCode.apply(x)) }
19155
+ end
19156
+
19157
+ def to_json
19158
+ JSON.dump(to_hash)
19159
+ end
19160
+
19161
+ def copy(incoming={})
19162
+ PaymentError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19163
+ end
19164
+
19165
+ def to_hash
19166
+ {
19167
+ :code => code,
19168
+ :messages => messages,
19169
+ :codes => codes.map { |o| o.value }
19170
+ }
19171
+ end
19172
+
19173
+ end
19174
+
18781
19175
  # Represents a single payment method - e.g VISA or Paypal - and any associated
18782
19176
  # metadata required for processing
18783
19177
  class PaymentMethod
@@ -18874,6 +19268,163 @@ module Io
18874
19268
 
18875
19269
  end
18876
19270
 
19271
+ # Represents on line payment
19272
+ class PaymentPaypal < Payment
19273
+
19274
+ attr_reader :id, :order, :amount, :currency, :paypal
19275
+
19276
+ def initialize(incoming={})
19277
+ super(:discriminator => Payment::Types::PAYMENT_PAYPAL)
19278
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19279
+ HttpClient::Preconditions.require_keys(opts, [:id, :amount, :currency, :paypal], 'PaymentPaypal')
19280
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
19281
+ @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
19282
+ @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
19283
+ @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
19284
+ @paypal = (x = opts.delete(:paypal); x.is_a?(::Io::Flow::V0::Models::PaymentPaypalData) ? x : ::Io::Flow::V0::Models::PaymentPaypalData.new(x))
19285
+ end
19286
+
19287
+ def to_json
19288
+ JSON.dump(to_hash)
19289
+ end
19290
+
19291
+ def copy(incoming={})
19292
+ PaymentPaypal.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19293
+ end
19294
+
19295
+ def subtype_to_hash
19296
+ {
19297
+ :id => id,
19298
+ :order => order.nil? ? nil : order.to_hash,
19299
+ :amount => amount,
19300
+ :currency => currency,
19301
+ :paypal => paypal.to_hash
19302
+ }
19303
+ end
19304
+
19305
+ end
19306
+
19307
+ # Represents on line payment
19308
+ class PaymentPaypalData
19309
+
19310
+ attr_reader :payment_id
19311
+
19312
+ def initialize(incoming={})
19313
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19314
+ HttpClient::Preconditions.require_keys(opts, [:payment_id], 'PaymentPaypalData')
19315
+ @payment_id = HttpClient::Preconditions.assert_class('payment_id', opts.delete(:payment_id), String)
19316
+ end
19317
+
19318
+ def to_json
19319
+ JSON.dump(to_hash)
19320
+ end
19321
+
19322
+ def copy(incoming={})
19323
+ PaymentPaypalData.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19324
+ end
19325
+
19326
+ def to_hash
19327
+ {
19328
+ :payment_id => payment_id
19329
+ }
19330
+ end
19331
+
19332
+ end
19333
+
19334
+ class PaymentReference
19335
+
19336
+ attr_reader :id
19337
+
19338
+ def initialize(incoming={})
19339
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19340
+ HttpClient::Preconditions.require_keys(opts, [:id], 'PaymentReference')
19341
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
19342
+ end
19343
+
19344
+ def to_json
19345
+ JSON.dump(to_hash)
19346
+ end
19347
+
19348
+ def copy(incoming={})
19349
+ PaymentReference.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19350
+ end
19351
+
19352
+ def to_hash
19353
+ {
19354
+ :id => id
19355
+ }
19356
+ end
19357
+
19358
+ end
19359
+
19360
+ class PaymentVersion
19361
+
19362
+ attr_reader :id, :timestamp, :type, :payment
19363
+
19364
+ def initialize(incoming={})
19365
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19366
+ HttpClient::Preconditions.require_keys(opts, [:id, :timestamp, :type, :payment], 'PaymentVersion')
19367
+ @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
19368
+ @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
19369
+ @type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::ChangeType) ? x : ::Io::Flow::V0::Models::ChangeType.apply(x))
19370
+ @payment = (x = opts.delete(:payment); x.is_a?(::Io::Flow::V0::Models::Payment) ? x : ::Io::Flow::V0::Models::Payment.from_json(x))
19371
+ end
19372
+
19373
+ def to_json
19374
+ JSON.dump(to_hash)
19375
+ end
19376
+
19377
+ def copy(incoming={})
19378
+ PaymentVersion.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19379
+ end
19380
+
19381
+ def to_hash
19382
+ {
19383
+ :id => id,
19384
+ :timestamp => timestamp,
19385
+ :type => type.value,
19386
+ :payment => payment.to_hash
19387
+ }
19388
+ end
19389
+
19390
+ end
19391
+
19392
+ # Executes the Paypal payment
19393
+ class PaypalAuthorizationForm < AuthorizationForm
19394
+
19395
+ attr_reader :paypal_payment_id, :paypal_buyer_id, :key, :attributes, :ip
19396
+
19397
+ def initialize(incoming={})
19398
+ super(:discriminator => AuthorizationForm::Types::PAYPAL_AUTHORIZATION_FORM)
19399
+ opts = HttpClient::Helper.symbolize_keys(incoming)
19400
+ HttpClient::Preconditions.require_keys(opts, [:paypal_payment_id, :paypal_buyer_id], 'PaypalAuthorizationForm')
19401
+ @paypal_payment_id = HttpClient::Preconditions.assert_class('paypal_payment_id', opts.delete(:paypal_payment_id), String)
19402
+ @paypal_buyer_id = HttpClient::Preconditions.assert_class('paypal_buyer_id', opts.delete(:paypal_buyer_id), String)
19403
+ @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
19404
+ @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
19405
+ @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
19406
+ end
19407
+
19408
+ def to_json
19409
+ JSON.dump(to_hash)
19410
+ end
19411
+
19412
+ def copy(incoming={})
19413
+ PaypalAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
19414
+ end
19415
+
19416
+ def subtype_to_hash
19417
+ {
19418
+ :paypal_payment_id => paypal_payment_id,
19419
+ :paypal_buyer_id => paypal_buyer_id,
19420
+ :key => key,
19421
+ :attributes => attributes.nil? ? nil : attributes,
19422
+ :ip => ip
19423
+ }
19424
+ end
19425
+
19426
+ end
19427
+
18877
19428
  # Rule outcome where shipping surfaced in quote is actual cost plus a predefined
18878
19429
  # margin percentage
18879
19430
  class PercentMargin < TierRuleOutcome
@@ -20755,7 +21306,7 @@ module Io
20755
21306
 
20756
21307
  class SessionForm
20757
21308
 
20758
- attr_reader :ip, :experience, :country, :currency, :language
21309
+ attr_reader :ip, :experience, :country, :currency, :language, :locale
20759
21310
 
20760
21311
  def initialize(incoming={})
20761
21312
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -20764,6 +21315,7 @@ module Io
20764
21315
  @country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
20765
21316
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
20766
21317
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
21318
+ @locale = (x = opts.delete(:locale); x.nil? ? nil : HttpClient::Preconditions.assert_class('locale', x, String))
20767
21319
  end
20768
21320
 
20769
21321
  def to_json
@@ -20780,7 +21332,8 @@ module Io
20780
21332
  :experience => experience,
20781
21333
  :country => country,
20782
21334
  :currency => currency,
20783
- :language => language
21335
+ :language => language,
21336
+ :locale => locale
20784
21337
  }
20785
21338
  end
20786
21339
 
@@ -20788,7 +21341,7 @@ module Io
20788
21341
 
20789
21342
  class SessionPutForm
20790
21343
 
20791
- attr_reader :experience, :country, :currency, :language
21344
+ attr_reader :experience, :country, :currency, :language, :locale
20792
21345
 
20793
21346
  def initialize(incoming={})
20794
21347
  opts = HttpClient::Helper.symbolize_keys(incoming)
@@ -20796,6 +21349,7 @@ module Io
20796
21349
  @country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
20797
21350
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
20798
21351
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
21352
+ @locale = (x = opts.delete(:locale); x.nil? ? nil : HttpClient::Preconditions.assert_class('locale', x, String))
20799
21353
  end
20800
21354
 
20801
21355
  def to_json
@@ -20811,7 +21365,8 @@ module Io
20811
21365
  :experience => experience,
20812
21366
  :country => country,
20813
21367
  :currency => currency,
20814
- :language => language
21368
+ :language => language,
21369
+ :locale => locale
20815
21370
  }
20816
21371
  end
20817
21372
 
@@ -21130,7 +21685,7 @@ module Io
21130
21685
 
21131
21686
  class ShopifySession < Session
21132
21687
 
21133
- attr_reader :id, :organization, :attributes, :local, :shop, :cart
21688
+ attr_reader :id, :organization, :attributes, :local, :shop, :cart, :experiments
21134
21689
 
21135
21690
  def initialize(incoming={})
21136
21691
  super(:discriminator => Session::Types::SHOPIFY_SESSION)
@@ -21142,6 +21697,7 @@ module Io
21142
21697
  @local = (x = opts.delete(:local); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::LocalSession) ? x : ::Io::Flow::V0::Models::LocalSession.new(x)))
21143
21698
  @shop = HttpClient::Preconditions.assert_class('shop', opts.delete(:shop), String)
21144
21699
  @cart = (x = opts.delete(:cart); x.is_a?(::Io::Flow::V0::Models::CartReference) ? x : ::Io::Flow::V0::Models::CartReference.new(x))
21700
+ @experiments = HttpClient::Preconditions.assert_class('experiments', (x = opts.delete(:experiments); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = (x = d[1]; x.is_a?(::Io::Flow::V0::Models::ExperimentStatus) ? x : ::Io::Flow::V0::Models::ExperimentStatus.new(x)); h }
21145
21701
  end
21146
21702
 
21147
21703
  def to_json
@@ -21159,7 +21715,8 @@ module Io
21159
21715
  :attributes => attributes,
21160
21716
  :local => local.nil? ? nil : local.to_hash,
21161
21717
  :shop => shop,
21162
- :cart => cart.to_hash
21718
+ :cart => cart.to_hash,
21719
+ :experiments => experiments.inject({}) { |hash, o| hash[o[0]] = o[1].nil? ? nil : o[1].to_hash; hash }
21163
21720
  }
21164
21721
  end
21165
21722