peddler 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -28
  3. data/lib/mws.rb +2 -0
  4. data/lib/mws/cart_information/client.rb +7 -6
  5. data/lib/mws/customer_information/client.rb +6 -6
  6. data/lib/mws/feeds/client.rb +8 -8
  7. data/lib/mws/finances/client.rb +6 -6
  8. data/lib/mws/fulfillment_inbound_shipment/client.rb +41 -40
  9. data/lib/mws/fulfillment_inventory/client.rb +3 -3
  10. data/lib/mws/fulfillment_outbound_shipment/client.rb +18 -18
  11. data/lib/mws/merchant_fulfillment.rb +1 -0
  12. data/lib/mws/merchant_fulfillment/client.rb +88 -0
  13. data/lib/mws/off_amazon_payments/client.rb +203 -202
  14. data/lib/mws/orders/client.rb +6 -6
  15. data/lib/mws/products/client.rb +38 -38
  16. data/lib/mws/recommendations/client.rb +4 -4
  17. data/lib/mws/reports/client.rb +19 -17
  18. data/lib/mws/sellers/client.rb +2 -2
  19. data/lib/mws/subscriptions/client.rb +22 -22
  20. data/lib/mws/webstore/client.rb +8 -8
  21. data/lib/peddler/client.rb +7 -7
  22. data/lib/peddler/flat_file_parser.rb +1 -1
  23. data/lib/peddler/marketplace.rb +2 -2
  24. data/lib/peddler/operation.rb +7 -12
  25. data/lib/peddler/vcr_matcher.rb +5 -3
  26. data/lib/peddler/version.rb +2 -1
  27. data/test/helper.rb +11 -2
  28. data/test/integration/test_fulfillment_inbound_shipment.rb +1 -1
  29. data/test/integration/test_merchant_fulfillment.rb +11 -0
  30. data/test/integration/test_orders.rb +20 -0
  31. data/test/unit/mws/test_merchant_fulfillment_client.rb +83 -0
  32. data/test/unit/peddler/test_client.rb +12 -10
  33. data/test/unit/peddler/test_vcr_matcher.rb +3 -3
  34. data/test/vcr_cassettes/MerchantFulfillment.yml +195 -0
  35. data/test/vcr_cassettes/Orders.yml +1902 -5
  36. metadata +10 -2
@@ -9,13 +9,13 @@ module MWS
9
9
  # selling your inventory on Amazon's retail web site or through other retail
10
10
  # channels.
11
11
  class Client < ::Peddler::Client
12
- version "2010-10-01"
12
+ version '2010-10-01'
13
13
  path "/FulfillmentInventory/#{version}"
14
14
 
15
15
  # Returns information about the availability of a seller's inventory
16
16
  #
17
17
  # @see http://docs.developer.amazonservices.com/en_US/fba_inventory/FBAInventory_ListInventorySupply.html
18
- # @param opts [Hash]
18
+ # @param [Hash] opts
19
19
  # @option opts [Array<String>, String] :seller_skus
20
20
  # @option opts [String, #iso8601] :query_start_date_time
21
21
  # @option opts [String] :response_group
@@ -32,7 +32,7 @@ module MWS
32
32
  # seller's inventory
33
33
  #
34
34
  # @see http://docs.developer.amazonservices.com/en_US/fba_inventory/FBAInventory_ListInventorySupplyByNextToken.html
35
- # @param next_token [String]
35
+ # @param [String] next_token
36
36
  # @return [Peddler::XMLParser]
37
37
  def list_inventory_supply_by_next_token(next_token)
38
38
  operation('ListInventorySupplyByNextToken')
@@ -13,15 +13,15 @@ module MWS
13
13
  # on when they were fulfilled and by the fulfillment method associated with
14
14
  # them.
15
15
  class Client < ::Peddler::Client
16
- version "2010-10-01"
16
+ version '2010-10-01'
17
17
  path "/FulfillmentOutboundShipment/#{version}"
18
18
 
19
19
  # Lists fulfillment order previews
20
20
  #
21
21
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentPreview.html
22
- # @param address [Struct, Hash]
23
- # @param items [Array<Struct, Hash>]
24
- # @param opts [Hash]
22
+ # @param [Struct, Hash] address
23
+ # @param [Array<Struct, Hash>] items
24
+ # @param [Hash] opts
25
25
  # @option opts Array[String] :shipping_speed_categories
