New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ask-utils/amazon-pay

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ask-utils/amazon-pay

Utility libs for the Alexa skill to integrate the Amazon Pay APIs

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@ask-utils/amazon-pay

Getting Started

$ npm i -S @ask-utils/amazon-pay

// If you using typescript
$ npm i -D @ask-utils/amazon-pay

Example

Setup API

const AMAZONPay = require('@ask-utils/amazon-pay')
const SellerOrderAttributes = AMAZONPay.Setup.BillingAgreementBuilder
  .setPlatFormId('My id')
  .setSellerNote('my note')
  .setSellerBillingAgreementId('agreement id')
  .setSellerNote('My store')
  .setCustomInformation('custom info')
const setupPayload = AMAZONPay.Setup.PayloadBuilder
  .setSellerId('my seller id')
  .setCountryOfEstablishment('country')
  .setLedgerCurrency('ledger currency')
  .setCheckoutLanguage('checkout lang')
  .withAmazonShippingAddress(true)
  .isSandboxMode(true)
  .setSandboxCustomerEmailId('email')
  .updateBillingAgreement(SellerOrderAttributes)
const payload = setupPayload.getPayload()
console.log(JSON.stringify(payload))


{
  "@type": "SetupAmazonPayRequest",
  "@version": "v2",
  "sellerId": "my seller id",
  "countryOfEstablishment": "country",
  "ledgerCurrency": "ledger currency",
  "checkoutLanguage": "checkout lang",
  "needAmazonShippingAddress": true,
  "sandboxMode": true,
  "sandboxCustomerEmailId": "email",
  "billingAgreementAttributes": {
    "@type": "BillingAgreementAttributes",
    "@version": "2",
    "platformId": "My id",
    "sellerNote": "My store",
    "sellerBillingAgreementAttributes": {
      "@type": "SellerBillingAgreementAttributes",
      "@version": "2",
      "sellerBillingAgreementId": "agreement id",
      "customInformation": "custom info"
    }
  }
}

Charge API

const AMAZONPay = require('@ask-utils/amazon-pay')

const authorizeAttributes = AMAZONPay.Charge.AuthorizeAttributesBuilder
  .setReferenceId('MyReference ID')
  .setCurrencyCode('USD')
  .setAmount('500')
const sellerOrderAttribtes = AMAZONPay.Charge.SellerOrderAttributesBuilder
  .setSellerOrderId('my seller id')
  .setStoreName('Example store')
const payload = AMAZONPay.Charge.PayloadBuilder
  .setSellerId('my-seller-id')
  .setBillingAgreementId('agreement-id')
  .updateAuthorizeAttributes(authorizeAttributes)
  .updateSellerOrderAttributes(sellerOrderAttribtes)
  .getPayload()

console.log(payload)

{
  "@type": "ChargeAmazonPayRequest",
  "@version": "2",
  "sellerId": "my-seller-id",
  "billingAgreementId": "agreement-id",
  "paymentAction": "AuthorizeAndCapture",
  "authorizeAttributes": {
    "@type": "AuthorizeAttributes",
    "@version": "2",
    "authorizationReferenceId": "MyReference ID",
    "authorizationAmount": {
      "@type": "Price",
      "@version": "2",
      "amount": "500",
      "currencyCode": "USD"
    }
  },
  "sellerOrderAttributes": {
    "@type": "SellerOrderAttributes",
    "@version": "2",
    "sellerOrderId": "my seller id",
    "storeName": "Example store"
  }
}

Testing

$ yarn test

or

$ yarn test -- --watch

Contributing

Getting started

$ git clone git@github.com:ask-utils/ask-utils-for-amazon-pay.git
$ cd ask-utils-for-amazon-pay
$ yarn install
$ yarn run build

Before making a Pull Request

$ git checkout -b YOUR_TOPIC_BRANCH
$ yarn test
$ git add ./
$ git commit -m "YOUR UPDATE DESCRIPTION"

FAQs

Package last updated on 16 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts