peddler 4.2.0 → 4.3.1

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.
@@ -0,0 +1,195 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def seller_wallet_2024_03_01(...)
8
+ APIs::SellerWallet20240301.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # The Selling Partner API for Amazon Seller Wallet Open Banking API
14
+ #
15
+ # The Selling Partner API for Seller Wallet (Seller Wallet API) provides financial information that is relevant to a
16
+ # seller's Seller Wallet account. You can obtain financial events, balances, and transfer schedules for Seller
17
+ # Wallet accounts. You can also schedule and initiate transactions.
18
+ class SellerWallet20240301 < API
19
+ # Get all Seller Wallet accounts for a given seller.
20
+ #
21
+ # @note This operation can make a static sandbox call.
22
+ # @param marketplace_id [String] The marketplace for which items are returned. The marketplace ID is the globally
23
+ # unique identifier of a marketplace. To find the ID for your marketplace, refer to [Marketplace
24
+ # IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
25
+ # @return [Peddler::Response] The API response
26
+ def list_accounts(marketplace_id)
27
+ path = "/finances/transfers/wallet/2024-03-01/accounts"
28
+ params = {
29
+ "marketplaceId" => marketplace_id,
30
+ }.compact
31
+
32
+ get(path, params:)
33
+ end
34
+
35
+ # Retrieve an Amazon Seller Wallet bank account by Amazon account identifier.
36
+ #
37
+ # @note This operation can make a static sandbox call.
38
+ # @param account_id [String] The ID of the Amazon Seller Wallet account.
39
+ # @return [Peddler::Response] The API response
40
+ def get_account(account_id)
41
+ path = "/finances/transfers/wallet/2024-03-01/accounts/#{account_id}"
42
+
43
+ get(path)
44
+ end
45
+
46
+ # Retrieve the balance in a given Amazon Seller Wallet bank account.
47
+ #
48
+ # @note This operation can make a static sandbox call.
49
+ # @param account_id [String] The ID of the Amazon Seller Wallet account.
50
+ # @return [Peddler::Response] The API response
51
+ def list_account_balances(account_id)
52
+ path = "/finances/transfers/wallet/2024-03-01/accounts/#{account_id}/balance"
53
+
54
+ get(path)
55
+ end
56
+
57
+ # Retrieve a list of potential fees on a transaction.
58
+ #
59
+ # @note This operation can make a static sandbox call.
60
+ # @param source_country_code [String] Country code of the source transaction account in ISO 3166 format.
61
+ # @param source_currency_code [String] Currency code of the source transaction country in ISO 4217 format.
62
+ # @param destination_country_code [String] Country code of the destination transaction account in ISO 3166 format.
63
+ # @param destination_currency_code [String] Currency code of the destination transaction country in ISO 4217
64
+ # format.
65
+ # @param base_amount [Number] The base transaction amount without any markup fees.
66
+ # @return [Peddler::Response] The API response
67
+ def get_transfer_preview(source_country_code, source_currency_code, destination_country_code,
68
+ destination_currency_code, base_amount)
69
+ path = "/finances/transfers/wallet/2024-03-01/transferPreview"
70
+ params = {
71
+ "sourceCountryCode" => source_country_code,
72
+ "sourceCurrencyCode" => source_currency_code,
73
+ "destinationCountryCode" => destination_country_code,
74
+ "destinationCurrencyCode" => destination_currency_code,
75
+ "baseAmount" => base_amount,
76
+ }.compact
77
+
78
+ get(path, params:)
79
+ end
80
+
81
+ # Retrieve a list of transactions for a given Amazon Seller Wallet bank account.
82
+ #
83
+ # @note This operation can make a static sandbox call.
84
+ # @param account_id [String] The ID of the Amazon Seller Wallet account.
85
+ # @param next_page_token [String] A token that you use to retrieve the next page of results. The response includes
86
+ # `nextPageToken` when the number of results exceeds 100. To get the next page of results, call the operation
87
+ # with this token and include the same arguments as the call that produced the token. To get a complete list,
88
+ # call this operation until `nextPageToken` is null. Note that this operation can return empty pages.
89
+ # @return [Peddler::Response] The API response
90
+ def list_account_transactions(account_id, next_page_token: nil)
91
+ path = "/finances/transfers/wallet/2024-03-01/transactions"
92
+ params = {
93
+ "accountId" => account_id,
94
+ "nextPageToken" => next_page_token,
95
+ }.compact
96
+
97
+ get(path, params:)
98
+ end
99
+
100
+ # Create a transaction request from an Amazon Seller Wallet account to another customer-provided account.
101
+ #
102
+ # @note This operation can make a static sandbox call.
103
+ # @param body [Hash] The payload of the request
104
+ # @param dest_account_digital_signature [String] Digital signature for the destination bank account details.
105
+ # @param amount_digital_signature [String] Digital signature for the source currency transaction amount.
106
+ # @return [Peddler::Response] The API response
107
+ def create_transaction(body, dest_account_digital_signature, amount_digital_signature)
108
+ path = "/finances/transfers/wallet/2024-03-01/transactions"
109
+
110
+ post(path, body:)
111
+ end
112
+
113
+ # Find a transaction by the Amazon transaction identifier.
114
+ #
115
+ # @note This operation can make a static sandbox call.
116
+ # @param transaction_id [String] The ID of the Amazon Seller Wallet transaction.
117
+ # @return [Peddler::Response] The API response
118
+ def get_transaction(transaction_id)
119
+ path = "/finances/transfers/wallet/2024-03-01/transactions/#{transaction_id}"
120
+
121
+ get(path)
122
+ end
123
+
124
+ # Returns all transfer schedules of a given Amazon Seller Wallet bank account with the schedule ID in response if
125
+ # present.
126
+ #
127
+ # @note This operation can make a static sandbox call.
128
+ # @param account_id [String] The ID of the Amazon Seller Wallet account.
129
+ # @param next_page_token [String] A token that you use to retrieve the next page of results. The response includes
130
+ # `nextPageToken` when the number of results exceeds the specified `pageSize` value. To get the next page of
131
+ # results, call the operation with this token and include the same arguments as the call that produced the
132
+ # token. To get a complete list, call this operation until `nextPageToken` is null. Note that this operation can
133
+ # return empty pages.
134
+ # @return [Peddler::Response] The API response
135
+ def list_transfer_schedules(account_id, next_page_token: nil)
136
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules"
137
+ params = {
138
+ "accountId" => account_id,
139
+ "nextPageToken" => next_page_token,
140
+ }.compact
141
+
142
+ get(path, params:)
143
+ end
144
+
145
+ # Create a transfer schedule request from an Amazon Seller Wallet account to another customer-provided account.
146
+ #
147
+ # @note This operation can make a static sandbox call.
148
+ # @param body [Hash] The payload of the request.
149
+ # @param dest_account_digital_signature [String] Digital signature for the destination bank account details.
150
+ # @param amount_digital_signature [String] Digital signature for the source currency transaction amount.
151
+ # @return [Peddler::Response] The API response
152
+ def create_transfer_schedule(body, dest_account_digital_signature, amount_digital_signature)
153
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules"
154
+
155
+ post(path, body:)
156
+ end
157
+
158
+ # Update transfer schedule information. Returns a transfer belonging to the updated scheduled transfer request.
159
+ #
160
+ # @note This operation can make a static sandbox call.
161
+ # @param body [Hash] The payload of the scheduled transfer request that is to be updated.
162
+ # @param dest_account_digital_signature [String] Digital signature for the destination bank account details.
163
+ # @param amount_digital_signature [String] Digital signature for the source currency transaction amount.
164
+ # @return [Peddler::Response] The API response
165
+ def update_transfer_schedule(body, dest_account_digital_signature, amount_digital_signature)
166
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules"
167
+
168
+ put(path, body:)
169
+ end
170
+
171
+ # Find a particular Amazon Seller Wallet account transfer schedule.
172
+ #
173
+ # @note This operation can make a static sandbox call.
174
+ # @param transfer_schedule_id [String] The schedule ID of the Amazon Seller Wallet transfer.
175
+ # @return [Peddler::Response] The API response
176
+ def get_transfer_schedule(transfer_schedule_id)
177
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{transfer_schedule_id}"
178
+
179
+ get(path)
180
+ end
181
+
182
+ # Delete a transaction request that is scheduled from Amazon Seller Wallet account to another customer-provided
183
+ # account.
184
+ #
185
+ # @note This operation can make a static sandbox call.
186
+ # @param transfer_schedule_id [String] A unique reference ID for a scheduled transfer.
187
+ # @return [Peddler::Response] The API response
188
+ def delete_schedule_transaction(transfer_schedule_id)
189
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{transfer_schedule_id}"
190
+
191
+ delete(path)
192
+ end
193
+ end
194
+ end
195
+ end