26
26
  # @option opts [Boolean] :include_cod_fulfillment_preview
27
27
  # @return [Peddler::XMLParser]
@@ -42,14 +42,14 @@ module MWS
42
42
  # Network inventory to a destination address
43
43
  #
44
44
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CreateFulfillmentOrder.html
45
- # @param seller_fulfillment_order_id [String]
46
- # @param displayable_order_id [String]
47
- # @param displayable_order_date_time [String, #iso8601]
48
- # @param displayable_order_comment [String]
49
- # @param shipping_speed_category [String]
50
- # @param destination_address [Struct, Hash]
51
- # @param items [Array<Struct, Hash>]
52
- # @param opts [Hash]
45
+ # @param [String] seller_fulfillment_order_id
46
+ # @param [String] displayable_order_id
47
+ # @param [String, #iso8601] displayable_order_date_time
48
+ # @param [String] displayable_order_comment
49
+ # @param [String] shipping_speed_category
50
+ # @param [Struct, Hash] destination_address
51
+ # @param [Array<Struct, Hash>] items
52
+ # @param [Hash] opts
53
53
  # @option opts [String] :fulfillment_action
54
54
  # @option opts [String] :fulfillment_policy
55
55
  # @option opts [Array<String>] :notification_email_list
@@ -82,8 +82,8 @@ module MWS
82
82
  # hold on it
83
83
  #
84
84
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_UpdateFulfillmentOrder.html
85
- # @param seller_fulfillment_order_id [String]
86
- # @param opts [Hash]
85
+ # @param [String] seller_fulfillment_order_id
86
+ # @param [Hash] opts
87
87
  # @option opts [String] :fulfillment_action
88
88
  # @option opts [String] :displayable_order_id
89
89
  # @option opts [String, #iso8601] :displayable_order_date_time
@@ -106,7 +106,7 @@ module MWS
106
106
  # Gets a fulfillment order
107
107
  #
108
108
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_GetFulfillmentOrder.html
109
- # @param seller_fulfillment_order_id [String]
109
+ # @param [String] seller_fulfillment_order_id
110
110
  # @return [Peddler::XMLParser]
111
111
  def get_fulfillment_order(seller_fulfillment_order_id)
112
112
  operation('GetFulfillmentOrder')
@@ -118,7 +118,7 @@ module MWS
118
118
  # Returns a list of fulfillment orders fulfilled on or after a date
119
119
  #
120
120
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrders.html
121
- # @param query_start_date_time [String, #iso8601]
121
+ # @param [String, #iso8601] query_start_date_time
122
122
  # @return [Peddler::XMLParser]
123
123
  def list_all_fulfillment_orders(query_start_date_time = nil)
124
124
  opts = query_start_date_time ? { 'QueryStartDateTime' => query_start_date_time } : {}
@@ -130,7 +130,7 @@ module MWS
130
130
  # Returns the next page of fulfillment orders
131
131
  #
132
132
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_ListAllFulfillmentOrdersByNextToken.html
133
- # @param next_token [String]
133
+ # @param [String] next_token
134
134
  # @return [Peddler::XMLParser]
135
135
  def list_all_fulfillment_orders_by_next_token(next_token)
136
136
  operation('ListAllFulfillmentOrdersByNextToken')
@@ -149,7 +149,7 @@ module MWS
149
149
  # order
150
150
  #
151
151
  # @see http://docs.developer.amazonservices.com/en_US/fba_outbound/FBAOutbound_CancelFulfillmentOrder.html
152
- # @param seller_fulfillment_order_id [String]
152
+ # @param [String] seller_fulfillment_order_id
153
153
  # @return [Peddler::XMLParser]
154
154
  def cancel_fulfillment_order(seller_fulfillment_order_id)
155
155
  operation('CancelFulfillmentOrder')
@@ -0,0 +1 @@
1
+ require 'mws/merchant_fulfillment/client'
@@ -0,0 +1,88 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module MerchantFulfillment
5
+ # The Merchant Fulfillment API provides programmatic access to Amazon's
6
+ # Shipping Services for sellers, including competitive rates from
7
+ # Amazon-partnered carriers. Sellers can find out what shipping service
8
+ # offers are available by submitting information about a proposed shipment,
9
+ # such as package size and weight, shipment origin, and delivery date
10
+ # requirements. Sellers can choose from the shipping service offers returned
11
+ # by Amazon, and then purchase shipping labels for fulfilling their orders.
12
+ class Client < ::Peddler::Client
13
+ version '2015-06-01'
14
+ path "/MerchantFulfillment/#{version}"
15
+
16
+ # Returns a list of shipping service offers that satisfy the shipment
17
+ # request details that you specify
18
+ #
19
+ # @see http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_GetEligibleShippingServices.html
20
+ # @param [Struct, Hash] shipment_request_details
21
+ # @return [Peddler::XMLParser]
22
+ def get_eligible_shipping_services(shipment_request_details)
23
+ operation('GetEligibleShippingServices')
24
+ .add('ShipmentRequestDetails' => shipment_request_details)
25
+
26
+ run
27
+ end
28
+
29
+ # Purchases shipping and returns PNG or PDF document data for a shipping
30
+ # label
31
+ #
32
+ # @see http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_CreateShipment.html
33
+ # @param [Struct, Hash] shipment_request_details
34
+ # @param [String] shipping_service_id
35
+ # @param [Hash] opts
36
+ # @option opts [String] :shipping_service_offer_id
37
+ # @return [Peddler::XMLParser]
38
+ def create_shipment(shipment_request_details, shipping_service_id, opts = {})
39
+ operation('CreateShipment')
40
+ .add(
41
+ 'ShipmentRequestDetails' => shipment_request_details,
42
+ 'ShippingServiceId' => shipping_service_id
43
+ )
44
+ .add(opts)
45
+
46
+ run
47
+ end
48
+
49
+ # Returns an existing shipment for the ShipmentId value that you specify
50
+ #
51
+ # @see http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_GetShipment.html
52
+ # @params [String] shipment_id
53
+ # @return [Peddler::XMLParser]
54
+ def get_shipment(shipment_id)
55
+ operation('GetShipment')
56
+ .add(
57
+ 'ShipmentId' => shipment_id
58
+ )
59
+
60
+ run
61
+ end
62
+
63
+ # Cancels an existing shipment and requests a refund for the ShipmentId
64
+ # value that you specify
65
+ #
66
+ # @see http://docs.developer.amazonservices.com/en_US/merch_fulfill/MerchFulfill_CancelShipment.html
67
+ # @params [String] shipment_id
68
+ # @return [Peddler::XMLParser]
69
+ def cancel_shipment(shipment_id)
70
+ operation('CancelShipment')
71
+ .add(
72
+ 'ShipmentId' => shipment_id
73
+ )
74
+
75
+ run
76
+ end
77
+
78
+ # Gets the operational status of the API
79
+ #
80
+ # @see http://docs.developer.amazonservices.com/en_US/merch_fulfill/MWS_GetServiceStatus.html
81
+ # @return [Peddler::XMLParser]
82
+ def get_service_status
83
+ operation('GetServiceStatus')
84
+ run
85
+ end
86
+ end
87
+ end
88
+ end
@@ -14,7 +14,7 @@ module MWS
14
14
  # Payments. You cannot use this API section to process payments for Amazon
15
15
  # Marketplace, Amazon Webstore, or Checkout by Amazon.
16
16
  class Client < ::Peddler::Client
17
- version "2013-01-01"
17
+ version '2013-01-01'
18
18
  path "/OffAmazonPayments/#{version}/"
19
19
 
20
20
  # Switches the client to the sandbox environment
@@ -26,160 +26,159 @@ module MWS
26
26
  self
27
27
  end
28
28
 
29
- # Creates an order reference for the given object
29
+ # Reserves a specified amount against the payment method(s) stored in the
30
+ # order reference
30
31
  #
31
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CreateOrderReferenceForId.html
32
- # @param id [String]
33
- # @param id_type [String]
34
- # @param opts [Hash]
35
- # @option opts [Boolean] :inherit_shipping_address
36
- # @option opts [Boolean] :confirm_now
32
+ # @see https://payments.amazon.com/documentation/apireference/201752010
33
+ # @param [String] amazon_order_reference_id
34
+ # @param [String] authorization_reference_id
35
+ # @param [Struct, Hash] authorization_amount
36
+ # @param [Hash] opts
37
+ # @option opts [String] :seller_authorization_note
38
+ # @option opts [Integer] :transaction_timeout
39
+ # @option opts [Boolean] :capture_now
40
+ # @option opts [String] :soft_descriptor
37
41
  # @return [Peddler::XMLParser]
