peddler 2.1.1 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -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_outbound_shipment/client.rb +1 -1
  7. data/lib/mws/orders/client.rb +7 -9
  8. data/lib/mws/shipment_invoicing.rb +3 -0
  9. data/lib/mws/shipment_invoicing/client.rb +74 -0
  10. data/lib/mws/subscriptions/client.rb +2 -2
  11. data/lib/peddler/client.rb +17 -13
  12. data/lib/peddler/errors/builder.rb +7 -2
  13. data/lib/peddler/errors/class_generator.rb +9 -4
  14. data/lib/peddler/errors/error.rb +6 -2
  15. data/lib/peddler/errors/parser.rb +1 -1
  16. data/lib/peddler/flat_file_parser.rb +5 -3
  17. data/lib/peddler/headers.rb +6 -1
  18. data/lib/peddler/marketplace.rb +25 -19
  19. data/lib/peddler/operation.rb +17 -11
  20. data/lib/peddler/parser.rb +1 -1
  21. data/lib/peddler/structured_list.rb +1 -1
  22. data/lib/peddler/vcr_matcher.rb +7 -7
  23. data/lib/peddler/version.rb +1 -1
  24. data/lib/peddler/xml_parser.rb +1 -1
  25. data/lib/peddler/xml_response_parser.rb +3 -2
  26. metadata +15 -152
  27. data/lib/mws/off_amazon_payments/client.rb +0 -362
  28. data/lib/peddler/content.rb +0 -69
  29. data/lib/peddler/mws.rb +0 -58
  30. data/test/credentials.rb +0 -23
  31. data/test/helper.rb +0 -15
  32. data/test/integration/internals/test_errors.rb +0 -17
  33. data/test/integration/internals/test_multibyte_queries.rb +0 -17
  34. data/test/integration/internals/test_mws_headers.rb +0 -21
  35. data/test/integration/internals/test_string_encodings.rb +0 -38
  36. data/test/integration/test_feeds.rb +0 -37
  37. data/test/integration/test_fulfillment_inbound_shipment.rb +0 -35
  38. data/test/integration/test_fulfillment_inventory.rb +0 -20
  39. data/test/integration/test_fulfillment_outbound_shipment.rb +0 -13
  40. data/test/integration/test_merchant_fulfillment.rb +0 -69
  41. data/test/integration/test_off_amazon_payments.rb +0 -13
  42. data/test/integration/test_orders.rb +0 -30
  43. data/test/integration/test_products.rb +0 -97
  44. data/test/integration/test_recommendations.rb +0 -20
  45. data/test/integration/test_reports.rb +0 -51
  46. data/test/integration/test_sellers.rb +0 -13
  47. data/test/integration/test_subscriptions.rb +0 -27
  48. data/test/integration_helper.rb +0 -53
  49. data/test/mws.yml +0 -36
  50. data/test/mws.yml.example +0 -32
  51. data/test/null_client.rb +0 -25
  52. data/test/recorder.rb +0 -39
  53. data/test/unit/mws/test_feeds_client.rb +0 -103
  54. data/test/unit/mws/test_finances_client.rb +0 -74
  55. data/test/unit/mws/test_fulfillment_inbound_shipment_client.rb +0 -426
  56. data/test/unit/mws/test_fulfillment_inventory_client.rb +0 -48
  57. data/test/unit/mws/test_fulfillment_outbound_shipment_client.rb +0 -202
  58. data/test/unit/mws/test_merchant_fulfillment_client.rb +0 -109
  59. data/test/unit/mws/test_off_amazon_payments_client.rb +0 -286
  60. data/test/unit/mws/test_orders_client.rb +0 -111
  61. data/test/unit/mws/test_products_client.rb +0 -248
  62. data/test/unit/mws/test_recommendations_client.rb +0 -62
  63. data/test/unit/mws/test_reports_client.rb +0 -209
  64. data/test/unit/mws/test_sellers_client.rb +0 -47
  65. data/test/unit/mws/test_subscriptions_client.rb +0 -182
  66. data/test/unit/peddler/errors/test_builder.rb +0 -65
  67. data/test/unit/peddler/errors/test_class_generator.rb +0 -18
  68. data/test/unit/peddler/errors/test_error.rb +0 -33
  69. data/test/unit/peddler/errors/test_parser.rb +0 -44
  70. data/test/unit/peddler/test_client.rb +0 -203
  71. data/test/unit/peddler/test_flat_file_parser.rb +0 -111
  72. data/test/unit/peddler/test_headers.rb +0 -103
  73. data/test/unit/peddler/test_marketplace.rb +0 -47
  74. data/test/unit/peddler/test_operation.rb +0 -87
  75. data/test/unit/peddler/test_parser.rb +0 -36
  76. data/test/unit/peddler/test_structured_list.rb +0 -39
  77. data/test/unit/peddler/test_vcr_matcher.rb +0 -55
  78. data/test/unit/peddler/test_xml_parser.rb +0 -37
  79. data/test/unit/peddler/test_xml_response_parser.rb +0 -39
  80. data/test/unit/test_mws.rb +0 -11
  81. data/test/vcr_cassettes/CartInformation.yml +0 -433
  82. data/test/vcr_cassettes/CustomerInformation.yml +0 -433
  83. data/test/vcr_cassettes/Errors.yml +0 -444
  84. data/test/vcr_cassettes/Feeds.yml +0 -9957
  85. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +0 -6166
  86. data/test/vcr_cassettes/FulfillmentInventory.yml +0 -850
  87. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +0 -433
  88. data/test/vcr_cassettes/MWSHeaders.yml +0 -2964
  89. data/test/vcr_cassettes/MerchantFulfillment.yml +0 -753
  90. data/test/vcr_cassettes/MultibyteQueries.yml +0 -437
  91. data/test/vcr_cassettes/OffAmazonPayments.yml +0 -433
  92. data/test/vcr_cassettes/Orders.yml +0 -4740
  93. data/test/vcr_cassettes/PeddlerVCRMatcher.yml +0 -41
  94. data/test/vcr_cassettes/Products.yml +0 -7139
  95. data/test/vcr_cassettes/Recommendations.yml +0 -3145
  96. data/test/vcr_cassettes/Reports.yml +0 -5549
  97. data/test/vcr_cassettes/Sellers.yml +0 -433
  98. data/test/vcr_cassettes/Subscriptions.yml +0 -1529
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peddler
4
- VERSION = '2.1.1'
4
+ VERSION = '2.4.4'
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.1
4
+ version: 2.4.4
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-04-05 00:00:00.000000000 Z
11
+ date: 2020-10-30 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
@@ -86,11 +87,12 @@ files:
86
87
  - lib/mws/reports/client.rb
