peddler 2.1.0 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of peddler might be problematic. Click here for more details.

Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -41
  3. data/lib/mws.rb +2 -1
  4. data/lib/mws/easy_ship.rb +3 -0
  5. data/lib/mws/easy_ship/client.rb +93 -0
  6. data/lib/mws/fulfillment_inbound_shipment/client.rb +2 -2
  7. data/lib/mws/fulfillment_outbound_shipment/client.rb +1 -1
  8. data/lib/mws/orders/client.rb +7 -9
  9. data/lib/mws/reports/client.rb +9 -0
  10. data/lib/mws/shipment_invoicing.rb +3 -0
  11. data/lib/mws/shipment_invoicing/client.rb +74 -0
  12. data/lib/peddler/client.rb +18 -15
  13. data/lib/peddler/errors/builder.rb +7 -2
  14. data/lib/peddler/errors/class_generator.rb +7 -2
  15. data/lib/peddler/errors/error.rb +6 -2
  16. data/lib/peddler/errors/parser.rb +1 -1
  17. data/lib/peddler/flat_file_parser.rb +6 -4
  18. data/lib/peddler/headers.rb +53 -1
  19. data/lib/peddler/marketplace.rb +24 -22
  20. data/lib/peddler/operation.rb +17 -11
  21. data/lib/peddler/parser.rb +1 -1
  22. data/lib/peddler/structured_list.rb +1 -1
  23. data/lib/peddler/vcr_matcher.rb +7 -7
  24. data/lib/peddler/version.rb +1 -1
  25. data/lib/peddler/xml_parser.rb +1 -1
  26. data/lib/peddler/xml_response_parser.rb +3 -2
  27. metadata +15 -150
  28. data/lib/mws/off_amazon_payments/client.rb +0 -362
  29. data/lib/mws/reports/parser.rb +0 -35
  30. data/test/credentials.rb +0 -23
  31. data/test/helper.rb +0 -15
  32. data/test/integration/test_errors.rb +0 -25
  33. data/test/integration/test_feeds.rb +0 -37
  34. data/test/integration/test_fulfillment_inbound_shipment.rb +0 -35
  35. data/test/integration/test_fulfillment_inventory.rb +0 -20
  36. data/test/integration/test_fulfillment_outbound_shipment.rb +0 -13
  37. data/test/integration/test_merchant_fulfillment.rb +0 -69
  38. data/test/integration/test_multibyte_queries.rb +0 -17
  39. data/test/integration/test_mws_headers.rb +0 -16
  40. data/test/integration/test_off_amazon_payments.rb +0 -13
  41. data/test/integration/test_orders.rb +0 -30
  42. data/test/integration/test_products.rb +0 -97
  43. data/test/integration/test_recommendations.rb +0 -20
  44. data/test/integration/test_reports.rb +0 -51
  45. data/test/integration/test_sellers.rb +0 -13
  46. data/test/integration/test_subscriptions.rb +0 -27
  47. data/test/integration_helper.rb +0 -53
  48. data/test/mws.yml +0 -36
  49. data/test/mws.yml.example +0 -32
  50. data/test/null_client.rb +0 -25
  51. data/test/recorder.rb +0 -39
  52. data/test/unit/mws/test_feeds_client.rb +0 -103
  53. data/test/unit/mws/test_finances_client.rb +0 -74
  54. data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +0 -426
  55. data/test/unit/mws/test_fulfillment_inventory_client.rb +0 -48
  56. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +0 -202
  57. data/test/unit/mws/test_merchant_fulfillment_client.rb +0 -109
  58. data/test/unit/mws/test_off_amazon_payments_client.rb +0 -286
  59. data/test/unit/mws/test_orders_client.rb +0 -111
  60. data/test/unit/mws/test_products_client.rb +0 -248
  61. data/test/unit/mws/test_recommendations_client.rb +0 -62
  62. data/test/unit/mws/test_reports_client.rb +0 -209
  63. data/test/unit/mws/test_sellers_client.rb +0 -47
  64. data/test/unit/mws/test_subscriptions_client.rb +0 -182
  65. data/test/unit/peddler/errors/test_builder.rb +0 -65
  66. data/test/unit/peddler/errors/test_class_generator.rb +0 -18
  67. data/test/unit/peddler/errors/test_error.rb +0 -33
  68. data/test/unit/peddler/errors/test_parser.rb +0 -44
  69. data/test/unit/peddler/test_client.rb +0 -203
  70. data/test/unit/peddler/test_flat_file_parser.rb +0 -102
  71. data/test/unit/peddler/test_headers.rb +0 -55
  72. data/test/unit/peddler/test_marketplace.rb +0 -47
  73. data/test/unit/peddler/test_operation.rb +0 -87
  74. data/test/unit/peddler/test_parser.rb +0 -36
  75. data/test/unit/peddler/test_structured_list.rb +0 -39
  76. data/test/unit/peddler/test_vcr_matcher.rb +0 -55
  77. data/test/unit/peddler/test_xml_parser.rb +0 -37
  78. data/test/unit/peddler/test_xml_response_parser.rb +0 -39
  79. data/test/unit/test_mws.rb +0 -11
  80. data/test/vcr_cassettes/CartInformation.yml +0 -433
  81. data/test/vcr_cassettes/CustomerInformation.yml +0 -433
  82. data/test/vcr_cassettes/Errors.yml +0 -885
  83. data/test/vcr_cassettes/Feeds.yml +0 -9957
  84. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +0 -6166
  85. data/test/vcr_cassettes/FulfillmentInventory.yml +0 -850
  86. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +0 -433
  87. data/test/vcr_cassettes/MWSHeaders.yml +0 -2964
  88. data/test/vcr_cassettes/MerchantFulfillment.yml +0 -753
  89. data/test/vcr_cassettes/MultibyteQueries.yml +0 -437
  90. data/test/vcr_cassettes/OffAmazonPayments.yml +0 -433
  91. data/test/vcr_cassettes/Orders.yml +0 -4740
  92. data/test/vcr_cassettes/PeddlerVCRMatcher.yml +0 -41
  93. data/test/vcr_cassettes/Products.yml +0 -7139
  94. data/test/vcr_cassettes/Recommendations.yml +0 -3145
  95. data/test/vcr_cassettes/Reports.yml +0 -5549
  96. data/test/vcr_cassettes/Sellers.yml +0 -433
  97. data/test/vcr_cassettes/Subscriptions.yml +0 -1529