38
- def create_order_reference_for_id(id, id_type, opts = {})
39
- operation('CreateOrderReferenceForId')
42
+ def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
43
+ operation('Authorize')
40
44
  .add(opts.update(
41
- 'Id' => id,
42
- 'IdType' => id_type
45
+ 'AmazonOrderReferenceId' => amazon_order_reference_id,
46
+ 'AuthorizationReferenceId' => authorization_reference_id,
47
+ 'AuthorizationAmount' => authorization_amount
43
48
  ))
44
49
 
45
50
  run
46
51
  end
47
52
 
48
- # Returns details about the Billing Agreement object and its current state
53
+ # Cancels a previously confirmed order reference
49
54
  #
50
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetBillingAgreementDetails.html
51
- # @param amazon_billing_agreement_id [String]
52
- # @param opts [Hash]
53
- # @option opts [String] :address_consent_token
55
+ # @see https://payments.amazon.com/documentation/apireference/201751990
56
+ # @param [String] amazon_order_reference_id
57
+ # @param [Hash] opts
58
+ # @option opts [String] cancelation_reason
54
59
  # @return [Peddler::XMLParser]
55
- def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
56
- operation('GetBillingAgreementDetails')
60
+ def cancel_order_reference(amazon_order_reference_id, opts = {})
61
+ operation('CancelOrderReference')
62
+ .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
63
+
64
+ run
65
+ end
66
+
67
+ # Captures funds from an authorized payment instrument
68
+ #
69
+ # @see https://payments.amazon.com/documentation/apireference/201752040
70
+ # @param [String] amazon_authorization_id
71
+ # @param [String] capture_reference_id
72
+ # @param [Struct, Hash] capture_amount
73
+ # @param [Hash] opts
74
+ # @option opts [String] :seller_capture_note
75
+ # @option opts [String] :soft_descriptor
76
+ # @return [Peddler::XMLParser]
77
+ def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
78
+ operation('Capture')
57
79
  .add(opts.update(
58
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
80
+ 'AmazonAuthorizationId' => amazon_authorization_id,
81
+ 'CaptureReferenceId' => capture_reference_id,
82
+ 'CaptureAmount' => capture_amount
59
83
  ))
60
84
 
61
85
  run
62
86
  end
63
87
 
64
- # Sets billing agreement details such as a description of the agreement
65
- # and other information about the seller
88
+ # Closes an authorization
66
89
  #
67
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetBillingAgreementDetails.html
68
- # @param amazon_billing_agreement_id [String]
69
- # @param billing_agreement_attributes [Struct, Hash]
90
+ # @see https://payments.amazon.com/documentation/apireference/201752070
91
+ # @param [String] amazon_authorization_id
92
+ # @param [Hash] opts
93
+ # @option opts [String] closure_reason
70
94
  # @return [Peddler::XMLParser]
71
- def set_billing_agreement_details(amazon_billing_agreement_id, billing_agreement_attributes)
72
- operation('SetBillingAgreementDetails')
73
- .add(
74
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
75
- 'BillingAgreementAttributes' => billing_agreement_attributes
76
- )
95
+ def close_authorization(amazon_authorization_id, opts = {})
96
+ operation('CloseAuthorization')
97
+ .add(opts.update('AmazonAuthorizationId' => amazon_authorization_id))
77
98
 
78
99
  run
79
100
  end
80
101
 
81
- # Confirms that the billing agreement is free of constraints and all
82
- # required information has been set on the billing agreement
102
+ # Confirms that an order reference has been fulfilled (fully or partially)
103
+ # and that you do not expect to create any new authorizations on this
104
+ # order reference
83
105
  #
84
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmBillingAgreement.html
85
- # @param amazon_billing_agreement_id [String]
106
+ # @see https://payments.amazon.com/documentation/apireference/201752000
107
+ # @param [String] amazon_order_reference_id
108
+ # @param [Hash] opts
109
+ # @option opts [String] closure_reason
86
110
  # @return [Peddler::XMLParser]
87
- def confirm_billing_agreement(amazon_billing_agreement_id)
88
- operation('ConfirmBillingAgreement')
89
- .add(
90
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
91
- )
111
+ def close_order_reference(amazon_order_reference_id, opts = {})
112
+ operation('CloseOrderReference')
113
+ .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
92
114
 
93
115
  run
94
116
  end
95
117
 
