flowcommerce 0.2.35 → 0.2.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flow_commerce/flow_api_v0_client.rb +452 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4728ff6fa49f71c1ce5daa33fb670993ded01e2e
|
4
|
+
data.tar.gz: 1f08893fcac0e5a13ebc5ff17c3e53be2eba9864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e95b5919b45a2ccdd30ad604c22afe6e4f9f6480687e32806f31cc5040a14c01eceb440f6ec56ffa60de82a06859e449fb715d8237fd80bbf3e98ebd162931f
|
7
|
+
data.tar.gz: e9915994db625b9353c44ca138996b4cba1ebd6c10619f7585e34cb9b81eee20be2f77cfee3bc0d39735ba1485ffd19e0f8cb861eeaea6e89a5e4397757bcde1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Generated by API Builder - https://www.apibuilder.io
|
2
2
|
# Service version: 0.3.65
|
3
|
-
# apibuilder:0.12.61 https://app.apibuilder.io/flow/api/0.3.
|
3
|
+
# apibuilder:0.12.61 https://app.apibuilder.io/flow/api/0.3.85/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 = 'apibuilder:0.12.61 https://app.apibuilder.io/flow/api/0.3.
|
28
|
+
USER_AGENT = 'apibuilder:0.12.61 https://app.apibuilder.io/flow/api/0.3.85/ruby_client' unless defined?(Constants::USER_AGENT)
|
29
29
|
VERSION = '0.3.65' unless defined?(Constants::VERSION)
|
30
30
|
VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
|
31
31
|
|
@@ -104,6 +104,10 @@ module Io
|
|
104
104
|
@order_identifiers ||= ::Io::Flow::V0::Clients::OrderIdentifiers.new(self)
|
105
105
|
end
|
106
106
|
|
107
|
+
def order_promotions
|
108
|
+
@order_promotions ||= ::Io::Flow::V0::Clients::OrderPromotions.new(self)
|
109
|
+
end
|
110
|
+
|
107
111
|
def organizations
|
108
112
|
@organizations ||= ::Io::Flow::V0::Clients::Organizations.new(self)
|
109
113
|
end
|
@@ -1073,6 +1077,21 @@ module Io
|
|
1073
1077
|
nil
|
1074
1078
|
end
|
1075
1079
|
|
1080
|
+
# Creates a free shipping promotion to the order, automatically applying it to
|
1081
|
+
# the order if the order meets the defined promotion trigger.
|
1082
|
+
def put_promotions_and_free_shipping_by_number_and_key(organization, number, key, free_shipping_order_promotion_form, incoming={})
|
1083
|
+
HttpClient::Preconditions.assert_class('organization', organization, String)
|
1084
|
+
HttpClient::Preconditions.assert_class('number', number, String)
|
1085
|
+
HttpClient::Preconditions.assert_class('key', key, String)
|
1086
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
1087
|
+
query = {
|
1088
|
+
:expand => (x = opts.delete(:expand); x.nil? ? nil : HttpClient::Preconditions.assert_class('expand', x, Array).map { |v| HttpClient::Preconditions.assert_class('expand', v, String) })
|
1089
|
+
}.delete_if { |k, v| v.nil? }
|
1090
|
+
(x = free_shipping_order_promotion_form; x.is_a?(::Io::Flow::V0::Models::FreeShippingOrderPromotionForm) ? x : ::Io::Flow::V0::Models::FreeShippingOrderPromotionForm.new(x))
|
1091
|
+
r = @client.request("/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/promotions/#{CGI.escape(key)}/free_shipping").with_query(query).with_json(free_shipping_order_promotion_form.to_json).put
|
1092
|
+
::Io::Flow::V0::Models::FreeShippingOrderPromotion.new(r)
|
1093
|
+
end
|
1094
|
+
|
1076
1095
|
# Submits an order. You will get a validation error if the order has already
|
1077
1096
|
# expired (and a new quote could not be automatically recreated for a lower or
|
1078
1097
|
# same price). This method is idempotent - submitting an order a second time
|
@@ -1231,6 +1250,22 @@ module Io
|
|
1231
1250
|
|
1232
1251
|
end
|
1233
1252
|
|
1253
|
+
class OrderPromotions
|
1254
|
+
|
1255
|
+
def initialize(client)
|
1256
|
+
@client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
|
1257
|
+
end
|
1258
|
+
|
1259
|
+
# Deletes the order promotion with the specified key
|
1260
|
+
def delete_by_key(organization, key)
|
1261
|
+
HttpClient::Preconditions.assert_class('organization', organization, String)
|
1262
|
+
HttpClient::Preconditions.assert_class('key', key, String)
|
1263
|
+
r = @client.request("/#{CGI.escape(organization)}/order/promotions/#{CGI.escape(key)}").delete
|
1264
|
+
nil
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
end
|
1268
|
+
|
1234
1269
|
class Organizations
|
1235
1270
|
|
1236
1271
|
def initialize(client)
|
@@ -2379,6 +2414,15 @@ module Io
|
|
2379
2414
|
nil
|
2380
2415
|
end
|
2381
2416
|
|
2417
|
+
# Create a new card authorization using card details, or the token of a
|
2418
|
+
# previously tokenized card.
|
2419
|
+
def post_card(organization, card_authorization_form)
|
2420
|
+
HttpClient::Preconditions.assert_class('organization', organization, String)
|
2421
|
+
(x = card_authorization_form; x.is_a?(::Io::Flow::V0::Models::CardAuthorizationForm) ? x : ::Io::Flow::V0::Models::CardAuthorizationForm.new(x))
|
2422
|
+
r = @client.request("/#{CGI.escape(organization)}/authorizations/card").with_json(card_authorization_form.to_json).post
|
2423
|
+
::Io::Flow::V0::Models::CardAuthorization.new(r)
|
2424
|
+
end
|
2425
|
+
|
2382
2426
|
# Create a new online authorization.
|
2383
2427
|
def post_online(organization, authorization_form)
|
2384
2428
|
HttpClient::Preconditions.assert_class('organization', organization, String)
|
@@ -4980,7 +5024,7 @@ module Io
|
|
4980
5024
|
class AuthorizationForm
|
4981
5025
|
|
4982
5026
|
module Types
|
4983
|
-
# Creates a new authorization by copying an existing
|
5027
|
+
# Creates a new authorization by copying an existing one.
|
4984
5028
|
AUTHORIZATION_COPY_FORM = 'authorization_copy_form' unless defined?(AUTHORIZATION_COPY_FORM)
|
4985
5029
|
# Enables card payments
|
4986
5030
|
DIRECT_AUTHORIZATION_FORM = 'direct_authorization_form' unless defined?(DIRECT_AUTHORIZATION_FORM)
|
@@ -4991,6 +5035,9 @@ module Io
|
|
4991
5035
|
# Enables authorizations via redirect-based alternative payment methods, such as
|
4992
5036
|
# AliPay.
|
4993
5037
|
REDIRECT_AUTHORIZATION_FORM = 'redirect_authorization_form' unless defined?(REDIRECT_AUTHORIZATION_FORM)
|
5038
|
+
# Enables authorizations for a credit card; will eventually replace direct and
|
5039
|
+
# merchant of record authorization forms.
|
5040
|
+
CARD_AUTHORIZATION_FORM = 'card_authorization_form' unless defined?(CARD_AUTHORIZATION_FORM)
|
4994
5041
|
end
|
4995
5042
|
|
4996
5043
|
attr_reader :discriminator
|
@@ -5002,7 +5049,7 @@ module Io
|
|
5002
5049
|
end
|
5003
5050
|
|
5004
5051
|
def subtype_to_hash
|
5005
|
-
raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: authorization_copy_form, direct_authorization_form, merchant_of_record_authorization_form, paypal_authorization_form, redirect_authorization_form'
|
5052
|
+
raise 'Cannot serialize an instance of authorization_form directly - must use one of the specific types: authorization_copy_form, direct_authorization_form, merchant_of_record_authorization_form, paypal_authorization_form, redirect_authorization_form, card_authorization_form'
|
5006
5053
|
end
|
5007
5054
|
|
5008
5055
|
def to_hash
|
@@ -5021,6 +5068,7 @@ module Io
|
|
5021
5068
|
when Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM; MerchantOfRecordAuthorizationForm.new(hash)
|
5022
5069
|
when Types::PAYPAL_AUTHORIZATION_FORM; PaypalAuthorizationForm.new(hash)
|
5023
5070
|
when Types::REDIRECT_AUTHORIZATION_FORM; RedirectAuthorizationForm.new(hash)
|
5071
|
+
when Types::CARD_AUTHORIZATION_FORM; CardAuthorizationForm.new(hash)
|
5024
5072
|
else AuthorizationFormUndefinedType.new(:discriminator => discriminator)
|
5025
5073
|
end
|
5026
5074
|
end
|
@@ -5051,6 +5099,69 @@ module Io
|
|
5051
5099
|
|
5052
5100
|
end
|
5053
5101
|
|
5102
|
+
# Represents the data needed to create a card authorization.
|
5103
|
+
class CardAuthorizationData
|
5104
|
+
|
5105
|
+
module Types
|
5106
|
+
CARD_TOKEN_FORM = 'card_token_form' unless defined?(CARD_TOKEN_FORM)
|
5107
|
+
CARD_FORM = 'card_form' unless defined?(CARD_FORM)
|
5108
|
+
end
|
5109
|
+
|
5110
|
+
attr_reader :discriminator
|
5111
|
+
|
5112
|
+
def initialize(incoming={})
|
5113
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
5114
|
+
HttpClient::Preconditions.require_keys(opts, [:discriminator], 'CardAuthorizationData')
|
5115
|
+
@discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
|
5116
|
+
end
|
5117
|
+
|
5118
|
+
def subtype_to_hash
|
5119
|
+
raise 'Cannot serialize an instance of card_authorization_data directly - must use one of the specific types: card_token_form, card_form'
|
5120
|
+
end
|
5121
|
+
|
5122
|
+
def to_hash
|
5123
|
+
subtype_to_hash.merge(:discriminator => @discriminator)
|
5124
|
+
end
|
5125
|
+
|
5126
|
+
def CardAuthorizationData.from_json(hash)
|
5127
|
+
HttpClient::Preconditions.assert_class('hash', hash, Hash)
|
5128
|
+
discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
|
5129
|
+
if discriminator.empty?
|
5130
|
+
raise "Union type[card_authorization_data] requires a field named 'discriminator'"
|
5131
|
+
end
|
5132
|
+
case discriminator
|
5133
|
+
when Types::CARD_TOKEN_FORM; CardTokenForm.new(hash)
|
5134
|
+
when Types::CARD_FORM; CardForm.new(hash)
|
5135
|
+
else CardAuthorizationDataUndefinedType.new(:discriminator => discriminator)
|
5136
|
+
end
|
5137
|
+
end
|
5138
|
+
|
5139
|
+
end
|
5140
|
+
|
5141
|
+
class CardAuthorizationDataUndefinedType < CardAuthorizationData
|
5142
|
+
|
5143
|
+
attr_reader :name
|
5144
|
+
|
5145
|
+
def initialize(incoming={})
|
5146
|
+
super(:discriminator => 'undefined_type')
|
5147
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
5148
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
|
5149
|
+
end
|
5150
|
+
|
5151
|
+
def subtype_to_hash
|
5152
|
+
raise 'Unable to serialize undefined type to json'
|
5153
|
+
end
|
5154
|
+
|
5155
|
+
def copy(incoming={})
|
5156
|
+
raise 'Operation not supported for undefined type'
|
5157
|
+
end
|
5158
|
+
|
5159
|
+
def to_hash
|
5160
|
+
raise 'Operation not supported for undefined type'
|
5161
|
+
end
|
5162
|
+
|
5163
|
+
end
|
5164
|
+
|
5054
5165
|
# A delivery represents a group of items that will be delivered together -
|
5055
5166
|
# presenting a single price and delivery time frame, where applicable, to the
|
5056
5167
|
# user. Deliveries commonly are created based on the type of item and, for
|
@@ -6375,6 +6486,126 @@ module Io
|
|
6375
6486
|
|
6376
6487
|
end
|
6377
6488
|
|
6489
|
+
class OrderPromotion
|
6490
|
+
|
6491
|
+
module Types
|
6492
|
+
FREE_SHIPPING_ORDER_PROMOTION = 'free_shipping_order_promotion' unless defined?(FREE_SHIPPING_ORDER_PROMOTION)
|
6493
|
+
end
|
6494
|
+
|
6495
|
+
attr_reader :discriminator
|
6496
|
+
|
6497
|
+
def initialize(incoming={})
|
6498
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
6499
|
+
HttpClient::Preconditions.require_keys(opts, [:discriminator], 'OrderPromotion')
|
6500
|
+
@discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
|
6501
|
+
end
|
6502
|
+
|
6503
|
+
def subtype_to_hash
|
6504
|
+
raise 'Cannot serialize an instance of order_promotion directly - must use one of the specific types: free_shipping_order_promotion'
|
6505
|
+
end
|
6506
|
+
|
6507
|
+
def to_hash
|
6508
|
+
subtype_to_hash.merge(:discriminator => @discriminator)
|
6509
|
+
end
|
6510
|
+
|
6511
|
+
def OrderPromotion.from_json(hash)
|
6512
|
+
HttpClient::Preconditions.assert_class('hash', hash, Hash)
|
6513
|
+
discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
|
6514
|
+
if discriminator.empty?
|
6515
|
+
raise "Union type[order_promotion] requires a field named 'discriminator'"
|
6516
|
+
end
|
6517
|
+
case discriminator
|
6518
|
+
when Types::FREE_SHIPPING_ORDER_PROMOTION; FreeShippingOrderPromotion.new(hash)
|
6519
|
+
else OrderPromotionUndefinedType.new(:discriminator => discriminator)
|
6520
|
+
end
|
6521
|
+
end
|
6522
|
+
|
6523
|
+
end
|
6524
|
+
|
6525
|
+
class OrderPromotionUndefinedType < OrderPromotion
|
6526
|
+
|
6527
|
+
attr_reader :name
|
6528
|
+
|
6529
|
+
def initialize(incoming={})
|
6530
|
+
super(:discriminator => 'undefined_type')
|
6531
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
6532
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
|
6533
|
+
end
|
6534
|
+
|
6535
|
+
def subtype_to_hash
|
6536
|
+
raise 'Unable to serialize undefined type to json'
|
6537
|
+
end
|
6538
|
+
|
6539
|
+
def copy(incoming={})
|
6540
|
+
raise 'Operation not supported for undefined type'
|
6541
|
+
end
|
6542
|
+
|
6543
|
+
def to_hash
|
6544
|
+
raise 'Operation not supported for undefined type'
|
6545
|
+
end
|
6546
|
+
|
6547
|
+
end
|
6548
|
+
|
6549
|
+
class OrderPromotionForm
|
6550
|
+
|
6551
|
+
module Types
|
6552
|
+
FREE_SHIPPING_ORDER_PROMOTION_FORM = 'free_shipping_order_promotion_form' unless defined?(FREE_SHIPPING_ORDER_PROMOTION_FORM)
|
6553
|
+
end
|
6554
|
+
|
6555
|
+
attr_reader :discriminator
|
6556
|
+
|
6557
|
+
def initialize(incoming={})
|
6558
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
6559
|
+
HttpClient::Preconditions.require_keys(opts, [:discriminator], 'OrderPromotionForm')
|
6560
|
+
@discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
|
6561
|
+
end
|
6562
|
+
|
6563
|
+
def subtype_to_hash
|
6564
|
+
raise 'Cannot serialize an instance of order_promotion_form directly - must use one of the specific types: free_shipping_order_promotion_form'
|
6565
|
+
end
|
6566
|
+
|
6567
|
+
def to_hash
|
6568
|
+
subtype_to_hash.merge(:discriminator => @discriminator)
|
6569
|
+
end
|
6570
|
+
|
6571
|
+
def OrderPromotionForm.from_json(hash)
|
6572
|
+
HttpClient::Preconditions.assert_class('hash', hash, Hash)
|
6573
|
+
discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
|
6574
|
+
if discriminator.empty?
|
6575
|
+
raise "Union type[order_promotion_form] requires a field named 'discriminator'"
|
6576
|
+
end
|
6577
|
+
case discriminator
|
6578
|
+
when Types::FREE_SHIPPING_ORDER_PROMOTION_FORM; FreeShippingOrderPromotionForm.new(hash)
|
6579
|
+
else OrderPromotionFormUndefinedType.new(:discriminator => discriminator)
|
6580
|
+
end
|
6581
|
+
end
|
6582
|
+
|
6583
|
+
end
|
6584
|
+
|
6585
|
+
class OrderPromotionFormUndefinedType < OrderPromotionForm
|
6586
|
+
|
6587
|
+
attr_reader :name
|
6588
|
+
|
6589
|
+
def initialize(incoming={})
|
6590
|
+
super(:discriminator => 'undefined_type')
|
6591
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
6592
|
+
@name = HttpClient::Preconditions.assert_class('name', opts.delete(:discriminator), String)
|
6593
|
+
end
|
6594
|
+
|
6595
|
+
def subtype_to_hash
|
6596
|
+
raise 'Unable to serialize undefined type to json'
|
6597
|
+
end
|
6598
|
+
|
6599
|
+
def copy(incoming={})
|
6600
|
+
raise 'Operation not supported for undefined type'
|
6601
|
+
end
|
6602
|
+
|
6603
|
+
def to_hash
|
6604
|
+
raise 'Operation not supported for undefined type'
|
6605
|
+
end
|
6606
|
+
|
6607
|
+
end
|
6608
|
+
|
6378
6609
|
# Represents data for a specific online payment method
|
6379
6610
|
class Payment
|
6380
6611
|
|
@@ -10255,9 +10486,18 @@ module Io
|
|
10255
10486
|
end
|
10256
10487
|
|
10257
10488
|
def PromotionTriggerType.ALL
|
10258
|
-
@@all ||= [PromotionTriggerType.order_subtotal]
|
10489
|
+
@@all ||= [PromotionTriggerType.automatic, PromotionTriggerType.order_subtotal]
|
10490
|
+
end
|
10491
|
+
|
10492
|
+
# Automatic indicates the the promotion will be automatically applied to the
|
10493
|
+
# order
|
10494
|
+
def PromotionTriggerType.automatic
|
10495
|
+
@@_automatic ||= PromotionTriggerType.new('automatic')
|
10259
10496
|
end
|
10260
10497
|
|
10498
|
+
# Order subtotal sets a minimum value - orders whose subtotal is greater than
|
10499
|
+
# the minimum will have the promotion applied. A common use case is to offer
|
10500
|
+
# free shipping to orders about 150 CAD.
|
10261
10501
|
def PromotionTriggerType.order_subtotal
|
10262
10502
|
@@_order_subtotal ||= PromotionTriggerType.new('order_subtotal')
|
10263
10503
|
end
|
@@ -13324,6 +13564,52 @@ module Io
|
|
13324
13564
|
|
13325
13565
|
end
|
13326
13566
|
|
13567
|
+
# Similar to a merchant of record authorization form, but it allows card
|
13568
|
+
# information to be included rather than tokenizing first. If the amount is $0,
|
13569
|
+
# then
|
13570
|
+
class CardAuthorizationForm < AuthorizationForm
|
13571
|
+
|
13572
|
+
attr_reader :card, :order_number, :amount, :currency, :key, :cvv, :attributes, :ip, :options
|
13573
|
+
|
13574
|
+
def initialize(incoming={})
|
13575
|
+
super(:discriminator => AuthorizationForm::Types::CARD_AUTHORIZATION_FORM)
|
13576
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13577
|
+
HttpClient::Preconditions.require_keys(opts, [:card], 'CardAuthorizationForm')
|
13578
|
+
@card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::CardAuthorizationData) ? x : ::Io::Flow::V0::Models::CardAuthorizationData.from_json(x))
|
13579
|
+
@order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String))
|
13580
|
+
@amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
|
13581
|
+
@currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
|
13582
|
+
@key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
|
13583
|
+
@cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
|
13584
|
+
@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 })
|
13585
|
+
@ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
|
13586
|
+
@options = (x = opts.delete(:options); x.nil? ? nil : HttpClient::Preconditions.assert_class('options', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AuthorizationOption) ? x : ::Io::Flow::V0::Models::AuthorizationOption.apply(x)) })
|
13587
|
+
end
|
13588
|
+
|
13589
|
+
def to_json
|
13590
|
+
JSON.dump(to_hash)
|
13591
|
+
end
|
13592
|
+
|
13593
|
+
def copy(incoming={})
|
13594
|
+
CardAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
13595
|
+
end
|
13596
|
+
|
13597
|
+
def subtype_to_hash
|
13598
|
+
{
|
13599
|
+
:card => card.to_hash,
|
13600
|
+
:order_number => order_number,
|
13601
|
+
:amount => amount,
|
13602
|
+
:currency => currency,
|
13603
|
+
:key => key,
|
13604
|
+
:cvv => cvv,
|
13605
|
+
:attributes => attributes.nil? ? nil : attributes,
|
13606
|
+
:ip => ip,
|
13607
|
+
:options => options.nil? ? nil : options.map { |o| o.value }
|
13608
|
+
}
|
13609
|
+
end
|
13610
|
+
|
13611
|
+
end
|
13612
|
+
|
13327
13613
|
# Represents an authorization for a card payment method
|
13328
13614
|
class CardAuthorizationUpserted < Event
|
13329
13615
|
|
@@ -13460,11 +13746,12 @@ module Io
|
|
13460
13746
|
|
13461
13747
|
end
|
13462
13748
|
|
13463
|
-
class CardForm
|
13749
|
+
class CardForm < CardAuthorizationData
|
13464
13750
|
|
13465
13751
|
attr_reader :number, :cipher, :expiration_month, :expiration_year, :name, :cvv, :address, :ip, :challenge_text, :challenge_cipher, :token_type
|
13466
13752
|
|
13467
13753
|
def initialize(incoming={})
|
13754
|
+
super(:discriminator => CardAuthorizationData::Types::CARD_FORM)
|
13468
13755
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13469
13756
|
HttpClient::Preconditions.require_keys(opts, [:expiration_month, :expiration_year, :name, :cvv], 'CardForm')
|
13470
13757
|
@number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String))
|
@@ -13485,10 +13772,10 @@ module Io
|
|
13485
13772
|
end
|
13486
13773
|
|
13487
13774
|
def copy(incoming={})
|
13488
|
-
CardForm.new(
|
13775
|
+
CardForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
13489
13776
|
end
|
13490
13777
|
|
13491
|
-
def
|
13778
|
+
def subtype_to_hash
|
13492
13779
|
{
|
13493
13780
|
:number => number,
|
13494
13781
|
:cipher => cipher,
|
@@ -13563,6 +13850,33 @@ module Io
|
|
13563
13850
|
|
13564
13851
|
end
|
13565
13852
|
|
13853
|
+
class CardTokenForm < CardAuthorizationData
|
13854
|
+
|
13855
|
+
attr_reader :token
|
13856
|
+
|
13857
|
+
def initialize(incoming={})
|
13858
|
+
super(:discriminator => CardAuthorizationData::Types::CARD_TOKEN_FORM)
|
13859
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13860
|
+
HttpClient::Preconditions.require_keys(opts, [:token], 'CardTokenForm')
|
13861
|
+
@token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
|
13862
|
+
end
|
13863
|
+
|
13864
|
+
def to_json
|
13865
|
+
JSON.dump(to_hash)
|
13866
|
+
end
|
13867
|
+
|
13868
|
+
def copy(incoming={})
|
13869
|
+
CardTokenForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
13870
|
+
end
|
13871
|
+
|
13872
|
+
def subtype_to_hash
|
13873
|
+
{
|
13874
|
+
:token => token
|
13875
|
+
}
|
13876
|
+
end
|
13877
|
+
|
13878
|
+
end
|
13879
|
+
|
13566
13880
|
class CardUpserted < Event
|
13567
13881
|
|
13568
13882
|
attr_reader :event_id, :timestamp, :organization, :id, :type, :expiration, :iin, :last4, :name, :address
|
@@ -16372,13 +16686,14 @@ module Io
|
|
16372
16686
|
|
16373
16687
|
class FreeShipping < Promotion
|
16374
16688
|
|
16375
|
-
attr_reader :trigger
|
16689
|
+
attr_reader :trigger, :max
|
16376
16690
|
|
16377
16691
|
def initialize(incoming={})
|
16378
16692
|
super(:discriminator => Promotion::Types::FREE_SHIPPING)
|
16379
16693
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
16380
16694
|
HttpClient::Preconditions.require_keys(opts, [:trigger], 'FreeShipping')
|
16381
16695
|
@trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::PromotionTrigger) ? x : ::Io::Flow::V0::Models::PromotionTrigger.new(x))
|
16696
|
+
@max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
|
16382
16697
|
end
|
16383
16698
|
|
16384
16699
|
def to_json
|
@@ -16391,7 +16706,76 @@ module Io
|
|
16391
16706
|
|
16392
16707
|
def subtype_to_hash
|
16393
16708
|
{
|
16394
|
-
:trigger => trigger.to_hash
|
16709
|
+
:trigger => trigger.to_hash,
|
16710
|
+
:max => max.nil? ? nil : max.to_hash
|
16711
|
+
}
|
16712
|
+
end
|
16713
|
+
|
16714
|
+
end
|
16715
|
+
|
16716
|
+
class FreeShippingOrderPromotion < OrderPromotion
|
16717
|
+
|
16718
|
+
attr_reader :id, :order, :key, :trigger, :max, :attributes
|
16719
|
+
|
16720
|
+
def initialize(incoming={})
|
16721
|
+
super(:discriminator => OrderPromotion::Types::FREE_SHIPPING_ORDER_PROMOTION)
|
16722
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
16723
|
+
HttpClient::Preconditions.require_keys(opts, [:id, :order, :key, :trigger, :attributes], 'FreeShippingOrderPromotion')
|
16724
|
+
@id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
|
16725
|
+
@order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::ExpandableOrder) ? x : ::Io::Flow::V0::Models::ExpandableOrder.from_json(x))
|
16726
|
+
@key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
|
16727
|
+
@trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::OrderPromotionTrigger) ? x : ::Io::Flow::V0::Models::OrderPromotionTrigger.new(x))
|
16728
|
+
@max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
|
16729
|
+
@attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
|
16730
|
+
end
|
16731
|
+
|
16732
|
+
def to_json
|
16733
|
+
JSON.dump(to_hash)
|
16734
|
+
end
|
16735
|
+
|
16736
|
+
def copy(incoming={})
|
16737
|
+
FreeShippingOrderPromotion.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
16738
|
+
end
|
16739
|
+
|
16740
|
+
def subtype_to_hash
|
16741
|
+
{
|
16742
|
+
:id => id,
|
16743
|
+
:order => order.to_hash,
|
16744
|
+
:key => key,
|
16745
|
+
:trigger => trigger.to_hash,
|
16746
|
+
:max => max.nil? ? nil : max.to_hash,
|
16747
|
+
:attributes => attributes
|
16748
|
+
}
|
16749
|
+
end
|
16750
|
+
|
16751
|
+
end
|
16752
|
+
|
16753
|
+
class FreeShippingOrderPromotionForm < OrderPromotionForm
|
16754
|
+
|
16755
|
+
attr_reader :trigger, :max, :attributes
|
16756
|
+
|
16757
|
+
def initialize(incoming={})
|
16758
|
+
super(:discriminator => OrderPromotionForm::Types::FREE_SHIPPING_ORDER_PROMOTION_FORM)
|
16759
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
16760
|
+
HttpClient::Preconditions.require_keys(opts, [:trigger], 'FreeShippingOrderPromotionForm')
|
16761
|
+
@trigger = (x = opts.delete(:trigger); x.is_a?(::Io::Flow::V0::Models::PromotionTriggerForm) ? x : ::Io::Flow::V0::Models::PromotionTriggerForm.new(x))
|
16762
|
+
@max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceForm) ? x : ::Io::Flow::V0::Models::PriceForm.new(x)))
|
16763
|
+
@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 })
|
16764
|
+
end
|
16765
|
+
|
16766
|
+
def to_json
|
16767
|
+
JSON.dump(to_hash)
|
16768
|
+
end
|
16769
|
+
|
16770
|
+
def copy(incoming={})
|
16771
|
+
FreeShippingOrderPromotionForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
16772
|
+
end
|
16773
|
+
|
16774
|
+
def subtype_to_hash
|
16775
|
+
{
|
16776
|
+
:trigger => trigger.to_hash,
|
16777
|
+
:max => max.nil? ? nil : max.to_hash,
|
16778
|
+
:attributes => attributes.nil? ? nil : attributes
|
16395
16779
|
}
|
16396
16780
|
end
|
16397
16781
|
|
@@ -21462,6 +21846,34 @@ module Io
|
|
21462
21846
|
|
21463
21847
|
end
|
21464
21848
|
|
21849
|
+
class OrderPromotionTrigger
|
21850
|
+
|
21851
|
+
attr_reader :type, :min
|
21852
|
+
|
21853
|
+
def initialize(incoming={})
|
21854
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
21855
|
+
HttpClient::Preconditions.require_keys(opts, [:type], 'OrderPromotionTrigger')
|
21856
|
+
@type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::PromotionTriggerType) ? x : ::Io::Flow::V0::Models::PromotionTriggerType.apply(x))
|
21857
|
+
@min = (x = opts.delete(:min); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
|
21858
|
+
end
|
21859
|
+
|
21860
|
+
def to_json
|
21861
|
+
JSON.dump(to_hash)
|
21862
|
+
end
|
21863
|
+
|
21864
|
+
def copy(incoming={})
|
21865
|
+
OrderPromotionTrigger.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
21866
|
+
end
|
21867
|
+
|
21868
|
+
def to_hash
|
21869
|
+
{
|
21870
|
+
:type => type.value,
|
21871
|
+
:min => min.nil? ? nil : min.to_hash
|
21872
|
+
}
|
21873
|
+
end
|
21874
|
+
|
21875
|
+
end
|
21876
|
+
|
21465
21877
|
# The order put form is used to upsert an order, providing the details on
|
21466
21878
|
# pricing and delivery options for destination and items/quantities specified.
|
21467
21879
|
class OrderPutForm
|
@@ -23645,7 +24057,7 @@ module Io
|
|
23645
24057
|
|
23646
24058
|
class PromotionTrigger
|
23647
24059
|
|
23648
|
-
attr_reader :type, :min, :remaining
|
24060
|
+
attr_reader :type, :min, :remaining
|
23649
24061
|
|
23650
24062
|
def initialize(incoming={})
|
23651
24063
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
@@ -23653,7 +24065,6 @@ module Io
|
|
23653
24065
|
@type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::PromotionTriggerType) ? x : ::Io::Flow::V0::Models::PromotionTriggerType.apply(x))
|
23654
24066
|
@min = (x = opts.delete(:min); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
|
23655
24067
|
@remaining = (x = opts.delete(:remaining); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
|
23656
|
-
@max = (x = opts.delete(:max); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x)))
|
23657
24068
|
end
|
23658
24069
|
|
23659
24070
|
def to_json
|
@@ -23668,8 +24079,35 @@ module Io
|
|
23668
24079
|
{
|
23669
24080
|
:type => type.value,
|
23670
24081
|
:min => min.to_hash,
|
23671
|
-
:remaining => remaining.to_hash
|
23672
|
-
|
24082
|
+
:remaining => remaining.to_hash
|
24083
|
+
}
|
24084
|
+
end
|
24085
|
+
|
24086
|
+
end
|
24087
|
+
|
24088
|
+
class PromotionTriggerForm
|
24089
|
+
|
24090
|
+
attr_reader :type, :min
|
24091
|
+
|
24092
|
+
def initialize(incoming={})
|
24093
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
24094
|
+
HttpClient::Preconditions.require_keys(opts, [:type], 'PromotionTriggerForm')
|
24095
|
+
@type = (x = opts.delete(:type); x.is_a?(::Io::Flow::V0::Models::PromotionTriggerType) ? x : ::Io::Flow::V0::Models::PromotionTriggerType.apply(x))
|
24096
|
+
@min = (x = opts.delete(:min); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PriceForm) ? x : ::Io::Flow::V0::Models::PriceForm.new(x)))
|
24097
|
+
end
|
24098
|
+
|
24099
|
+
def to_json
|
24100
|
+
JSON.dump(to_hash)
|
24101
|
+
end
|
24102
|
+
|
24103
|
+
def copy(incoming={})
|
24104
|
+
PromotionTriggerForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
24105
|
+
end
|
24106
|
+
|
24107
|
+
def to_hash
|
24108
|
+
{
|
24109
|
+
:type => type.value,
|
24110
|
+
:min => min.nil? ? nil : min.to_hash
|
23673
24111
|
}
|
23674
24112
|
end
|
23675
24113
|
|