@@ -4,7 +4,7 @@ require 'peddler/flat_file_parser'
4
4
  require 'peddler/xml_response_parser'
5
5
 
6
6
  module Peddler
7
- # @api private
7
+ # @!visibility private
8
8
  module Parser
9
9
  class << self
10
10
  # We're massaging data produced by a motley army of developers. It's
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peddler
4
- # @api private
4
+ # @!visibility private
5
5
  class StructuredList
6
6
  def initialize(*keys)
7
7
  @keys = keys
@@ -4,23 +4,23 @@ module Peddler
4
4
  # A custom matcher that can be used to record MWS interactions when
5
5
  # writing integration tests
6
6
  class VCRMatcher
7
- # @api private
7
+ # @!visibility private
8
8
  TRANSIENT_PARAMS = %w[
9
9
  Signature Timestamp StartDate CreatedAfter QueryStartDateTime
10
10
  ].freeze
11
11
 
12
- # @api private
12
+ # @!visibility private
13
13
  SELLER_PARAMS = %w[
14
14
  AWSAccessKeyId SellerId
15
15
  ].freeze
16
16
 
17
17
  class << self
18
- # @api private
18
+ # @!visibility private
19
19
  def call(*requests)
20
20
  new(*requests).compare
21
21
  end
22
22
 
23
- # @api private
23
+ # @!visibility private
24
24
  def ignored_params
25
25
  @ignored_params ||= TRANSIENT_PARAMS.dup
26
26
  end
@@ -33,15 +33,15 @@ module Peddler
33
33
  end
34
34
  end
35
35
 
36
- # @api private
36
+ # @!visibility private
37
37
  attr_reader :requests
38
38
 
39
- # @api private
39
+ # @!visibility private
40
40
  def initialize(*requests)
41
41
  @requests = requests
42
42
  end
43
43
 
44
- # @api private
44
+ # @!visibility private
45
45
  def compare
46
46
  compare_uris && compare_bodies
47
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peddler
4
- VERSION = '2.1.0'
4
+ VERSION = '2.4.2'
5
5
  end
