flowcommerce 0.0.55 → 0.0.56
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 +379 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a643e3836082882233959441243e34cf95922c
|
4
|
+
data.tar.gz: b18df52a17747a1564f4a28292bf816c5e5c3b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f5876523eca03b728285d8da0ccacb0f383ca84f11afce4ef43766a105e42ea3539d5f403750f8567b16bb2f49fbc9d070f0aff1d71e716bcaf523ba9625f63
|
7
|
+
data.tar.gz: c5466bddaa18dbc84982edbefc32efa8b7dd792603725ea792c4b57b90b7725ae61a970b4c2e49bc82f1fbadedb8b6beef55a0874b7d119382e98b52cfc48183
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Generated by apidoc - http://www.apidoc.me
|
2
|
-
# Service version: 0.1.
|
3
|
-
# apidoc:0.11.37 http://www.apidoc.me/flow/api/0.1.
|
2
|
+
# Service version: 0.1.54
|
3
|
+
# apidoc:0.11.37 http://www.apidoc.me/flow/api/0.1.54/ruby_client
|
4
4
|
|
5
5
|
require 'cgi'
|
6
6
|
require 'net/http'
|
@@ -25,8 +25,8 @@ 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.37 http://www.apidoc.me/flow/api/0.1.
|
29
|
-
VERSION = '0.1.
|
28
|
+
USER_AGENT = 'apidoc:0.11.37 http://www.apidoc.me/flow/api/0.1.54/ruby_client' unless defined?(Constants::USER_AGENT)
|
29
|
+
VERSION = '0.1.54' unless defined?(Constants::VERSION)
|
30
30
|
VERSION_MAJOR = 0 unless defined?(VERSION_MAJOR)
|
31
31
|
|
32
32
|
end
|
@@ -5419,6 +5419,199 @@ module Io
|
|
5419
5419
|
|
5420
5420
|
end
|
5421
5421
|
|
5422
|
+
class OrderPriceDetailComponentKey
|
5423
|
+
|
5424
|
+
attr_reader :value
|
5425
|
+
|
5426
|
+
def initialize(value)
|
5427
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
5428
|
+
end
|
5429
|
+
|
5430
|
+
# Returns the instance of OrderPriceDetailComponentKey for this value, creating a new instance for an unknown value
|
5431
|
+
def OrderPriceDetailComponentKey.apply(value)
|
5432
|
+
if value.instance_of?(OrderPriceDetailComponentKey)
|
5433
|
+
value
|
5434
|
+
else
|
5435
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
5436
|
+
value.nil? ? nil : (from_string(value) || OrderPriceDetailComponentKey.new(value))
|
5437
|
+
end
|
5438
|
+
end
|
5439
|
+
|
5440
|
+
# Returns the instance of OrderPriceDetailComponentKey for this value, or nil if not found
|
5441
|
+
def OrderPriceDetailComponentKey.from_string(value)
|
5442
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
5443
|
+
OrderPriceDetailComponentKey.ALL.find { |v| v.value == value }
|
5444
|
+
end
|
5445
|
+
|
5446
|
+
def OrderPriceDetailComponentKey.ALL
|
5447
|
+
@@all ||= [OrderPriceDetailComponentKey.adjustment, OrderPriceDetailComponentKey.tax_deminimus, OrderPriceDetailComponentKey.duty_deminimus, OrderPriceDetailComponentKey.duties_item_price, OrderPriceDetailComponentKey.duties_freight, OrderPriceDetailComponentKey.duties_insurance, OrderPriceDetailComponentKey.vat_item_price, OrderPriceDetailComponentKey.vat_freight, OrderPriceDetailComponentKey.vat_insurance, OrderPriceDetailComponentKey.vat_duties_item_price, OrderPriceDetailComponentKey.vat_duties_freight, OrderPriceDetailComponentKey.vat_duties_insurance, OrderPriceDetailComponentKey.item_price, OrderPriceDetailComponentKey.rounding, OrderPriceDetailComponentKey.insurance, OrderPriceDetailComponentKey.shipping, OrderPriceDetailComponentKey.order_discount]
|
5448
|
+
end
|
5449
|
+
|
5450
|
+
# A general purpose adjustment applied to the order.
|
5451
|
+
def OrderPriceDetailComponentKey.adjustment
|
5452
|
+
@@_adjustment ||= OrderPriceDetailComponentKey.new('adjustment')
|
5453
|
+
end
|
5454
|
+
|
5455
|
+
# An adjustment based on whether the tax deminimus applies to the order.
|
5456
|
+
def OrderPriceDetailComponentKey.tax_deminimus
|
5457
|
+
@@_tax_deminimus ||= OrderPriceDetailComponentKey.new('tax_deminimus')
|
5458
|
+
end
|
5459
|
+
|
5460
|
+
# An adjustment based on whether the duty deminimus applies to the order.
|
5461
|
+
def OrderPriceDetailComponentKey.duty_deminimus
|
5462
|
+
@@_duty_deminimus ||= OrderPriceDetailComponentKey.new('duty_deminimus')
|
5463
|
+
end
|
5464
|
+
|
5465
|
+
# The VAT owed on the price of the order's items, including any added margins
|
5466
|
+
# and rounding.
|
5467
|
+
def OrderPriceDetailComponentKey.duties_item_price
|
5468
|
+
@@_duties_item_price ||= OrderPriceDetailComponentKey.new('duties_item_price')
|
5469
|
+
end
|
5470
|
+
|
5471
|
+
# The duty owed on the freight cost of the order.
|
5472
|
+
def OrderPriceDetailComponentKey.duties_freight
|
5473
|
+
@@_duties_freight ||= OrderPriceDetailComponentKey.new('duties_freight')
|
5474
|
+
end
|
5475
|
+
|
5476
|
+
# The duty owed on the insurance cost of the order.
|
5477
|
+
def OrderPriceDetailComponentKey.duties_insurance
|
5478
|
+
@@_duties_insurance ||= OrderPriceDetailComponentKey.new('duties_insurance')
|
5479
|
+
end
|
5480
|
+
|
5481
|
+
# The VAT owed on the price of the order's items, including any added margins
|
5482
|
+
# and rounding.
|
5483
|
+
def OrderPriceDetailComponentKey.vat_item_price
|
5484
|
+
@@_vat_item_price ||= OrderPriceDetailComponentKey.new('vat_item_price')
|
5485
|
+
end
|
5486
|
+
|
5487
|
+
# The VAT owed on the freight cost of the order.
|
5488
|
+
def OrderPriceDetailComponentKey.vat_freight
|
5489
|
+
@@_vat_freight ||= OrderPriceDetailComponentKey.new('vat_freight')
|
5490
|
+
end
|
5491
|
+
|
5492
|
+
# The VAT owed on the insurance cost of the order.
|
5493
|
+
def OrderPriceDetailComponentKey.vat_insurance
|
5494
|
+
@@_vat_insurance ||= OrderPriceDetailComponentKey.new('vat_insurance')
|
5495
|
+
end
|
5496
|
+
|
5497
|
+
# The VAT owed on the duties on the price of the order's items, including any
|
5498
|
+
# added margins and rounding.
|
5499
|
+
def OrderPriceDetailComponentKey.vat_duties_item_price
|
5500
|
+
@@_vat_duties_item_price ||= OrderPriceDetailComponentKey.new('vat_duties_item_price')
|
5501
|
+
end
|
5502
|
+
|
5503
|
+
# The VAT owed on the duties on the freight cost of the order.
|
5504
|
+
def OrderPriceDetailComponentKey.vat_duties_freight
|
5505
|
+
@@_vat_duties_freight ||= OrderPriceDetailComponentKey.new('vat_duties_freight')
|
5506
|
+
end
|
5507
|
+
|
5508
|
+
# The VAT owed on the duties on the insurance cost of the order.
|
5509
|
+
def OrderPriceDetailComponentKey.vat_duties_insurance
|
5510
|
+
@@_vat_duties_insurance ||= OrderPriceDetailComponentKey.new('vat_duties_insurance')
|
5511
|
+
end
|
5512
|
+
|
5513
|
+
# The sum of the price of the order's items with their currency margins, percent
|
5514
|
+
# margins, and fixed margins included.
|
5515
|
+
def OrderPriceDetailComponentKey.item_price
|
5516
|
+
@@_item_price ||= OrderPriceDetailComponentKey.new('item_price')
|
5517
|
+
end
|
5518
|
+
|
5519
|
+
# The sum of any rounding applied to the order's items.
|
5520
|
+
def OrderPriceDetailComponentKey.rounding
|
5521
|
+
@@_rounding ||= OrderPriceDetailComponentKey.new('rounding')
|
5522
|
+
end
|
5523
|
+
|
5524
|
+
# The insurance cost for the order.
|
5525
|
+
def OrderPriceDetailComponentKey.insurance
|
5526
|
+
@@_insurance ||= OrderPriceDetailComponentKey.new('insurance')
|
5527
|
+
end
|
5528
|
+
|
5529
|
+
# The shipping cost for the order.
|
5530
|
+
def OrderPriceDetailComponentKey.shipping
|
5531
|
+
@@_shipping ||= OrderPriceDetailComponentKey.new('shipping')
|
5532
|
+
end
|
5533
|
+
|
5534
|
+
# A discount applied to the entire order.
|
5535
|
+
def OrderPriceDetailComponentKey.order_discount
|
5536
|
+
@@_order_discount ||= OrderPriceDetailComponentKey.new('order_discount')
|
5537
|
+
end
|
5538
|
+
|
5539
|
+
def to_hash
|
5540
|
+
value
|
5541
|
+
end
|
5542
|
+
|
5543
|
+
end
|
5544
|
+
|
5545
|
+
class OrderPriceDetailKey
|
5546
|
+
|
5547
|
+
attr_reader :value
|
5548
|
+
|
5549
|
+
def initialize(value)
|
5550
|
+
@value = HttpClient::Preconditions.assert_class('value', value, String)
|
5551
|
+
end
|
5552
|
+
|
5553
|
+
# Returns the instance of OrderPriceDetailKey for this value, creating a new instance for an unknown value
|
5554
|
+
def OrderPriceDetailKey.apply(value)
|
5555
|
+
if value.instance_of?(OrderPriceDetailKey)
|
5556
|
+
value
|
5557
|
+
else
|
5558
|
+
HttpClient::Preconditions.assert_class_or_nil('value', value, String)
|
5559
|
+
value.nil? ? nil : (from_string(value) || OrderPriceDetailKey.new(value))
|
5560
|
+
end
|
5561
|
+
end
|
5562
|
+
|
5563
|
+
# Returns the instance of OrderPriceDetailKey for this value, or nil if not found
|
5564
|
+
def OrderPriceDetailKey.from_string(value)
|
5565
|
+
HttpClient::Preconditions.assert_class('value', value, String)
|
5566
|
+
OrderPriceDetailKey.ALL.find { |v| v.value == value }
|
5567
|
+
end
|
5568
|
+
|
5569
|
+
def OrderPriceDetailKey.ALL
|
5570
|
+
@@all ||= [OrderPriceDetailKey.adjustment, OrderPriceDetailKey.subtotal, OrderPriceDetailKey.vat, OrderPriceDetailKey.duty, OrderPriceDetailKey.shipping, OrderPriceDetailKey.insurance, OrderPriceDetailKey.discount]
|
5571
|
+
end
|
5572
|
+
|
5573
|
+
# The details of any adjustments made to the order.
|
5574
|
+
def OrderPriceDetailKey.adjustment
|
5575
|
+
@@_adjustment ||= OrderPriceDetailKey.new('adjustment')
|
5576
|
+
end
|
5577
|
+
|
5578
|
+
# The details of the subtotal for the order, including item prices, margins, and
|
5579
|
+
# rounding.
|
5580
|
+
def OrderPriceDetailKey.subtotal
|
5581
|
+
@@_subtotal ||= OrderPriceDetailKey.new('subtotal')
|
5582
|
+
end
|
5583
|
+
|
5584
|
+
# The details of any VAT owed on the order.
|
5585
|
+
def OrderPriceDetailKey.vat
|
5586
|
+
@@_vat ||= OrderPriceDetailKey.new('vat')
|
5587
|
+
end
|
5588
|
+
|
5589
|
+
# The details of any duties owed on the order.
|
5590
|
+
def OrderPriceDetailKey.duty
|
5591
|
+
@@_duty ||= OrderPriceDetailKey.new('duty')
|
5592
|
+
end
|
5593
|
+
|
5594
|
+
# The details of shipping costs for the order.
|
5595
|
+
def OrderPriceDetailKey.shipping
|
5596
|
+
@@_shipping ||= OrderPriceDetailKey.new('shipping')
|
5597
|
+
end
|
5598
|
+
|
5599
|
+
# The details of insurance costs for the order.
|
5600
|
+
def OrderPriceDetailKey.insurance
|
5601
|
+
@@_insurance ||= OrderPriceDetailKey.new('insurance')
|
5602
|
+
end
|
5603
|
+
|
5604
|
+
# The details of any discount applied to the order.
|
5605
|
+
def OrderPriceDetailKey.discount
|
5606
|
+
@@_discount ||= OrderPriceDetailKey.new('discount')
|
5607
|
+
end
|
5608
|
+
|
5609
|
+
def to_hash
|
5610
|
+
value
|
5611
|
+
end
|
5612
|
+
|
5613
|
+
end
|
5614
|
+
|
5422
5615
|
class PricingLevySetting
|
5423
5616
|
|
5424
5617
|
attr_reader :value
|
@@ -12295,6 +12488,116 @@ module Io
|
|
12295
12488
|
|
12296
12489
|
end
|
12297
12490
|
|
12491
|
+
# Represents a top-level order price detail, e.g. 'Subtotal' or 'VAT'.
|
12492
|
+
class OrderPriceDetail
|
12493
|
+
|
12494
|
+
attr_reader :key, :currency, :amount, :label, :components
|
12495
|
+
|
12496
|
+
def initialize(incoming={})
|
12497
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
12498
|
+
HttpClient::Preconditions.require_keys(opts, [:key, :currency, :amount, :label, :components], 'OrderPriceDetail')
|
12499
|
+
@key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailKey.apply(x))
|
12500
|
+
@currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
|
12501
|
+
@amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
|
12502
|
+
@label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
|
12503
|
+
@components = HttpClient::Preconditions.assert_class('components', opts.delete(:components), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailComponent) ? x : ::Io::Flow::V0::Models::OrderPriceDetailComponent.new(x)) }
|
12504
|
+
end
|
12505
|
+
|
12506
|
+
def to_json
|
12507
|
+
JSON.dump(to_hash)
|
12508
|
+
end
|
12509
|
+
|
12510
|
+
def copy(incoming={})
|
12511
|
+
OrderPriceDetail.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
12512
|
+
end
|
12513
|
+
|
12514
|
+
def to_hash
|
12515
|
+
{
|
12516
|
+
:key => key.value,
|
12517
|
+
:currency => currency,
|
12518
|
+
:amount => amount,
|
12519
|
+
:label => label,
|
12520
|
+
:components => components.map { |o| o.to_hash }
|
12521
|
+
}
|
12522
|
+
end
|
12523
|
+
|
12524
|
+
end
|
12525
|
+
|
12526
|
+
class OrderPriceDetailComponent
|
12527
|
+
|
12528
|
+
attr_reader :key, :currency, :amount, :label, :base
|
12529
|
+
|
12530
|
+
def initialize(incoming={})
|
12531
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
12532
|
+
HttpClient::Preconditions.require_keys(opts, [:key, :currency, :amount, :label, :base], 'OrderPriceDetailComponent')
|
12533
|
+
@key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailComponentKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailComponentKey.apply(x))
|
12534
|
+
@currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
|
12535
|
+
@amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
|
12536
|
+
@label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
|
12537
|
+
@base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
|
12538
|
+
end
|
12539
|
+
|
12540
|
+
def to_json
|
12541
|
+
JSON.dump(to_hash)
|
12542
|
+
end
|
12543
|
+
|
12544
|
+
def copy(incoming={})
|
12545
|
+
OrderPriceDetailComponent.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
12546
|
+
end
|
12547
|
+
|
12548
|
+
def to_hash
|
12549
|
+
{
|
12550
|
+
:key => key.value,
|
12551
|
+
:currency => currency,
|
12552
|
+
:amount => amount,
|
12553
|
+
:label => label,
|
12554
|
+
:base => base.to_hash
|
12555
|
+
}
|
12556
|
+
end
|
12557
|
+
|
12558
|
+
end
|
12559
|
+
|
12560
|
+
# Represents the price details for the entire order.
|
12561
|
+
class OrderPriceDetails
|
12562
|
+
|
12563
|
+
attr_reader :subtotal, :vat, :duty, :shipping, :insurance, :discounts, :adjustments, :total
|
12564
|
+
|
12565
|
+
def initialize(incoming={})
|
12566
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
12567
|
+
HttpClient::Preconditions.require_keys(opts, [:subtotal, :vat, :duty, :shipping, :insurance, :discounts, :adjustments, :total], 'OrderPriceDetails')
|
12568
|
+
@subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12569
|
+
@vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12570
|
+
@duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12571
|
+
@shipping = (x = opts.delete(:shipping); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12572
|
+
@insurance = (x = opts.delete(:insurance); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12573
|
+
@discounts = (x = opts.delete(:discounts); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12574
|
+
@adjustments = (x = opts.delete(:adjustments); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x))
|
12575
|
+
@total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x))
|
12576
|
+
end
|
12577
|
+
|
12578
|
+
def to_json
|
12579
|
+
JSON.dump(to_hash)
|
12580
|
+
end
|
12581
|
+
|
12582
|
+
def copy(incoming={})
|
12583
|
+
OrderPriceDetails.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
12584
|
+
end
|
12585
|
+
|
12586
|
+
def to_hash
|
12587
|
+
{
|
12588
|
+
:subtotal => subtotal.to_hash,
|
12589
|
+
:vat => vat.to_hash,
|
12590
|
+
:duty => duty.to_hash,
|
12591
|
+
:shipping => shipping.to_hash,
|
12592
|
+
:insurance => insurance.to_hash,
|
12593
|
+
:discounts => discounts.to_hash,
|
12594
|
+
:adjustments => adjustments.to_hash,
|
12595
|
+
:total => total.to_hash
|
12596
|
+
}
|
12597
|
+
end
|
12598
|
+
|
12599
|
+
end
|
12600
|
+
|
12298
12601
|
# The order put form is used to upsert an order, providing the details on
|
12299
12602
|
# pricing and delivery options for destination and items/quantities specified.
|
12300
12603
|
class OrderPutForm
|
@@ -13125,6 +13428,38 @@ module Io
|
|
13125
13428
|
|
13126
13429
|
end
|
13127
13430
|
|
13431
|
+
class PriceWithBase
|
13432
|
+
|
13433
|
+
attr_reader :currency, :amount, :label, :base
|
13434
|
+
|
13435
|
+
def initialize(incoming={})
|
13436
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13437
|
+
HttpClient::Preconditions.require_keys(opts, [:currency, :amount, :label, :base], 'PriceWithBase')
|
13438
|
+
@currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
|
13439
|
+
@amount = HttpClient::Preconditions.assert_class('amount', opts.delete(:amount), Numeric)
|
13440
|
+
@label = HttpClient::Preconditions.assert_class('label', opts.delete(:label), String)
|
13441
|
+
@base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))
|
13442
|
+
end
|
13443
|
+
|
13444
|
+
def to_json
|
13445
|
+
JSON.dump(to_hash)
|
13446
|
+
end
|
13447
|
+
|
13448
|
+
def copy(incoming={})
|
13449
|
+
PriceWithBase.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
13450
|
+
end
|
13451
|
+
|
13452
|
+
def to_hash
|
13453
|
+
{
|
13454
|
+
:currency => currency,
|
13455
|
+
:amount => amount,
|
13456
|
+
:label => label,
|
13457
|
+
:base => base.to_hash
|
13458
|
+
}
|
13459
|
+
end
|
13460
|
+
|
13461
|
+
end
|
13462
|
+
|
13128
13463
|
# Pricing determines how the item price is calculated when items are requests
|
13129
13464
|
# via the experience.
|
13130
13465
|
class Pricing
|
@@ -13599,19 +13934,22 @@ module Io
|
|
13599
13934
|
|
13600
13935
|
end
|
13601
13936
|
|
13602
|
-
# Refunds
|
13937
|
+
# Refunds can be created against either a specific capture or an authorization
|
13938
|
+
# (in which case we will select 1 or more specific captures against which to
|
13939
|
+
# execute the refund).
|
13603
13940
|
class Refund
|
13604
13941
|
|
13605
|
-
attr_reader :id, :key, :
|
13942
|
+
attr_reader :id, :key, :authorization, :amount, :currency, :captures
|
13606
13943
|
|
13607
13944
|
def initialize(incoming={})
|
13608
13945
|
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13609
|
-
HttpClient::Preconditions.require_keys(opts, [:id, :key, :
|
13946
|
+
HttpClient::Preconditions.require_keys(opts, [:id, :key, :authorization, :amount, :currency, :captures], 'Refund')
|
13610
13947
|
@id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
|
13611
13948
|
@key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
|
13612
|
-
@
|
13949
|
+
@authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::AuthorizationReference) ? x : ::Io::Flow::V0::Models::AuthorizationReference.new(x))
|
13613
13950
|
@amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
|
13614
13951
|
@currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
|
13952
|
+
@captures = HttpClient::Preconditions.assert_class('captures', opts.delete(:captures), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::RefundCapture) ? x : ::Io::Flow::V0::Models::RefundCapture.new(x)) }
|
13615
13953
|
end
|
13616
13954
|
|
13617
13955
|
def to_json
|
@@ -13626,9 +13964,40 @@ module Io
|
|
13626
13964
|
{
|
13627
13965
|
:id => id,
|
13628
13966
|
:key => key,
|
13629
|
-
:
|
13967
|
+
:authorization => authorization.to_hash,
|
13630
13968
|
:amount => amount,
|
13631
|
-
:currency => currency
|
13969
|
+
:currency => currency,
|
13970
|
+
:captures => captures.map { |o| o.to_hash }
|
13971
|
+
}
|
13972
|
+
end
|
13973
|
+
|
13974
|
+
end
|
13975
|
+
|
13976
|
+
# Refund captures provide the detailed information on the amount refunded
|
13977
|
+
# against a specific capture
|
13978
|
+
class RefundCapture
|
13979
|
+
|
13980
|
+
attr_reader :capture, :amount
|
13981
|
+
|
13982
|
+
def initialize(incoming={})
|
13983
|
+
opts = HttpClient::Helper.symbolize_keys(incoming)
|
13984
|
+
HttpClient::Preconditions.require_keys(opts, [:capture, :amount], 'RefundCapture')
|
13985
|
+
@capture = (x = opts.delete(:capture); x.is_a?(::Io::Flow::V0::Models::Capture) ? x : ::Io::Flow::V0::Models::Capture.new(x))
|
13986
|
+
@amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
|
13987
|
+
end
|
13988
|
+
|
13989
|
+
def to_json
|
13990
|
+
JSON.dump(to_hash)
|
13991
|
+
end
|
13992
|
+
|
13993
|
+
def copy(incoming={})
|
13994
|
+
RefundCapture.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
|
13995
|
+
end
|
13996
|
+
|
13997
|
+
def to_hash
|
13998
|
+
{
|
13999
|
+
:capture => capture.to_hash,
|
14000
|
+
:amount => amount
|
13632
14001
|
}
|
13633
14002
|
end
|
13634
14003
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowcommerce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.56
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flow Commerce, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|