amazon-pay-api-sdk-ruby 2.0.0 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 439cdb07dc4f4d22baaf1d26710a1163cfedd565a6d56a5d0e61b0afdcc2c981
4
- data.tar.gz: 358f1dfb78f49d1270dc4a457e5664959a40aae6dec6db51476ec6e57e926853
3
+ metadata.gz: 176034301db14de72484334e1952fbb1e7988eb9affc0a9cdeb881eb1ec195a2
4
+ data.tar.gz: 63074ee096c0cf39d4b0034f697242152c8f821ec75205b8518d742d15681d54
5
5
  SHA512:
6
- metadata.gz: 2e14bc560974f5c2dd0078f8b676bc9b41d7c0a02da6e9cce9fb6f2837f16ed2007261f307fffe2e5ec022813d5f8884a6783d49bbb300059717349afce8f488
7
- data.tar.gz: 6181e925f7943ec0d8d89b9af328c0a89433b6ecadc897ac07d10451dd75f58fc17ef3843f4b853385e531d8581da7474496bf9199b970c8cac08a223b134133
6
+ metadata.gz: c7b5826e238173968ee21025c3e072e634935d64e512856bf86254a924746203b957f374d7ea9b22cdd0eadfb70ad6b46bb91b06bc36e47904996553c19484c0
7
+ data.tar.gz: 72bc8c3640a675d47badf5db8647c82695efa23fcd9b6b2e4ed897ce4f86d8edf730f208f82536964f0ed55a3bbf9ec0f37c53bb25398dbba864b47ffd008768
data/README.md CHANGED
@@ -775,6 +775,7 @@ end
775
775
  ```
776
776
 
777
777
  ### Create Dispute API
778
+ #### NOTE: This API is intended to be called only by PSPs (Payment Service Providers).
778
779
 
779
780
  ```ruby
780
781
  creation_timestamp = Time.now.to_i
@@ -812,6 +813,19 @@ else
812
813
  end
813
814
  ```
814
815
 
816
+ ### Get Dispute API
817
+ ```ruby
818
+ response = client.get_dispute('S03-XXXXXX-XXXXXX-XXXXXX')
819
+ if response.code.to_i == 200
820
+ puts "Get Dispute API Response:"
821
+ puts response.body
822
+ else
823
+ puts "Error: Get Dispute API"
824
+ puts "Status: #{response.code}"
825
+ puts response.body
826
+ end
827
+ ```
828
+
815
829
  ### Update Dispute API
816
830
 
817
831
  ```ruby
@@ -893,4 +907,53 @@ else
893
907
  puts "Status: #{response.code}"
894
908
  puts response.body
895
909
  end