@@ -6,7 +6,7 @@ require 'peddler/headers'
6
6
  require 'multi_xml'
7
7
 
8
8
  module Peddler
9
- # @api private
9
+ # @!visibility private
10
10
  class XMLParser < SimpleDelegator
11
11
  extend Forwardable
12
12
  include Headers
@@ -3,9 +3,9 @@
3
3
  require 'peddler/xml_parser'
4
4
 
5
5
  module Peddler
6
- # @api private
6
+ # @!visibility private
7
7
  class XMLResponseParser < XMLParser
8
- MATCHER = /^Message$|Report|Result/.freeze
8
+ MATCHER = /^Message$|^Node$|Report|Result/.freeze
9
9
  private_constant :MATCHER
10
10
 
11
11
  def next_token
@@ -14,6 +14,7 @@ module Peddler
14
14
 
15
15
  private
16
16
 
17
+ # FIXME: In next major version bump, stop assuming we know report internals.
17
18
  def find_data
18
19
  payload = xml.values.first
19
20
  found = payload.find { |k, _| k.match(MATCHER) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-15 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -52,9 +52,9 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.0
55
- description: A Ruby interface to the Amazon MWS API
55
+ description:
56
56
  email:
57
- - hakanensari@gmail.com
57
+ - me@hakanensari.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -62,6 +62,8 @@ files:
62
62
  - LICENSE
63
63
  - README.md
64
64
  - lib/mws.rb
65
+ - lib/mws/easy_ship.rb
66
+ - lib/mws/easy_ship/client.rb
65
67
  - lib/mws/feeds.rb
66
68
  - lib/mws/feeds/client.rb
67
69
  - lib/mws/finances.rb
@@ -75,7 +77,6 @@ files:
75
77
  - lib/mws/merchant_fulfillment.rb
76
78
  - lib/mws/merchant_fulfillment/client.rb
77
79
  - lib/mws/off_amazon_payments.rb
78
- - lib/mws/off_amazon_payments/client.rb
79
80
  - lib/mws/orders.rb
80
81
  - lib/mws/orders/client.rb
81
82
  - lib/mws/products.rb
@@ -84,9 +85,10 @@ files:
84
85
  - lib/mws/recommendations/client.rb
85
86
  - lib/mws/reports.rb
86
87
  - lib/mws/reports/client.rb
87
- - lib/mws/reports/parser.rb
88
88
  - lib/mws/sellers.rb
89
89
  - lib/mws/sellers/client.rb
90
+ - lib/mws/shipment_invoicing.rb
91
+ - lib/mws/shipment_invoicing/client.rb
90
92
  - lib/mws/subscriptions.rb
91
93
  - lib/mws/subscriptions/client.rb
92
94
  - lib/peddler.rb
@@ -105,79 +107,11 @@ files:
105
107
  - lib/peddler/version.rb
106
108
  - lib/peddler/xml_parser.rb
107
109
  - lib/peddler/xml_response_parser.rb
108
- - test/credentials.rb
109
- - test/helper.rb
110
- - test/integration/test_errors.rb
111
- - test/integration/test_feeds.rb
112
- - test/integration/test_fulfillment_inbound_shipment.rb
113
- - test/integration/test_fulfillment_inventory.rb
114
- - test/integration/test_fulfillment_outbound_shipment.rb
115
- - test/integration/test_merchant_fulfillment.rb
116
- - test/integration/test_multibyte_queries.rb
117
- - test/integration/test_mws_headers.rb
118
- - test/integration/test_off_amazon_payments.rb
119
- - test/integration/test_orders.rb
120
- - test/integration/test_products.rb
121
- - test/integration/test_recommendations.rb
122
- - test/integration/test_reports.rb
123
- - test/integration/test_sellers.rb
124
- - test/integration/test_subscriptions.rb
125
- - test/integration_helper.rb
126
- - test/mws.yml
127
- - test/mws.yml.example
128
- - test/null_client.rb
129
- - test/recorder.rb
130
- - test/unit/mws/test_feeds_client.rb
131
- - test/unit/mws/test_finances_client.rb
132
- - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
133
- - test/unit/mws/test_fulfillment_inventory_client.rb
134
- - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
135
- - test/unit/mws/test_merchant_fulfillment_client.rb
136
- - test/unit/mws/test_off_amazon_payments_client.rb
137
- - test/unit/mws/test_orders_client.rb
138
- - test/unit/mws/test_products_client.rb
139
- - test/unit/mws/test_recommendations_client.rb
140
- - test/unit/mws/test_reports_client.rb
141
- - test/unit/mws/test_sellers_client.rb
142
- - test/unit/mws/test_subscriptions_client.rb
143
- - test/unit/peddler/errors/test_builder.rb
144
- - test/unit/peddler/errors/test_class_generator.rb
145
- - test/unit/peddler/errors/test_error.rb
146
- - test/unit/peddler/errors/test_parser.rb
147
- - test/unit/peddler/test_client.rb
148
- - test/unit/peddler/test_flat_file_parser.rb
149
- - test/unit/peddler/test_headers.rb
150
- - test/unit/peddler/test_marketplace.rb
151
- - test/unit/peddler/test_operation.rb
152
- - test/unit/peddler/test_parser.rb
153
- - test/unit/peddler/test_structured_list.rb
154
- - test/unit/peddler/test_vcr_matcher.rb
155
- - test/unit/peddler/test_xml_parser.rb
156
- - test/unit/peddler/test_xml_response_parser.rb
157
- - test/unit/test_mws.rb
158
- - test/vcr_cassettes/CartInformation.yml
159
- - test/vcr_cassettes/CustomerInformation.yml
160
- - test/vcr_cassettes/Errors.yml
161
- - test/vcr_cassettes/Feeds.yml
162
- - test/vcr_cassettes/FulfillmentInboundShipment.yml
163
- - test/vcr_cassettes/FulfillmentInventory.yml
164
- - test/vcr_cassettes/FulfillmentOutboundShipment.yml
165
- - test/vcr_cassettes/MWSHeaders.yml
166
- - test/vcr_cassettes/MerchantFulfillment.yml
167
- - test/vcr_cassettes/MultibyteQueries.yml
168
- - test/vcr_cassettes/OffAmazonPayments.yml
169
- - test/vcr_cassettes/Orders.yml
170
- - test/vcr_cassettes/PeddlerVCRMatcher.yml
171
- - test/vcr_cassettes/Products.yml
172
- - test/vcr_cassettes/Recommendations.yml
173
- - test/vcr_cassettes/Reports.yml
174
- - test/vcr_cassettes/Sellers.yml
175
- - test/vcr_cassettes/Subscriptions.yml
176
110
  homepage: https://github.com/hakanensari/peddler
177
111
  licenses:
178
112
  - MIT
179
113
  metadata: {}
180
- post_install_message:
114
+ post_install_message:
181
115
  rdoc_options: []
182
116
  require_paths:
183
117
  - lib
@@ -185,84 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
119
  requirements:
186
120
  - - ">="
187
121
  - !ruby/object:Gem::Version
188
- version: '2.3'
122
+ version: '2.5'
189
123
  required_rubygems_version: !ruby/object:Gem::Requirement
190
124
  requirements:
191
125
  - - ">="
192
126
  - !ruby/object:Gem::Version
193
127
  version: '0'
194
128
  requirements: []
195
- rubyforge_project:
196
- rubygems_version: 2.7.6
197
- signing_key:
129
+ rubygems_version: 3.1.2
130
+ signing_key:
198
131
  specification_version: 4
199
- summary: Wraps the Amazon MWS APIs
200
- test_files:
201
- - test/unit/peddler/test_headers.rb
202
- - test/unit/peddler/test_vcr_matcher.rb
203
- - test/unit/peddler/test_marketplace.rb
204
- - test/unit/peddler/test_operation.rb
205
- - test/unit/peddler/test_structured_list.rb
206
- - test/unit/peddler/test_client.rb
207
- - test/unit/peddler/test_xml_response_parser.rb
208
- - test/unit/peddler/test_xml_parser.rb
209
- - test/unit/peddler/test_flat_file_parser.rb
210
- - test/unit/peddler/errors/test_error.rb
211
- - test/unit/peddler/errors/test_builder.rb
212
- - test/unit/peddler/errors/test_class_generator.rb
213
- - test/unit/peddler/errors/test_parser.rb
214
- - test/unit/peddler/test_parser.rb
215
- - test/unit/mws/test_finances_client.rb
216
- - test/unit/mws/test_sellers_client.rb
217
- - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
218
- - test/unit/mws/test_merchant_fulfillment_client.rb
219
- - test/unit/mws/test_subscriptions_client.rb
220
- - test/unit/mws/test_off_amazon_payments_client.rb
221
- - test/unit/mws/test_reports_client.rb
222
- - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
223
- - test/unit/mws/test_orders_client.rb
224
- - test/unit/mws/test_products_client.rb
225
- - test/unit/mws/test_recommendations_client.rb
226
- - test/unit/mws/test_fulfillment_inventory_client.rb
227
- - test/unit/mws/test_feeds_client.rb
228
- - test/unit/test_mws.rb
229
- - test/null_client.rb
230
- - test/mws.yml.example
231
- - test/helper.rb
232
- - test/integration/test_orders.rb
233
- - test/integration/test_recommendations.rb
234
- - test/integration/test_multibyte_queries.rb
235
- - test/integration/test_feeds.rb
236
- - test/integration/test_fulfillment_outbound_shipment.rb
237
- - test/integration/test_fulfillment_inbound_shipment.rb
238
- - test/integration/test_mws_headers.rb
239
- - test/integration/test_reports.rb
240
- - test/integration/test_subscriptions.rb
241
- - test/integration/test_merchant_fulfillment.rb
242
- - test/integration/test_errors.rb
243
- - test/integration/test_sellers.rb
244
- - test/integration/test_products.rb
245
- - test/integration/test_off_amazon_payments.rb
246
- - test/integration/test_fulfillment_inventory.rb
247
- - test/integration_helper.rb
248
- - test/mws.yml
249
- - test/vcr_cassettes/Products.yml
250
- - test/vcr_cassettes/MerchantFulfillment.yml
251
- - test/vcr_cassettes/CustomerInformation.yml
252
- - test/vcr_cassettes/Recommendations.yml
253
- - test/vcr_cassettes/Feeds.yml
254
- - test/vcr_cassettes/Orders.yml
255
- - test/vcr_cassettes/MultibyteQueries.yml
256
- - test/vcr_cassettes/CartInformation.yml
257
- - test/vcr_cassettes/FulfillmentInboundShipment.yml
258
- - test/vcr_cassettes/FulfillmentOutboundShipment.yml
259
- - test/vcr_cassettes/PeddlerVCRMatcher.yml
260
- - test/vcr_cassettes/OffAmazonPayments.yml
261
- - test/vcr_cassettes/Sellers.yml
262
- - test/vcr_cassettes/FulfillmentInventory.yml
263
- - test/vcr_cassettes/Errors.yml
264
- - test/vcr_cassettes/Subscriptions.yml
265
- - test/vcr_cassettes/MWSHeaders.yml
266
- - test/vcr_cassettes/Reports.yml
267
- - test/recorder.rb
268
- - test/credentials.rb
132
+ summary: A Ruby wrapper to the Amazon MWS API
133
+ test_files: []
@@ -1,362 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'peddler/client'
4
-
5
- module MWS
6
- module OffAmazonPayments
7
- # The Off-Amazon Payments API helps you to process payments for purchases
8
- # made by buyers on your website using the Login and Pay with Amazon
9
- # service. This API enables you to programmatically retrieve shipping and
10
- # payment information provided by the buyer from their Amazon account. It
11
- # allows you to authorize, capture, and refund payments, enabling a variety
12
- # of payments scenarios.
13
- #
14
- # @note The Off-Amazon Payments API section is only applicable to payments
15
- # made through the Login and Pay with Amazon service offered by Amazon
16
- # Payments. You cannot use this API section to process payments for Amazon
17
- # Marketplace, Amazon Webstore, or Checkout by Amazon.
18
- class Client < ::Peddler::Client
19
- self.version = '2013-01-01'
20
- self.path = "/OffAmazonPayments/#{version}/"
21
-
22
- # Switches the client to the sandbox environment
23
- #
24
- # @see https://payments.amazon.com/help/Checkout-by-Amazon/Using-the-Checkout-by-Amazon-Sandbox/Overview-of-the-Sandbox
25
- # @return [self]
26
- def sandbox
27
- self.path = "/OffAmazonPayments_Sandbox/#{version}/"
28
- self
29
- end
30
-
31
- # Reserves a specified amount against the payment method(s) stored in the
32
- # order reference
33
- #
34
- # @see https://payments.amazon.com/documentation/apireference/201752010
35
- # @param [String] amazon_order_reference_id
36
- # @param [String] authorization_reference_id
37
- # @param [Struct, Hash] authorization_amount
38
- # @param [Hash] opts
39
- # @option opts [String] :seller_authorization_note
40
- # @option opts [Integer] :transaction_timeout
41
- # @option opts [Boolean] :capture_now
42
- # @option opts [String] :soft_descriptor
43
- # @return [Peddler::XMLParser]
44
- def authorize(amazon_order_reference_id, authorization_reference_id,
45
- authorization_amount, opts = {})
46
- operation('Authorize')
47
- .add(opts)
48
- .add('AmazonOrderReferenceId' => amazon_order_reference_id,
49
- 'AuthorizationReferenceId' => authorization_reference_id,
50
- 'AuthorizationAmount' => authorization_amount)
51
-
52
- run
53
- end
54
-
55
- # Cancels a previously confirmed order reference
56
- #
57
- # @see https://payments.amazon.com/documentation/apireference/201751990
58
- # @param [String] amazon_order_reference_id
59
- # @param [Hash] opts
60
- # @option opts [String] cancelation_reason
61
- # @return [Peddler::XMLParser]
62
- def cancel_order_reference(amazon_order_reference_id, opts = {})
63
- operation('CancelOrderReference')
64
- .add(opts)
65
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
66
-
67
- run
68
- end
69
-
70
- # Captures funds from an authorized payment instrument
71
- #
72
- # @see https://payments.amazon.com/documentation/apireference/201752040
73
- # @param [String] amazon_authorization_id
74
- # @param [String] capture_reference_id
75
- # @param [Struct, Hash] capture_amount
76
- # @param [Hash] opts
77
- # @option opts [String] :seller_capture_note
78
- # @option opts [String] :soft_descriptor
79
- # @return [Peddler::XMLParser]
80
- def capture(amazon_authorization_id, capture_reference_id, capture_amount,
81
- opts = {})
82
- operation('Capture')
83
- .add(opts)
84
- .add('AmazonAuthorizationId' => amazon_authorization_id,
85
- 'CaptureReferenceId' => capture_reference_id,
86
- 'CaptureAmount' => capture_amount)
87
-
88
- run
89
- end
90
-
91
- # Closes an authorization
92
- #
93
- # @see https://payments.amazon.com/documentation/apireference/201752070
94
- # @param [String] amazon_authorization_id
95
- # @param [Hash] opts
96
- # @option opts [String] closure_reason
97
- # @return [Peddler::XMLParser]
98
- def close_authorization(amazon_authorization_id, opts = {})
99
- operation('CloseAuthorization')
100
- .add(opts)
101
- .add('AmazonAuthorizationId' => amazon_authorization_id)
102
-
103
- run
104
- end
105
-
106
- # Confirms that an order reference has been fulfilled (fully or partially)
107
- # and that you do not expect to create any new authorizations on this
108
- # order reference
109
- #
110
- # @see https://payments.amazon.com/documentation/apireference/201752000
111
- # @param [String] amazon_order_reference_id
112
- # @param [Hash] opts
113
- # @option opts [String] closure_reason
114
- # @return [Peddler::XMLParser]
115
- def close_order_reference(amazon_order_reference_id, opts = {})
116
- operation('CloseOrderReference')
117
- .add(opts)
118
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
119
-
120
- run
121
- end
122
-
123
- # Confirms that the order reference is free of constraints and all
124
- # required information has been set on the order reference
125
- #
126
- # @see https://payments.amazon.com/documentation/apireference/201751980
127
- # @param [String] amazon_order_reference_id
128
- # @return [Peddler::XMLParser]
129
- def confirm_order_reference(amazon_order_reference_id)
130
- operation('ConfirmOrderReference')
131
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
132
-
133
- run
134
- end
135
-
136
- # Creates an order reference for the given object
137
- #
138
- # @see https://payments.amazon.com/documentation/apireference/201751670
139
- # @param [String] id
140
- # @param [String] id_type
141
- # @param [Hash] opts
142
- # @option opts [Boolean] :inherit_shipping_address
143
- # @option opts [Boolean] :confirm_now
144
- # @option opts [Struct, Hash] :order_reference_attributes
145
- # @return [Peddler::XMLParser]
146
- def create_order_reference_for_id(id, id_type, opts = {})
147
- operation('CreateOrderReferenceForId')
148
- .add(opts)
149
- .add('Id' => id, 'IdType' => id_type)
150
-
151
- run
152
- end
153
-
154
- # Returns the status of a particular authorization and the total amount
155
- # captured on the authorization
156
- #
157
- # @see https://payments.amazon.com/documentation/apireference/201752030
158
- # @param [String] amazon_authorization_id
159
- # @return [Peddler::XMLParser]
160
- def get_authorization_details(amazon_authorization_id)
161
- operation('GetAuthorizationDetails')
162
- .add('AmazonAuthorizationId' => amazon_authorization_id)
163
-
164
- run
165
- end
166
-
167
- # Returns the status of a particular capture and the total amount refunded
168
- # on the capture
169
- #
170
- # @see https://payments.amazon.com/documentation/apireference/201752060
171
- # @param [String] amazon_capture_id
172
- # @return [Peddler::XMLParser]
173
- def get_capture_details(amazon_capture_id)
174
- operation('GetCaptureDetails')
175
- .add('AmazonCaptureId' => amazon_capture_id)
176
-
177
- run
178
- end
179
-
180
- # Returns details about the Order Reference object and its current state
181
- #
182
- # @see https://payments.amazon.com/documentation/apireference/201751970
183
- # @param [String] amazon_order_reference_id
184
- # @param [Hash] opts
185
- # @option opts [String] address_consent_token
186
- # @return [Peddler::XMLParser]
187
- def get_order_reference_details(amazon_order_reference_id, opts = {})
188
- operation('GetOrderReferenceDetails')
189
- .add(opts)
190
- .add('AmazonOrderReferenceId' => amazon_order_reference_id)
191
-
192
- run
193
- end
194
-
195
- # Returns the status of a particular refund
196
- #
197
- # @see https://payments.amazon.com/documentation/apireference/201752100
198
- # @param [String] amazon_refund_id
199
- # @return [Peddler::XMLParser]
200
- def get_refund_details(amazon_refund_id)
201
- operation('GetRefundDetails')
202
- .add('AmazonRefundId' => amazon_refund_id)
203
-
204
- run
205
- end
206
-
207
- # Gets the operational status of the API
208
- #
209
- # @see https://payments.amazon.com/documentation/apireference/201752110
210
- # @return [Peddler::XMLParser]
211
- def get_service_status
212
- operation('GetServiceStatus')
213
- run
214
- end
215
-
216
- # Refunds a previously captured amount
217
- #
218
- # @see https://payments.amazon.com/documentation/apireference/201752080
219
- # @param [String] amazon_capture_id
220
- # @param [String] refund_reference_id
221
- # @param [Struct, Hash] refund_amount
222
- # @param [Hash] opts
223
- # @option opts [String] :seller_refund_note
224
- # @option opts [String] :soft_descriptor
225
- # @return [Peddler::XMLParser]
226
- def refund(amazon_capture_id, refund_reference_id, refund_amount,
227
- opts = {})
228
- operation('Refund')
229
- .add(opts)
230
- .add('AmazonCaptureId' => amazon_capture_id,
231
- 'RefundReferenceId' => refund_reference_id,
232
- 'RefundAmount' => refund_amount)
233
-
234
- run
235
- end
236
-
237
- # Sets order reference details such as the order total and a description
238
- # for the order
239
- #
240
- # @see https://payments.amazon.com/documentation/apireference/201751960
241
- # @param [String] amazon_order_reference_id
242
- # @param [Struct, Hash] order_total
243
- # @param [Hash] opts
244
- # @option opts [String] :platform_id
245
- # @option opts [String] :seller_note
246
- # @option opts [Struct, Hash] :seller_order_attributes
247
- # @return [Peddler::XMLParser]
248
- def set_order_reference_details(amazon_order_reference_id, order_total,
249
- opts = {})
250
- order_reference_attributes = opts.update('OrderTotal' => order_total)
251
- operation('SetOrderReferenceDetails')
252
- .add('AmazonOrderReferenceId' => amazon_order_reference_id,
253
- 'OrderReferenceAttributes' => order_reference_attributes)
254
-
255
- run
256
- end
257
-
258
- # Reserves a specified amount against the payment method(s) stored in the
259
- # billing agreement
260
- #
261
- # @see https://payments.amazon.com/documentation/apireference/201751940
262
- # @param [String] amazon_billing_agreement_id
263
- # @param [String] authorization_reference_id
264
- # @param [Hash, Struct] authorization_amount
265
- # @param [Hash] opts
266
- # @option opts [String] :seller_authorization_note
267
- # @option opts [Integer] :transaction_timeout
268
- # @option opts [Boolean] :capture_now
269
- # @option opts [String] :soft_descriptor
270
- # @option opts [String] :seller_note
271
- # @option opts [String] :platform_id
272
- # @option opts [Hash, Struct] :seller_order_attributes
273
- # @option opts [Boolean] :inherit_shipping_address
274
- # @return [Peddler::XMLParser]
275
- def authorize_on_billing_agreement(amazon_billing_agreement_id,
276
- authorization_reference_id,
277
- authorization_amount, opts = {})
278
- operation('AuthorizeOnBillingAgreement')
279
- .add(opts)
280
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id,
281
- 'AuthorizationReferenceId' => authorization_reference_id,
282
- 'AuthorizationAmount' => authorization_amount)
283
-
284
- run
285
- end
286
-
287
- # Confirms that you want to terminate the billing agreement with the buyer
288
- # and that you do not expect to create any new order references or
289
- # authorizations on this billing agreement
290
- #
291
- # @see https://payments.amazon.com/documentation/apireference/201751950
292
- # @param [String] amazon_billing_agreement_id
293
- # @param [Hash] opts
294
- # @option opts [String] :closure_reason
295
- # @return [Peddler::XMLParser]
296
- def close_billing_agreement(amazon_billing_agreement_id, opts = {})
297
- operation('CloseBillingAgreement')
298
- .add(opts)
299
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id)
300
-
301
- run
302
- end
303
-
304
- # Confirms that the billing agreement is free of constraints and all
305
- # required information has been set on the billing agreement
306
- #
307
- # @see https://payments.amazon.com/documentation/apireference/201751710
308
- # @param [String] amazon_billing_agreement_id
309
- # @return [Peddler::XMLParser]
310
- def confirm_billing_agreement(amazon_billing_agreement_id)
311
- operation('ConfirmBillingAgreement')
312
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id)
313
-
314
- run
315
- end
316
-
317
- # Returns details about the Billing Agreement object and its current state
318
- #
319
- # @see https://payments.amazon.com/documentation/apireference/201751690
320
- # @param [String] amazon_billing_agreement_id
321
- # @param [Hash] opts
322
- # @option opts [String] :address_consent_token
323
- # @return [Peddler::XMLParser]
324
- def get_billing_agreement_details(amazon_billing_agreement_id, opts = {})
325
- operation('GetBillingAgreementDetails')
326
- .add(opts)
327
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id)
328
-
329
- run
330
- end
331
-
332
- # Sets billing agreement details such as a description of the agreement
333
- # and other information about the seller
334
- #
335
- # @see https://payments.amazon.com/documentation/apireference/201751700
336
- # @param [String] amazon_billing_agreement_id
337
- # @param [Struct, Hash] billing_agreement_attributes
338
- # @return [Peddler::XMLParser]
339
- def set_billing_agreement_details(amazon_billing_agreement_id,
340
- billing_agreement_attributes)
341
- operation('SetBillingAgreementDetails')
342
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id,
343
- 'BillingAgreementAttributes' => billing_agreement_attributes)
344
-
345
- run
346
- end
347
-
348
- # Validates the status of the BillingAgreement object and the payment
349
- # method associated with it
350
- #
351
- # @see https://payments.amazon.com/documentation/apireference/201751720
352
- # @param [String] amazon_billing_agreement_id
353
- # @return [Peddler::XMLParser]
354
- def validate_billing_agreement(amazon_billing_agreement_id)
355
- operation('ValidateBillingAgreement')
356
- .add('AmazonBillingAgreementId' => amazon_billing_agreement_id)
357
-
358
- run
359
- end
360
- end
361
- end
362
- end