87
88
  - lib/mws/sellers.rb
88
89
  - lib/mws/sellers/client.rb
90
+ - lib/mws/shipment_invoicing.rb
91
+ - lib/mws/shipment_invoicing/client.rb
89
92
  - lib/mws/subscriptions.rb
90
93
  - lib/mws/subscriptions/client.rb
91
94
  - lib/peddler.rb
92
95
  - lib/peddler/client.rb
93
- - lib/peddler/content.rb
94
96
  - lib/peddler/errors/builder.rb
95
97
  - lib/peddler/errors/class_generator.rb
96
98
  - lib/peddler/errors/error.rb
@@ -98,7 +100,6 @@ files:
98
100
  - lib/peddler/flat_file_parser.rb
99
101
  - lib/peddler/headers.rb
100
102
  - lib/peddler/marketplace.rb
101
- - lib/peddler/mws.rb
102
103
  - lib/peddler/operation.rb
103
104
  - lib/peddler/parser.rb
104
105
  - lib/peddler/structured_list.rb
@@ -106,80 +107,11 @@ files:
106
107
  - lib/peddler/version.rb
107
108
  - lib/peddler/xml_parser.rb
108
109
  - lib/peddler/xml_response_parser.rb
109
- - test/credentials.rb
110
- - test/helper.rb
111
- - test/integration/internals/test_errors.rb
112
- - test/integration/internals/test_multibyte_queries.rb
113
- - test/integration/internals/test_mws_headers.rb
114
- - test/integration/internals/test_string_encodings.rb
115
- - test/integration/test_feeds.rb
116
- - test/integration/test_fulfillment_inbound_shipment.rb
117
- - test/integration/test_fulfillment_inventory.rb
118
- - test/integration/test_fulfillment_outbound_shipment.rb
119
- - test/integration/test_merchant_fulfillment.rb
120
- - test/integration/test_off_amazon_payments.rb
121
- - test/integration/test_orders.rb
122
- - test/integration/test_products.rb
123
- - test/integration/test_recommendations.rb
124
- - test/integration/test_reports.rb
125
- - test/integration/test_sellers.rb
126
- - test/integration/test_subscriptions.rb
127
- - test/integration_helper.rb
128
- - test/mws.yml
129
- - test/mws.yml.example
130
- - test/null_client.rb
131
- - test/recorder.rb
132
- - test/unit/mws/test_feeds_client.rb
133
- - test/unit/mws/test_finances_client.rb
134
- - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
135
- - test/unit/mws/test_fulfillment_inventory_client.rb
136
- - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
137
- - test/unit/mws/test_merchant_fulfillment_client.rb
138
- - test/unit/mws/test_off_amazon_payments_client.rb
139
- - test/unit/mws/test_orders_client.rb
140
- - test/unit/mws/test_products_client.rb
141
- - test/unit/mws/test_recommendations_client.rb
142
- - test/unit/mws/test_reports_client.rb
143
- - test/unit/mws/test_sellers_client.rb
144
- - test/unit/mws/test_subscriptions_client.rb
145
- - test/unit/peddler/errors/test_builder.rb
146
- - test/unit/peddler/errors/test_class_generator.rb
147
- - test/unit/peddler/errors/test_error.rb
148
- - test/unit/peddler/errors/test_parser.rb
149
- - test/unit/peddler/test_client.rb
150
- - test/unit/peddler/test_flat_file_parser.rb
151
- - test/unit/peddler/test_headers.rb
152
- - test/unit/peddler/test_marketplace.rb
153
- - test/unit/peddler/test_operation.rb
154
- - test/unit/peddler/test_parser.rb
155
- - test/unit/peddler/test_structured_list.rb
156
- - test/unit/peddler/test_vcr_matcher.rb
157
- - test/unit/peddler/test_xml_parser.rb
158
- - test/unit/peddler/test_xml_response_parser.rb
159
- - test/unit/test_mws.rb
160
- - test/vcr_cassettes/CartInformation.yml
161
- - test/vcr_cassettes/CustomerInformation.yml
162
- - test/vcr_cassettes/Errors.yml
163
- - test/vcr_cassettes/Feeds.yml
164
- - test/vcr_cassettes/FulfillmentInboundShipment.yml
165
- - test/vcr_cassettes/FulfillmentInventory.yml
166
- - test/vcr_cassettes/FulfillmentOutboundShipment.yml
167
- - test/vcr_cassettes/MWSHeaders.yml
168
- - test/vcr_cassettes/MerchantFulfillment.yml
169
- - test/vcr_cassettes/MultibyteQueries.yml
170
- - test/vcr_cassettes/OffAmazonPayments.yml
171
- - test/vcr_cassettes/Orders.yml
172
- - test/vcr_cassettes/PeddlerVCRMatcher.yml
173
- - test/vcr_cassettes/Products.yml
174
- - test/vcr_cassettes/Recommendations.yml
175
- - test/vcr_cassettes/Reports.yml
176
- - test/vcr_cassettes/Sellers.yml
177
- - test/vcr_cassettes/Subscriptions.yml
178
110
  homepage: https://github.com/hakanensari/peddler