96
- # Validates the status of the BillingAgreement object and the payment
97
- # method associated with it
118
+ # Confirms that the order reference is free of constraints and all required
119
+ # information has been set on the order reference
98
120
  #
99
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ValidateBillingAgreement.html
100
- # @param amazon_billing_agreement_id [String]
121
+ # @see https://payments.amazon.com/documentation/apireference/201751980
122
+ # @param [String] amazon_order_reference_id
101
123
  # @return [Peddler::XMLParser]
102
- def validate_billing_agreement(amazon_billing_agreement_id)
103
- operation('ValidateBillingAgreement')
104
- .add(
105
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
106
- )
124
+ def confirm_order_reference(amazon_order_reference_id)
125
+ operation('ConfirmOrderReference')
126
+ .add('AmazonOrderReferenceId' => amazon_order_reference_id)
107
127
 
108
128
  run
109
129
  end
110
130
 
111
- # Reserves a specified amount against the payment method(s) stored in the
112
- # billing agreement
131
+ # Creates an order reference for the given object
113
132
  #
114
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_AuthorizeOnBillingAgreement.html
115
- # @param amazon_billing_agreement_id [String]
116
- # @param authorization_reference_id [String]
117
- # @param authorization_amount [Hash, Struct]
118
- # @param opts [Hash]
119
- # @option opts [String] :seller_authorization_note
120
- # @option opts [Integer] :transaction_timeout
121
- # @option opts [Boolean] :capture_now
122
- # @option opts [String] :soft_descriptor
123
- # @option opts [String] :seller_note
124
- # @option opts [String] :platform_id
125
- # @option opts [Hash, Struct] :seller_order_attributes
133
+ # @see https://payments.amazon.com/documentation/apireference/201751670
134
+ # @param [String] id
135
+ # @param [String] id_type
136
+ # @param [Hash] opts
126
137
  # @option opts [Boolean] :inherit_shipping_address
138
+ # @option opts [Boolean] :confirm_now
139
+ # @option opts [Struct, Hash] :order_reference_attributes
127
140
  # @return [Peddler::XMLParser]
128
- def authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, authorization_amount, opts = {})
129
- operation('AuthorizeOnBillingAgreement')
141
+ def create_order_reference_for_id(id, id_type, opts = {})
142
+ operation('CreateOrderReferenceForId')
130
143
  .add(opts.update(
131
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
132
- 'AuthorizationReferenceId' => authorization_reference_id,
133
- 'AuthorizationAmount' => authorization_amount
144
+ 'Id' => id,
145
+ 'IdType' => id_type
134
146
  ))
135
147
 
136
148
  run
137
149
  end
138
150
 
139
- # Confirms that you want to terminate the billing agreement with the buyer
140
- # and that you do not expect to create any new order references or
141
- # authorizations on this billing agreement
151
+ # Returns the status of a particular authorization and the total amount
152
+ # captured on the authorization
142
153
  #
143
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseBillingAgreement.html
144
- # @param amazon_billing_agreement_id [String]
145
- # @param opts [Hash]
146
- # @option opts [String] :closure_reason
154
+ # @see https://payments.amazon.com/documentation/apireference/201752030
155
+ # @param [String] amazon_authorization_id
147
156
  # @return [Peddler::XMLParser]
148
- def close_billing_agreement(amazon_billing_agreement_id, opts = {})
149
- operation('CloseBillingAgreement')
150
- .add(opts.update(
151
- 'AmazonBillingAgreementId' => amazon_billing_agreement_id
152
- ))
157
+ def get_authorization_details(amazon_authorization_id)
158
+ operation('GetAuthorizationDetails')
159
+ .add('AmazonAuthorizationId' => amazon_authorization_id)
153
160
 
154
161
  run
155
162
  end
156
163
 
157
- # Sets order reference details such as the order total and a description
158
- # for the order
164
+ # Returns the status of a particular capture and the total amount refunded
165
+ # on the capture
159
166
  #
160
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_SetOrderReferenceDetails.html
161
- # @param amazon_order_reference_id [String]
162
- # @param order_total [Struct, Hash]
163
- # @param opts [Hash]
164
- # @option opts [String] :platform_id
165
- # @option opts [String] :seller_note
166
- # @option opts [Struct, Hash] :seller_order_attributes
167
+ # @see https://payments.amazon.com/documentation/apireference/201752060
168
+ # @param [String] amazon_capture_id
167
169
  # @return [Peddler::XMLParser]
