Class: PayWithAmazon::Client
- Inherits:
-
Object
- Object
- PayWithAmazon::Client
- Defined in:
- lib/pay_with_amazon/client.rb
Overview
Pay with Amazon API
This client allows you to make all the necessary API calls to integrate with Login and Pay with Amazon. This client only uses the standard Ruby library and is not dependant on Rails.
Constant Summary collapse
- MAX_RETRIES =
4
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#application_name ⇒ Object
readonly
Returns the value of attribute application_name.
-
#application_version ⇒ Object
readonly
Returns the value of attribute application_version.
-
#currency_code ⇒ Object
readonly
Returns the value of attribute currency_code.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#platform_id ⇒ Object
readonly
Returns the value of attribute platform_id.
-
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
-
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
-
#throttle ⇒ Object
readonly
Returns the value of attribute throttle.
Instance Method Summary collapse
-
#authorize(amazon_order_reference_id, authorization_reference_id, amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Reserves a specified amount against the payment method(s) stored in the order reference.
-
#authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: false, soft_descriptor: nil, seller_note: nil, platform_id: nil, custom_information: nil, seller_order_id: nil, store_name: nil, inherit_shipping_adderess: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Reserves a specified amount against the payment method(s) stored in the billing agreement.
-
#cancel_order_reference(amazon_order_reference_id, cancelation_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Cancels a previously confirmed order reference.
-
#capture(amazon_authorization_id, capture_reference_id, amount, currency_code: @currency_code, seller_capture_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Captures funds from an authorized payment instrument.
-
#close_authorization(amazon_authorization_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Closes an authorization.
-
#close_billing_agreement(amazon_billing_agreement_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that you want to terminate the billing agreement with the buyer and that you do not expect to create any new order references or authorizations on this billing agreement.
-
#close_order_reference(amazon_order_reference_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that an order reference has been fulfilled (fully or partially) and that you do not expect to create any new authorizations on this order reference.
-
#confirm_billing_agreement(amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that the billing agreement is free of constraints and all required information has been set on the billing agreement.
-
#confirm_order_reference(amazon_order_reference_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that the order reference is free of constraints and all required information has been set on the order reference.
-
#create_order_reference_for_id(id, id_type, inherit_shipping_address: nil, confirm_now: nil, amount: nil, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Creates an order reference for the given object.
-
#get_authorization_details(amazon_authorization_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular authorization and the total amount captured on the authorization.
-
#get_billing_agreement_details(amazon_billing_agreement_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns details about the Billing Agreement object and its current state.
-
#get_capture_details(amazon_capture_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular capture and the total amount refunded on the capture.
-
#get_order_reference_details(amazon_order_reference_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns details about the Order Reference object and its current state.
-
#get_refund_details(amazon_refund_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular refund.
-
#get_service_status ⇒ Object
Returns the operational status of the Off-Amazon Payments API section The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API section of Amazon Marketplace Web Service (Amazon MWS).
-
#initialize(merchant_id, access_key, secret_key, sandbox: false, currency_code: :usd, region: :na, platform_id: nil, throttle: true, application_name: nil, application_version: nil, proxy_addr: :ENV, proxy_port: nil, proxy_user: nil, proxy_pass: nil) ⇒ Client
constructor
API keys are located at:.
-
#refund(amazon_capture_id, refund_reference_id, amount, currency_code: @currency_code, seller_refund_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Refunds a previously captured amount.
-
#set_billing_agreement_details(amazon_billing_agreement_id, platform_id: nil, seller_note: nil, seller_billing_agreement_id: nil, custom_information: nil, store_name: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Sets billing agreement details such as a description of the agreement and other information about the seller.
-
#set_order_reference_details(amazon_order_reference_id, amount, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Sets order reference details such as the order total and a description for the order.
-
#validate_billing_agreement(amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Validates the status of the BillingAgreement object and the payment method associated with it.
Constructor Details
#initialize(merchant_id, access_key, secret_key, sandbox: false, currency_code: :usd, region: :na, platform_id: nil, throttle: true, application_name: nil, application_version: nil, proxy_addr: :ENV, proxy_port: nil, proxy_user: nil, proxy_pass: nil) ⇒ Client
API keys are located at:
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/pay_with_amazon/client.rb', line 54 def initialize( merchant_id, access_key, secret_key, sandbox: false, currency_code: :usd, region: :na, platform_id: nil, throttle: true, application_name: nil, application_version: nil, proxy_addr: :ENV, proxy_port: nil, proxy_user: nil, proxy_pass: nil) @merchant_id = merchant_id @access_key = access_key @secret_key = secret_key @currency_code = currency_code.to_s.upcase @sandbox = sandbox @sandbox_str = @sandbox ? 'OffAmazonPayments_Sandbox' : 'OffAmazonPayments' @region = region @mws_endpoint = region_hash[@region] ? region_hash[@region] : raise("Invalid Region Code. (#{@region})") @platform_id = platform_id @throttle = throttle @application_name = application_name @application_version = application_version @proxy_addr = proxy_addr @proxy_port = proxy_port @proxy_user = proxy_user @proxy_pass = proxy_pass @default_hash = { 'AWSAccessKeyId' => @access_key, 'SignatureMethod' => 'HmacSHA256', 'SignatureVersion' => '2', 'Timestamp' => Time.now.utc.iso8601, 'Version' => PayWithAmazon::API_VERSION } @default_hash['PlatformId'] = @platform_id if @platform_id end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def access_key @access_key end |
#application_name ⇒ Object (readonly)
Returns the value of attribute application_name.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def application_name @application_name end |
#application_version ⇒ Object (readonly)
Returns the value of attribute application_version.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def application_version @application_version end |
#currency_code ⇒ Object (readonly)
Returns the value of attribute currency_code.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def currency_code @currency_code end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def merchant_id @merchant_id end |
#platform_id ⇒ Object (readonly)
Returns the value of attribute platform_id.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def platform_id @platform_id end |
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
31 32 33 |
# File 'lib/pay_with_amazon/client.rb', line 31 def proxy_addr @proxy_addr end |
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
31 32 33 |
# File 'lib/pay_with_amazon/client.rb', line 31 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
31 32 33 |
# File 'lib/pay_with_amazon/client.rb', line 31 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
31 32 33 |
# File 'lib/pay_with_amazon/client.rb', line 31 def proxy_user @proxy_user end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def region @region end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def sandbox @sandbox end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def secret_key @secret_key end |
#throttle ⇒ Object (readonly)
Returns the value of attribute throttle.
19 20 21 |
# File 'lib/pay_with_amazon/client.rb', line 19 def throttle @throttle end |
Instance Method Details
#authorize(amazon_order_reference_id, authorization_reference_id, amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Reserves a specified amount against the payment method(s) stored in the order reference
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/pay_with_amazon/client.rb', line 501 def ( amazon_order_reference_id, , amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'Authorize', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id, 'AuthorizationReferenceId' => , 'AuthorizationAmount.Amount' => amount, 'AuthorizationAmount.CurrencyCode' => currency_code } optional = { 'SellerAuthorizationNote' => , 'TransactionTimeout' => transaction_timeout, 'CaptureNow' => capture_now, 'SoftDescriptor' => soft_descriptor, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#authorize_on_billing_agreement(amazon_billing_agreement_id, authorization_reference_id, amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: false, soft_descriptor: nil, seller_note: nil, platform_id: nil, custom_information: nil, seller_order_id: nil, store_name: nil, inherit_shipping_adderess: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Reserves a specified amount against the payment method(s) stored in the billing agreement
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/pay_with_amazon/client.rb', line 295 def ( amazon_billing_agreement_id, , amount, currency_code: @currency_code, seller_authorization_note: nil, transaction_timeout: nil, capture_now: false, soft_descriptor: nil, seller_note: nil, platform_id: nil, custom_information: nil, seller_order_id: nil, store_name: nil, inherit_shipping_adderess: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'AuthorizeOnBillingAgreement', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id, 'AuthorizationReferenceId' => , 'AuthorizationAmount.Amount' => amount, 'AuthorizationAmount.CurrencyCode' => currency_code } optional = { 'SellerAuthorizationNote' => , 'TransactionTimeout' => transaction_timeout, 'CaptureNow' => capture_now, 'SoftDescriptor' => soft_descriptor, 'SellerNote' => seller_note, 'PlatformId' => platform_id, 'SellerOrderAttributes.CustomInformation' => custom_information, 'SellerOrderAttributes.SellerOrderId' => seller_order_id, 'SellerOrderAttributes.StoreName' => store_name, 'InheritShippingAddress' => inherit_shipping_adderess, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#cancel_order_reference(amazon_order_reference_id, cancelation_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Cancels a previously confirmed order reference
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/pay_with_amazon/client.rb', line 468 def cancel_order_reference( amazon_order_reference_id, cancelation_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'CancelOrderReference', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id } optional = { 'CancelationReason' => cancelation_reason, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#capture(amazon_authorization_id, capture_reference_id, amount, currency_code: @currency_code, seller_capture_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Captures funds from an authorized payment instrument.
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/pay_with_amazon/client.rb', line 567 def capture( , capture_reference_id, amount, currency_code: @currency_code, seller_capture_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'Capture', 'SellerId' => merchant_id, 'AmazonAuthorizationId' => , 'CaptureReferenceId' => capture_reference_id, 'CaptureAmount.Amount' => amount, 'CaptureAmount.CurrencyCode' => currency_code } optional = { 'SellerCaptureNote' => seller_capture_note, 'SoftDescriptor' => soft_descriptor, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#close_authorization(amazon_authorization_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Closes an authorization
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 |
# File 'lib/pay_with_amazon/client.rb', line 686 def ( , closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'CloseAuthorization', 'SellerId' => merchant_id, 'AmazonAuthorizationId' => } optional = { 'ClosureReason' => closure_reason, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#close_billing_agreement(amazon_billing_agreement_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that you want to terminate the billing agreement with the buyer and that you do not expect to create any new order references or authorizations on this billing agreement
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/pay_with_amazon/client.rb', line 347 def close_billing_agreement( amazon_billing_agreement_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'CloseBillingAgreement', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id } optional = { 'ClosureReason' => closure_reason, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#close_order_reference(amazon_order_reference_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that an order reference has been fulfilled (fully or partially) and that you do not expect to create any new authorizations on this order reference
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 |
# File 'lib/pay_with_amazon/client.rb', line 714 def close_order_reference( amazon_order_reference_id, closure_reason: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'CloseOrderReference', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id } optional = { 'ClosureReason' => closure_reason, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#confirm_billing_agreement(amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that the billing agreement is free of constraints and all required information has been set on the billing agreement
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/pay_with_amazon/client.rb', line 234 def confirm_billing_agreement( amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'ConfirmBillingAgreement', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#confirm_order_reference(amazon_order_reference_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Confirms that the order reference is free of constraints and all required information has been set on the order reference
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/pay_with_amazon/client.rb', line 444 def confirm_order_reference( amazon_order_reference_id, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'ConfirmOrderReference', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#create_order_reference_for_id(id, id_type, inherit_shipping_address: nil, confirm_now: nil, amount: nil, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Creates an order reference for the given object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/pay_with_amazon/client.rb', line 125 def create_order_reference_for_id( id, id_type, inherit_shipping_address: nil, confirm_now: nil, amount: nil, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'CreateOrderReferenceForId', 'SellerId' => merchant_id, 'Id' => id, 'IdType' => id_type } optional = { 'InheritShippingAddress' => inherit_shipping_address, 'ConfirmNow' => confirm_now, 'OrderReferenceAttributes.OrderTotal.Amount' => amount, 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => currency_code, 'OrderReferenceAttributes.PlatformId' => platform_id, 'OrderReferenceAttributes.SellerNote' => seller_note, 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => seller_order_id, 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => store_name, 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation' => custom_information, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_authorization_details(amazon_authorization_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular authorization and the total amount captured on the authorization
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/pay_with_amazon/client.rb', line 539 def ( , merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'GetAuthorizationDetails', 'SellerId' => merchant_id, 'AmazonAuthorizationId' => } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_billing_agreement_details(amazon_billing_agreement_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns details about the Billing Agreement object and its current state
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/pay_with_amazon/client.rb', line 169 def get_billing_agreement_details( amazon_billing_agreement_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'GetBillingAgreementDetails', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id } optional = { 'AddressConsentToken' => , 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_capture_details(amazon_capture_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular capture and the total amount refunded on the capture
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 |
# File 'lib/pay_with_amazon/client.rb', line 601 def get_capture_details( amazon_capture_id, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'GetCaptureDetails', 'SellerId' => merchant_id, 'AmazonCaptureId' => amazon_capture_id } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_order_reference_details(amazon_order_reference_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns details about the Order Reference object and its current state
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/pay_with_amazon/client.rb', line 373 def get_order_reference_details( amazon_order_reference_id, address_consent_token: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'GetOrderReferenceDetails', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id } optional = { 'AddressConsentToken' => , 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_refund_details(amazon_refund_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Returns the status of a particular refund
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/pay_with_amazon/client.rb', line 662 def get_refund_details( amazon_refund_id, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'GetRefundDetails', 'SellerId' => merchant_id, 'AmazonRefundId' => amazon_refund_id } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#get_service_status ⇒ Object
Returns the operational status of the Off-Amazon Payments API section The GetServiceStatus operation returns the operational status of the Off-Amazon Payments API section of Amazon Marketplace Web Service (Amazon MWS). Status values are GREEN, GREEN_I, YELLOW, and RED.
102 103 104 105 106 107 108 |
# File 'lib/pay_with_amazon/client.rb', line 102 def get_service_status parameters = { 'Action' => 'GetServiceStatus' } operation(parameters, {}) end |
#refund(amazon_capture_id, refund_reference_id, amount, currency_code: @currency_code, seller_refund_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Refunds a previously captured amount
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/pay_with_amazon/client.rb', line 629 def refund( amazon_capture_id, refund_reference_id, amount, currency_code: @currency_code, seller_refund_note: nil, soft_descriptor: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'Refund', 'SellerId' => merchant_id, 'AmazonCaptureId' => amazon_capture_id, 'RefundReferenceId' => refund_reference_id, 'RefundAmount.Amount' => amount, 'RefundAmount.CurrencyCode' => currency_code } optional = { 'SellerRefundNote' => seller_refund_note, 'SoftDescriptor' => soft_descriptor, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#set_billing_agreement_details(amazon_billing_agreement_id, platform_id: nil, seller_note: nil, seller_billing_agreement_id: nil, custom_information: nil, store_name: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Sets billing agreement details such as a description of the agreement and other information about the seller.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/pay_with_amazon/client.rb', line 200 def set_billing_agreement_details( amazon_billing_agreement_id, platform_id: nil, seller_note: nil, seller_billing_agreement_id: nil, custom_information: nil, store_name: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'SetBillingAgreementDetails', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id } optional = { 'BillingAgreementAttributes.PlatformId' => platform_id, 'BillingAgreementAttributes.SellerNote' => seller_note, 'BillingAgreementAttributes.SellerBillingAgreementAttributes.SellerBillingAgreementId' => seller_billing_agreement_id, 'BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformation' => custom_information, 'BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName' => store_name, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#set_order_reference_details(amazon_order_reference_id, amount, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Sets order reference details such as the order total and a description for the order
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/pay_with_amazon/client.rb', line 406 def set_order_reference_details( amazon_order_reference_id, amount, currency_code: @currency_code, platform_id: nil, seller_note: nil, seller_order_id: nil, store_name: nil, custom_information: nil, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'SetOrderReferenceDetails', 'SellerId' => merchant_id, 'AmazonOrderReferenceId' => amazon_order_reference_id, 'OrderReferenceAttributes.OrderTotal.Amount' => amount, 'OrderReferenceAttributes.OrderTotal.CurrencyCode' => currency_code } optional = { 'OrderReferenceAttributes.PlatformId' => platform_id, 'OrderReferenceAttributes.SellerNote' => seller_note, 'OrderReferenceAttributes.SellerOrderAttributes.SellerOrderId' => seller_order_id, 'OrderReferenceAttributes.SellerOrderAttributes.StoreName' => store_name, 'OrderReferenceAttributes.SellerOrderAttributes.CustomInformation' => custom_information, 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |
#validate_billing_agreement(amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) ⇒ Object
Validates the status of the BillingAgreement object and the payment method associated with it
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/pay_with_amazon/client.rb', line 258 def validate_billing_agreement( amazon_billing_agreement_id, merchant_id: @merchant_id, mws_auth_token: nil) parameters = { 'Action' => 'ValidateBillingAgreement', 'SellerId' => merchant_id, 'AmazonBillingAgreementId' => amazon_billing_agreement_id } optional = { 'MWSAuthToken' => mws_auth_token } operation(parameters, optional) end |