179
111
  licenses:
180
112
  - MIT
181
113
  metadata: {}
182
- post_install_message:
114
+ post_install_message:
183
115
  rdoc_options: []
184
116
  require_paths:
185
117
  - lib
@@ -187,84 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
119
  requirements:
188
120
  - - ">="
189
121
  - !ruby/object:Gem::Version
190
- version: '2.4'
122
+ version: '2.5'
191
123
  required_rubygems_version: !ruby/object:Gem::Requirement
192
124
  requirements:
193
125
  - - ">="
194
126
  - !ruby/object:Gem::Version
195
127
  version: '0'
196
128
  requirements: []
197
- rubygems_version: 3.0.3
198
- signing_key:
129
+ rubygems_version: 3.1.4
130
+ signing_key:
199
131
  specification_version: 4
200
- summary: Wraps the Amazon MWS APIs
201
- test_files:
202
- - test/unit/peddler/test_headers.rb
203
- - test/unit/peddler/test_vcr_matcher.rb
204
- - test/unit/peddler/test_marketplace.rb
205
- - test/unit/peddler/test_operation.rb
206
- - test/unit/peddler/test_structured_list.rb
207
- - test/unit/peddler/test_client.rb
208
- - test/unit/peddler/test_xml_response_parser.rb
209
- - test/unit/peddler/test_xml_parser.rb
210
- - test/unit/peddler/test_flat_file_parser.rb
211
- - test/unit/peddler/errors/test_error.rb
212
- - test/unit/peddler/errors/test_builder.rb
213
- - test/unit/peddler/errors/test_class_generator.rb
214
- - test/unit/peddler/errors/test_parser.rb
215
- - test/unit/peddler/test_parser.rb
216
- - test/unit/mws/test_finances_client.rb
217
- - test/unit/mws/test_sellers_client.rb
218
- - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
219
- - test/unit/mws/test_merchant_fulfillment_client.rb
220
- - test/unit/mws/test_subscriptions_client.rb
221
- - test/unit/mws/test_off_amazon_payments_client.rb
222
- - test/unit/mws/test_reports_client.rb
223
- - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
224
- - test/unit/mws/test_orders_client.rb
225
- - test/unit/mws/test_products_client.rb
226
- - test/unit/mws/test_recommendations_client.rb
227
- - test/unit/mws/test_fulfillment_inventory_client.rb
228
- - test/unit/mws/test_feeds_client.rb
229
- - test/unit/test_mws.rb
230
- - test/null_client.rb
231
- - test/mws.yml.example
232
- - test/helper.rb
233
- - test/integration/test_orders.rb
234
- - test/integration/test_recommendations.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_reports.rb
239
- - test/integration/test_subscriptions.rb
240
- - test/integration/internals/test_multibyte_queries.rb
241
- - test/integration/internals/test_mws_headers.rb
242
- - test/integration/internals/test_errors.rb
243
- - test/integration/internals/test_string_encodings.rb
244
- - test/integration/test_merchant_fulfillment.rb
245
- - test/integration/test_sellers.rb
246
- - test/integration/test_products.rb
247
- - test/integration/test_off_amazon_payments.rb
248
- - test/integration/test_fulfillment_inventory.rb
249
- - test/integration_helper.rb
250
- - test/mws.yml
251
- - test/vcr_cassettes/Products.yml
252
- - test/vcr_cassettes/MerchantFulfillment.yml
253
- - test/vcr_cassettes/CustomerInformation.yml
254
- - test/vcr_cassettes/Recommendations.yml
255
- - test/vcr_cassettes/Feeds.yml
256
- - test/vcr_cassettes/Orders.yml
257
- - test/vcr_cassettes/MultibyteQueries.yml
258
- - test/vcr_cassettes/CartInformation.yml
259
- - test/vcr_cassettes/FulfillmentInboundShipment.yml
260
- - test/vcr_cassettes/FulfillmentOutboundShipment.yml
261
- - test/vcr_cassettes/PeddlerVCRMatcher.yml
262
- - test/vcr_cassettes/OffAmazonPayments.yml
263
- - test/vcr_cassettes/Sellers.yml
264
- - test/vcr_cassettes/FulfillmentInventory.yml
265
- - test/vcr_cassettes/Errors.yml
266
- - test/vcr_cassettes/Subscriptions.yml
267
- - test/vcr_cassettes/MWSHeaders.yml
268
- - test/vcr_cassettes/Reports.yml
269
- - test/recorder.rb
270
- - 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