910
+ ```
911
+
912
+ ### Create Store
913
+
914
+ ```ruby
915
+ create_store_payload = {
916
+ "allowedOriginDomains": ["https://example.com", "https://www.example.com"],
917
+ "allowedRedirectURLs": ["https://example.com/return", "https://example.com/cancel"],
918
+ "storeName": "My Store",
919
+ "privacyPolicyUrl": "https://example.com/privacy",
920
+ "merchantLogoUrl": "https://example.com/logo.png"
921
+ }
922
+
923
+ merchant_account_id = "MERCHANT_ACCOUNT_ID"
924
+
925
+ response = client.create_store(merchant_account_id, create_store_payload, headers: {})
926
+ if response.code.to_i == 201
927
+ puts "Create Store API Response:"
928
+ puts response.body
929
+ else
930
+ puts "Error: Create Store API"
931
+ puts "Status: #{response.code}"
932
+ puts response.body
933
+ end
934
+ ```
935
+
936
+ ### Update Store
937
+
938
+ ```ruby
939
+ update_store_payload = {
940
+ "allowedOriginDomains": ["https://example.com", "https://www.example.com", "https://shop.example.com"],
941
+ "allowedRedirectURLs": ["https://example.com/return", "https://example.com/cancel"],
942
+ "storeName": "Updated Store Name",
943
+ "privacyPolicyUrl": "https://example.com/privacy-updated",
944
+ "merchantLogoUrl": "https://example.com/new-logo.png"
945
+ }
946
+
947
+ merchant_account_id = "MERCHANT_ACCOUNT_ID"
948
+ store_id = "STORE_ID"
949
+
950
+ response = client.update_store(merchant_account_id, store_id, update_store_payload, headers: {})
951
+ if response.code.to_i == 200
952
+ puts "Update Store API Response:"
953
+ puts response.body
954
+ else
955
+ puts "Error: Update Store API"
956
+ puts "Status: #{response.code}"
957
+ puts response.body
958
+ end
896
959
  ```
@@ -2,7 +2,7 @@ require 'net/http'
2
2
 
3
3
  module Constants
4
4
  SDK_TYPE = "amazon-pay-api-sdk-ruby".freeze
5
- SDK_VERSION = "2.0.0".freeze
5
+ SDK_VERSION = "2.2.0".freeze
6
6
  API_VERSION = "v2".freeze
7
7
  API_ENDPOINTS = {
8
8
  'na' => 'pay-api.amazon.com',
@@ -38,7 +38,7 @@ module Constants
38
38
  DELETE = 'DELETE'.freeze
39
39
  MAX_RETRIES = 3.freeze
40
40
  BACKOFF_TIMES = [1, 2, 4].freeze # Define backoff times for retries
41
- RETRYABLE_ERROR_CODES = [408, 429, 500, 502, 503, 504].freeze
41
+ RETRYABLE_ERROR_CODES = [408, 425, 429, 500, 502, 503, 504].freeze
42
42
  HTTP_OK = '200'
43
43
  HTTP_SERVER_ERROR = '500'
44
44
  BUYERS_URL = 'buyers'.freeze
@@ -52,6 +52,7 @@ module Constants
52
52
  DISBURSEMENTS = 'disbursements'.freeze
53
53
  DISPUTE_URLS = 'disputes'.freeze
54
54
  FILES_URLS = 'files'.freeze
55
+ STORES_URL = 'stores'.freeze
55
56
  DISPUTE_FILING_REASON = {
56
57
  PRODUCT_NOT_RECEIVED: "ProductNotReceived",
57
58
  PRODUCT_UNACCEPTABLE: "ProductUnacceptable",
@@ -92,6 +93,10 @@ module Constants
92
93
  CANCELLATION_POLICY: "CancellationPolicy",
93
94
  CUSTOMER_SIGNATURE: "CustomerSignature",
94
95
  TRACKING_NUMBER: "TrackingNumber",
96
+ CARRIER_NAME: "CarrierName",
97
+ DEVICE_ID: "DeviceId",
98
+ DEVICE_NAME: "DeviceName",
99
+ DOWNLOAD_DATE_TIME: "DownloadDateTime",
95
100
  OTHER: "Other"
96
101
  }.freeze
97
- end
102
+ end
@@ -1,8 +1,8 @@
1
1
  module PaymentServiceProviderClient
2
2
  # API to create dispute.
3
3
  # The createDispute operation is used to notify Amazon of a newly created chargeback dispute by a buyer on a
4
- # transaction processed by the PSP (Payment Service Provider), ensuring the dispute is properly accounted for in the Amazon Pay systems.
5
- # @see https://developer.amazon.com/docs/amazon-pay-apis/dispute.html/#create-dispute
4
+ # transaction processed only by the PSP (Payment Service Provider), ensuring the dispute is properly accounted for in the Amazon Pay systems.
5
+ # NOTE: This API is intended to be called only by PSPs (Payment Service Providers).
6
6
  # @param {Object} payload - The payload containing statusDetails.
7
7
  # @param {Object} headers - Requires : x-amz-pay-idempotency-key, Optional headers for the request, such as authorization tokens or custom headers.
8
8
  # @return [HTTPResponse] The response from the API call, which includes details of the dispute.
@@ -10,10 +10,17 @@ module PaymentServiceProviderClient
10
10
  api_call(Constants::DISPUTE_URLS, Constants::POST, payload: payload, headers: headers)
11
11
  end
12
12
 
13
+ # API to get dispute.
14
+ # The getDispute operation is used to retrieve details of a chargeback dispute associated with a specific order
15
+ # @param {Object} headers - Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.
16
+ # @return [HTTPResponse] The response from the API call, which includes details of the dispute.
17
+ def get_dispute(dispute_id, headers: {});
18
+ api_call("#{Constants::DISPUTE_URLS}/#{dispute_id}", Constants::GET, headers: headers)
19
+ end
20
+
13
21
  # API to update dispute.
14
22
  # The updateDispute operation is used to notify Amazon of the closure status of a chargeback dispute initiated by a
15
- # buyer for orders processed by a partner PSP (Payment Service Provider), ensuring proper accounting within the Amazon systems.
16
- # @see https://developer.amazon.com/docs/amazon-pay-apis/dispute.html/#update-dispute
23
+ # buyer for orders, ensuring proper accounting within the Amazon systems.
17
24
  # @param {String} dispute_id - The unique ID of the dispute to retrieve.
18
25
  # @param {Object} payload - The payload containing statusDetails.
19
26
  # @param {Object} headers - Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.
@@ -26,7 +33,6 @@ module PaymentServiceProviderClient
26
33
  # The contestDispute operation is used by the partner, on behalf of the merchant, to formally contest a dispute
27
34
  # managed by Amazon, requiring the submission of necessary evidence files within the specified
28
35
  # Dispute Window (11 days for Chargeback, 7 days for A-Z Claims).
29
- # @see https://developer.amazon.com/docs/amazon-pay-apis/dispute.html/#contest-dispute
30
36
  # @param {String} dispute_id - The unique ID of the dispute to retrieve.
31
37
  # @param {Object} payload - The payload containing statusDetails.
32
38
  # @param {Object} headers - Optional headers for the request, such as x-amz-pay-idempotency-key, authorization tokens or custom headers.
@@ -36,13 +42,37 @@ module PaymentServiceProviderClient
36
42
  end
37
43
 
38
44
  # API to upload file.
39
- # The uploadFile operation is utilised by PSPs (Payment Service Provider) to upload file-based evidence when a
45
+ # The uploadFile operation is utilised to upload file-based evidence when a
40
46
  # merchant contests a dispute, providing the necessary reference ID to the evidence file as part of
41
47
  # the Update Dispute API process.
42
- # @see https://developer.amazon.com/docs/amazon-pay-apis/file.html#upload-a-file
43
48
  # @param {Object} headers - Requires : x-amz-pay-idempotency-key, Optional headers for the request, such as authorization tokens or custom headers.
44
49
  # @return [HTTPResponse] The response from the API call, which includes details of the file.
45
50
  def upload_file(payload, headers: {});
46
51
  api_call(Constants::FILES_URLS, Constants::POST, payload: payload, headers: headers)
47
52
  end
48
- end
53
+
54
+ # API to create store.
55
+ # The createStore operation is used to create a new store for a merchant account.
56
+ # This allows merchants to configure store-specific settings like allowed domains, redirect URLs,
57
+ # store name, privacy policy URL, merchant logo URL, and store status.
58
+ # @param {String} merchant_account_id - The unique ID of the merchant account to create the store for.
59
+ # @param {Object} payload - The payload containing store configuration details.
60
+ # @param {Object} headers - Optional headers for the request, such as authorization tokens or custom headers.
61
+ # @return [HTTPResponse] The response from the API call, which includes details of the created store.
62
+ def create_store(merchant_account_id, payload, headers: {})
63
+ api_call("#{Constants::MERCHANT_ACCOUNTS_BASE_URL}/#{merchant_account_id}/#{Constants::STORES_URL}", Constants::POST, payload: payload, headers: headers)
64
+ end
65
+
66
+ # API to update store.
67
+ # The updateStore operation is used to update an existing store's configuration.
68
+ # This allows merchants to modify store-specific settings like allowed domains, redirect URLs,
69
+ # store name, privacy policy URL, merchant logo URL, and store status.
70
+ # @param {String} merchant_account_id - The unique ID of the merchant account that owns the store.
71
+ # @param {String} store_id - The unique ID of the store to update.
72
+ # @param {Object} payload - The payload containing updated store configuration details.
73
+ # @param {Object} headers - Optional headers for the request, such as authorization tokens or custom headers.
74
+ # @return [HTTPResponse] The response from the API call, which includes details of the updated store.
75
+ def update_store(merchant_account_id, store_id, payload, headers: {})
76
+ api_call("#{Constants::MERCHANT_ACCOUNTS_BASE_URL}/#{merchant_account_id}/#{Constants::STORES_URL}/#{store_id}", Constants::PATCH, payload: payload, headers: headers)
77
+ end
78
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon-pay-api-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AmazonPay
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-11 00:00:00.000000000 Z
11
+ date: 2025-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -56,7 +56,7 @@ licenses:
56
56
  - Apache-2.0
57
57
  metadata:
58
58
  source_code_uri: https://github.com/amzn/amazon-pay-api-sdk-ruby
59
- post_install_message:
59
+ post_install_message:
60
60
  rdoc_options: []
61
61
  require_paths:
62
62
  - lib
@@ -71,8 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.5.4
75
- signing_key:
74
+ rubygems_version: 3.0.3.1
75
+ signing_key:
76
76
  specification_version: 4
77
77
  summary: This is an AmazonPay Ruby SDK
78
78
  test_files: []