168
- def set_order_reference_details(amazon_order_reference_id, order_total, opts = {})
169
- operation('SetOrderReferenceDetails')
170
- .add(
171
- 'AmazonOrderReferenceId' => amazon_order_reference_id,
172
- 'OrderReferenceAttributes' => opts.update('OrderTotal' => order_total)
173
- )
170
+ def get_capture_details(amazon_capture_id)
171
+ operation('GetCaptureDetails')
172
+ .add('AmazonCaptureId' => amazon_capture_id)
174
173
 
175
174
  run
176
175
  end
177
176
 
178
177
  # Returns details about the Order Reference object and its current state
179
178
  #
180
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetOrderReferenceDetails.html
181
- # @param amazon_order_reference_id [String]
182
- # @param opts [Hash]
179
+ # @see https://payments.amazon.com/documentation/apireference/201751970
180
+ # @param [String] amazon_order_reference_id
181
+ # @param [Hash] opts
183
182
  # @option opts [String] address_consent_token
184
183
  # @return [Peddler::XMLParser]
185
184
  def get_order_reference_details(amazon_order_reference_id, opts = {})
@@ -189,173 +188,175 @@ module MWS
189
188
  run
190
189
  end
191
190
 
192
- # Confirms that the order reference is free of constraints and all required
193
- # information has been set on the order reference
194
- #
195
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_ConfirmOrderReference.html
196
- # @param amazon_order_reference_id [String]
197
- # @return [Peddler::XMLParser]
198
- def confirm_order_reference(amazon_order_reference_id)
199
- operation('ConfirmOrderReference')
200
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
201
-
202
- run
203
- end
204
-
205
- # Cancels a previously confirmed order reference
191
+ # Returns the status of a particular refund
206
192
  #
207
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CancelOrderReference.html
208
- # @param amazon_order_reference_id [String]
209
- # @param opts [Hash]
210
- # @option opts [String] cancelation_reason
193
+ # @see https://payments.amazon.com/documentation/apireference/201752100
194
+ # @param [String] amazon_refund_id
211
195
  # @return [Peddler::XMLParser]
212
- def cancel_order_reference(amazon_order_reference_id, opts = {})
213
- operation('CancelOrderReference')
214
- .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
196
+ def get_refund_details(amazon_refund_id)
197
+ operation('GetRefundDetails')
198
+ .add('AmazonRefundId' => amazon_refund_id)
215
199
 
216
200
  run
217
201
  end
218
202
 
219
- # Confirms that an order reference has been fulfilled (fully or partially)
220
- # and that you do not expect to create any new authorizations on this
221
- # order reference
203
+ # Gets the operational status of the API
222
204
  #
223
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseOrderReference.html
224
- # @param amazon_order_reference_id [String]
225
- # @param opts [Hash]
226
- # @option opts [String] closure_reason
205
+ # @see https://payments.amazon.com/documentation/apireference/201752110
227
206
  # @return [Peddler::XMLParser]
228
- def close_order_reference(amazon_order_reference_id, opts = {})
229
- operation('CloseOrderReference')
230
- .add(opts.update('AmazonOrderReferenceId' => amazon_order_reference_id))
231
-
207
+ def get_service_status
208
+ operation('GetServiceStatus')
232
209
  run
233
210
  end
234
211
 
235
- # Reserves a specified amount against the payment method(s) stored in the
236
- # order reference
212
+ # Refunds a previously captured amount
237
213
  #
238
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Authorize.html
239
- # @param amazon_order_reference_id [String]
240
- # @param authorization_reference_id [String]
241
- # @param authorization_amount [Struct, Hash]
242
- # @param opts [Hash]
243
- # @option opts [String] :seller_authorization_note
244
- # @option opts [Integer] :transaction_timeout
245
- # @option opts [Boolean] :capture_now
214
+ # @see https://payments.amazon.com/documentation/apireference/201752080
215
+ # @param [String] amazon_capture_id
216
+ # @param [String] refund_reference_id
217
+ # @param [Struct, Hash] refund_amount
218
+ # @param [Hash] opts
219
+ # @option opts [String] :seller_refund_note
246
220
  # @option opts [String] :soft_descriptor
247
221
  # @return [Peddler::XMLParser]
