Class: AmazonPay::AmazonWebStoreClient
- Inherits:
-
AmazonPayClient
- Object
- AmazonPayClient
- AmazonPay::AmazonWebStoreClient
- Defined in:
- lib/amazon_pay/amazon_web_store_client.rb
Overview
Class for Amazon Web Store
Instance Method Summary collapse
-
#cancel_charge(charge_id: nil, payload: nil, headers: nil) ⇒ Object
API to create a cancelCharge request - Cancels an existing charge.
-
#capture_charge(charge_id: nil, payload: nil, headers: nil) ⇒ Object
API to create a captureCharge request - Captures an existing charge @see amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge.html#capture-charge @param String charge_id - The charge Id @param Hash payload - The payload for the request @param Hash [headers=nil] - The headers for the request.
-
#close_charge_permission(charge_permission_id: nil, payload: nil, headers: nil) ⇒ Object
API to close a ChargePermission Hash - Closes a perviously created ChargePermission Hash.
-
#complete_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) ⇒ Object
API to complete a Checkout Session - Confirms the completion of buyer checkout.
-
#create_charge(payload: nil, headers: nil) ⇒ Object
API to create a Charge Hash - Creates a new Charge Hash.
-
#create_checkout_session(payload: nil, headers: nil) ⇒ Object
API to create a CheckoutSession Hash - Creates a new CheckoutSession Hash.
-
#create_refund(payload: nil, headers: nil) ⇒ Object
API to create a Refund Hash - Generates a refund.
-
#get_buyer(buyer_token: nil, headers: nil) ⇒ Object
API to get the Buyer Hash - Get Buyer details can include buyer ID, name, email address, postal code, and country code - when used with the Amazon.Pay.renderButton ‘SignIn’ productType and corresponding signInScopes @param String buyer_token - The checkout session Id @param Hash [headers=nil] - The headers for the request.
-
#get_charge(charge_id: nil, headers: nil) ⇒ Object
API to get the Charge Hash - Retrieves a perviously created Charge Hash.
-
#get_charge_permission(charge_permission_id: nil, headers: nil) ⇒ Object
API to get a ChargePermission Hash - Retrives details of a previously created ChargePermission Hash.
-
#get_checkout_session(checkout_session_id: nil, headers: nil) ⇒ Object
API to get the CheckoutSession Hash - Retrives details of a previously created CheckoutSession Hash.
-
#get_refund(refund_id: nil, headers: nil) ⇒ Object
API to get a Refund Hash - Retreives details of an existing refund.
-
#initialize(config_args) ⇒ AmazonWebStoreClient
constructor
A new instance of AmazonWebStoreClient.
-
#update_charge_permission(charge_permission_id: nil, payload: nil, headers: nil) ⇒ Object
API to update a ChargePermission Hash - Updates a previously created ChargePermission Hash.
-
#update_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) ⇒ Object
API to update the CheckoutSession Hash - Updates a previously created CheckoutSession Hash.
Methods inherited from AmazonPayClient
#api_call, #delivery_trackers, #generate_button_signature, #get_authorization_token, #get_signed_headers
Constructor Details
#initialize(config_args) ⇒ AmazonWebStoreClient
Returns a new instance of AmazonWebStoreClient.
6 7 8 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 6 def initialize(config_args) super(config_args) end |
Instance Method Details
#cancel_charge(charge_id: nil, payload: nil, headers: nil) ⇒ Object
API to create a cancelCharge request
- Cancels an existing charge.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge.html#cancel-charge
@param {String} charge_id - The charge Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
177 178 179 180 181 182 183 184 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 177 def cancel_charge(charge_id: nil, payload: nil, headers: nil) api_call(options: { method: 'DELETE', url_fragment: "charges/#{charge_id}/cancel", payload: payload, headers: headers }) end |
#capture_charge(charge_id: nil, payload: nil, headers: nil) ⇒ Object
API to create a captureCharge request
- Captures an existing charge
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge.html#capture-charge
@param {String} charge_id - The charge Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
161 162 163 164 165 166 167 168 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 161 def capture_charge(charge_id: nil, payload: nil, headers: nil) api_call(options: { method: 'POST', url_fragment: "charges/#{charge_id}/capture", payload: payload, headers: headers }) end |
#close_charge_permission(charge_permission_id: nil, payload: nil, headers: nil) ⇒ Object
API to close a ChargePermission Hash
- Closes a perviously created ChargePermission Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge-.html#close-charge-permission
@param {String} - The charge Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
118 119 120 121 122 123 124 125 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 118 def (charge_permission_id: nil, payload: nil, headers: nil) api_call(options: { method: 'DELETE', url_fragment: "chargePermissions/#{charge_permission_id}/close", payload: payload, headers: headers }) end |
#complete_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) ⇒ Object
API to complete a Checkout Session
- Confirms the completion of buyer checkout.
@see //TODO Update Live URL
@param {String} checkout_session_id - The checkout session Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
75 76 77 78 79 80 81 82 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 75 def complete_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) api_call(options: { method: 'POST', url_fragment: "checkoutSessions/#{checkout_session_id}/complete", payload: payload, headers: headers }) end |
#create_charge(payload: nil, headers: nil) ⇒ Object
API to create a Charge Hash
- Creates a new Charge Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge.html#create-charge
@param {Hash} payload - The payload for the request
@param {Hash} headers - The headers for the request
132 133 134 135 136 137 138 139 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 132 def create_charge(payload: nil, headers: nil) api_call(options: { method: 'POST', url_fragment: 'charges', payload: payload, headers: headers }) end |
#create_checkout_session(payload: nil, headers: nil) ⇒ Object
API to create a CheckoutSession Hash
- Creates a new CheckoutSession Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/checkout-session.html#create-checkout-session
@param {Hash} payload - The payload for the request
@param {Hash} headers - The headers for the request
32 33 34 35 36 37 38 39 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 32 def create_checkout_session(payload: nil, headers: nil) api_call(options: { method: 'POST', url_fragment: 'checkoutSessions', payload: payload, headers: headers }) end |
#create_refund(payload: nil, headers: nil) ⇒ Object
API to create a Refund Hash
- Generates a refund.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/refund.html#create-refund
@param {Hash} payload - The payload for the request
@param {Hash} headers - The headers for the request
192 193 194 195 196 197 198 199 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 192 def create_refund(payload: nil, headers: nil) api_call(options: { method: 'POST', url_fragment: 'refunds', payload: payload, headers: headers }) end |
#get_buyer(buyer_token: nil, headers: nil) ⇒ Object
API to get the Buyer Hash
- Get Buyer details can include buyer ID, name, email address, postal code,
and country code
- when used with the Amazon.Pay.renderButton 'SignIn' productType and corresponding
signInScopes
@param {String} buyer_token - The checkout session Id
@param {Hash} [headers=nil] - The headers for the request
18 19 20 21 22 23 24 25 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 18 def get_buyer(buyer_token: nil, headers: nil) api_call(options: { method: 'GET', url_fragment: "buyers/#{buyer_token}", headers: headers }) end |
#get_charge(charge_id: nil, headers: nil) ⇒ Object
API to get the Charge Hash
- Retrieves a perviously created Charge Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge.html#get-charge
@param {String} charge_id - The charge Id
@param {Hash} [headers=nil] - The headers for the request
146 147 148 149 150 151 152 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 146 def get_charge(charge_id: nil, headers: nil) api_call(options: { method: 'GET', url_fragment: "charges/#{charge_id}", headers: headers }) end |
#get_charge_permission(charge_permission_id: nil, headers: nil) ⇒ Object
API to get a ChargePermission Hash
- Retrives details of a previously created ChargePermission Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge-.html#get-charge-permission
@param {String} - The charge Id
@param {Hash} [headers=nil] - The headers for the request
89 90 91 92 93 94 95 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 89 def (charge_permission_id: nil, headers: nil) api_call(options: { method: 'GET', url_fragment: "chargePermissions/#{charge_permission_id}", headers: headers }) end |
#get_checkout_session(checkout_session_id: nil, headers: nil) ⇒ Object
API to get the CheckoutSession Hash
- Retrives details of a previously created CheckoutSession Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/checkout-session.html#get-checkout-session
@param {String} checkout_session_id - The checkout session Id
@param {Hash} [headers=nil] - The headers for the request
46 47 48 49 50 51 52 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 46 def get_checkout_session(checkout_session_id: nil, headers: nil) api_call(options: { method: 'GET', url_fragment: "checkoutSessions/#{checkout_session_id}", headers: headers }) end |
#get_refund(refund_id: nil, headers: nil) ⇒ Object
API to get a Refund Hash
- Retreives details of an existing refund.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/refund.html#get-refund
@param {String} refundId - The refund Id
@param {Hash} [headers=nil] - The headers for the request
207 208 209 210 211 212 213 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 207 def get_refund(refund_id: nil, headers: nil) api_call(options: { method: 'GET', url_fragment: "refunds/#{refund_id}", headers: headers }) end |
#update_charge_permission(charge_permission_id: nil, payload: nil, headers: nil) ⇒ Object
API to update a ChargePermission Hash
- Updates a previously created ChargePermission Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/charge-.html#update-charge-permission
@param {String} - The charge Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
103 104 105 106 107 108 109 110 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 103 def (charge_permission_id: nil, payload: nil, headers: nil) api_call(options: { method: 'PATCH', url_fragment: "chargePermissions/#{charge_permission_id}", payload: payload, headers: headers }) end |
#update_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) ⇒ Object
API to update the CheckoutSession Hash
- Updates a previously created CheckoutSession Hash.
@see https://amazonpaycheckoutintegrationguide.s3.amazonaws.com/amazon-pay-api-v2/checkout-session.html#update-checkout-session
@param {String} checkout_session_id - The checkout session Id
@param {Hash} payload - The payload for the request
@param {Hash} [headers=nil] - The headers for the request
60 61 62 63 64 65 66 67 |
# File 'lib/amazon_pay/amazon_web_store_client.rb', line 60 def update_checkout_session(checkout_session_id: nil, payload: nil, headers: nil) api_call(options: { method: 'PATCH', url_fragment: "checkoutSessions/#{checkout_session_id}", payload: payload, headers: headers }) end |