248
- def authorize(amazon_order_reference_id, authorization_reference_id, authorization_amount, opts = {})
249
- operation('Authorize')
222
+ def refund(amazon_capture_id, refund_reference_id, refund_amount, opts = {})
223
+ operation('Refund')
250
224
  .add(opts.update(
251
- 'AmazonOrderReferenceId' => amazon_order_reference_id,
252
- 'AuthorizationReferenceId' => authorization_reference_id,
253
- 'AuthorizationAmount' => authorization_amount
225
+ 'AmazonCaptureId' => amazon_capture_id,
226
+ 'RefundReferenceId' => refund_reference_id,
227
+ 'RefundAmount' => refund_amount
254
228
  ))
255
229
 
256
230
  run
257
231
  end
258
232
 
259
- # Returns the status of a particular authorization and the total amount
260
- # captured on the authorization
233
+ # Sets order reference details such as the order total and a description
234
+ # for the order
261
235
  #
262
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetAuthorizationDetails.html
263
- # @param amazon_authorization_id [String]
236
+ # @see https://payments.amazon.com/documentation/apireference/201751960
237
+ # @param [String] amazon_order_reference_id
238
+ # @param [Struct, Hash] order_total
239
+ # @param [Hash] opts
240
+ # @option opts [String] :platform_id
241
+ # @option opts [String] :seller_note
242
+ # @option opts [Struct, Hash] :seller_order_attributes
264
243
  # @return [Peddler::XMLParser]
265
- def get_authorization_details(amazon_authorization_id)
266
- operation('GetAuthorizationDetails')
267
- .add('AmazonAuthorizationId' => amazon_authorization_id)
244
+ def set_order_reference_details(amazon_order_reference_id, order_total, opts = {})
245
+ operation('SetOrderReferenceDetails')
246
+ .add(
247
+ 'AmazonOrderReferenceId' => amazon_order_reference_id,
248
+ 'OrderReferenceAttributes' => opts.update('OrderTotal' => order_total)
249
+ )
268
250
 
269
251
  run
270
252
  end
271
253
 
272
- # Captures funds from an authorized payment instrument
254
+ # Reserves a specified amount against the payment method(s) stored in the
255
+ # billing agreement
273
256
  #
274
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Capture.html
275
- # @param amazon_authorization_id [String]
276
- # @param capture_reference_id [String]
277
- # @param capture_amount [Struct, Hash]
278
- # @param opts [Hash]
279
- # @option opts [String] :seller_capture_note
257
+ # @see https://payments.amazon.com/documentation/apireference/201751940
258
+ # @param [String] amazon_billing_agreement_id
259
+ # @param [String] authorization_reference_id
260
+ # @param [Hash, Struct] authorization_amount
261
+ # @param [Hash] opts
262
+ # @option opts [String] :seller_authorization_note
263
+ # @option opts [Integer] :transaction_timeout
264
+ # @option opts [Boolean] :capture_now
280
265
  # @option opts [String] :soft_descriptor
266
+ # @option opts [String] :seller_note
267
+ # @option opts [String] :platform_id
268
+ # @option opts [Hash, Struct] :seller_order_attributes
269
+ # @option opts [Boolean] :inherit_shipping_address
281
270
  # @return [Peddler::XMLParser]
282
- def capture(amazon_authorization_id, capture_reference_id, capture_amount, opts = {})
283
- operation('Capture')
271
+ def authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, authorization_amount, opts = {})
272
+ operation('AuthorizeOnBillingAgreement')
284
273
  .add(opts.update(
285
- 'AmazonAuthorizationId' => amazon_authorization_id,
286
- 'CaptureReferenceId' => capture_reference_id,
287
- 'CaptureAmount' => capture_amount
274
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
275
+ 'AuthorizationReferenceId' => authorization_reference_id,
276
+ 'AuthorizationAmount' => authorization_amount
288
277
  ))
289
278
 
290
279
  run
291
280
  end
292
281
 
293
- # Returns the status of a particular capture and the total amount refunded
294
- # on the capture
282
+ # Confirms that you want to terminate the billing agreement with the buyer
283
+ # and that you do not expect to create any new order references or
284
+ # authorizations on this billing agreement
295
285
  #
296
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetCaptureDetails.html
297
- # @param amazon_capture_id [String]
286
+ # @see https://payments.amazon.com/documentation/apireference/201751950
287
+ # @param [String] amazon_billing_agreement_id
288
+ # @param [Hash] opts
289
+ # @option opts [String] :closure_reason
298
290
  # @return [Peddler::XMLParser]
299
- def get_capture_details(amazon_capture_id)
300
- operation('GetCaptureDetails')
301
- .add('AmazonCaptureId' => amazon_capture_id)
291
+ def close_billing_agreement(amazon_billing_agreement_id, opts = {})
292
+ operation('CloseBillingAgreement')
293
+ .add(opts.update(
294
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
295
+ ))
302
296
 
303
297
  run
304
298
  end
305
299
 
306
- # Closes an authorization
300
+ # Confirms that the billing agreement is free of constraints and all
301
+ # required information has been set on the billing agreement
307
302
  #
308
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_CloseAuthorization.html
309
- # @param amazon_authorization_id [String]
310
- # @param opts [Hash]
311
- # @option opts [String] closure_reason
303
+ # @see https://payments.amazon.com/documentation/apireference/201751710
304
+ # @param [String] amazon_billing_agreement_id
312
305
  # @return [Peddler::XMLParser]
313
- def close_authorization(amazon_authorization_id, opts = {})
314
- operation('CloseAuthorization')
315
- .add(opts.update('AmazonAuthorizationId' => amazon_authorization_id))
306
+ def confirm_billing_agreement(amazon_billing_agreement_id)
307
+ operation('ConfirmBillingAgreement')
308
+ .add(
309
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
310
+ )
316
311
 
317
312
  run
318
313
  end
319
314
 
320
- # Refunds a previously captured amount
315
+ # Returns details about the Billing Agreement object and its current state
321
316
  #
322
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_Refund.html
323
- # @param amazon_capture_id [String]
324
- # @param refund_reference_id [String]
325
- # @param refund_amount [Struct, Hash]
326
- # @param opts [Hash]
327
- # @option opts [String] :seller_refund_note
328
- # @option opts [String] :soft_descriptor
317
+ # @see https://payments.amazon.com/documentation/apireference/201751690
318
+ # @param [String] amazon_billing_agreement_id
319
+ # @param [Hash] opts
320
+ # @option opts [String] :address_consent_token
329
321
  # @return [Peddler::XMLParser]
330
- def refund(amazon_capture_id, refund_reference_id, refund_amount, opts = {})
331
- operation('Refund')
322
+ def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
323
+ operation('GetBillingAgreementDetails')
332
324
  .add(opts.update(
333
- 'AmazonCaptureId' => amazon_capture_id,
334
- 'RefundReferenceId' => refund_reference_id,
335
- 'RefundAmount' => refund_amount
325
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
336
326
  ))
337
327
 
338
328
  run
339
329
  end
340
330
 
341
- # Returns the status of a particular refund
331
+ # Sets billing agreement details such as a description of the agreement
332
+ # and other information about the seller
342
333
  #
343
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetRefundDetails.html
344
- # @param amazon_refund_id [String]
334
+ # @see https://payments.amazon.com/documentation/apireference/201751700
335
+ # @param [String] amazon_billing_agreement_id
336
+ # @param [Struct, Hash] billing_agreement_attributes
345
337
  # @return [Peddler::XMLParser]
346
- def get_refund_details(amazon_refund_id)
347
- operation('GetRefundDetails')
348
- .add('AmazonRefundId' => amazon_refund_id)
338
+ def set_billing_agreement_details(amazon_billing_agreement_id, billing_agreement_attributes)
339
+ operation('SetBillingAgreementDetails')
340
+ .add(
341
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id,
342
+ 'BillingAgreementAttributes' => billing_agreement_attributes
343
+ )
349
344
 
350
345
  run
351
346
  end
352
347
 
353
- # Gets the operational status of the API
348
+ # Validates the status of the BillingAgreement object and the payment
349
+ # method associated with it
354
350
  #
355
- # @see http://docs.developer.amazonservices.com/en_US/off_amazon_payments/OffAmazonPayments_GetServiceStatus.html
351
+ # @see https://payments.amazon.com/documentation/apireference/201751720
352
+ # @param [String] amazon_billing_agreement_id
356
353
  # @return [Peddler::XMLParser]
357
- def get_service_status
358
- operation('GetServiceStatus')
354
+ def validate_billing_agreement(amazon_billing_agreement_id)
355
+ operation('ValidateBillingAgreement')
356
+ .add(
357
+ 'AmazonBillingAgreementId' => amazon_billing_agreement_id
358
+ )
359
+
359
360
  run
360
361
  end
361
362
  end