https://github.com/zealous-tech/easy-payment-base
https://github.com/zealous-tech/easy-payment-base
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zealous-tech/easy-payment-base
- Owner: zealous-tech
- License: mit
- Created: 2021-12-22T15:26:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T08:58:47.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T09:50:25.791Z (about 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-payment-base
> Node.js API abstraction for payment gateways.
Used by supported gateways listed in [easy-payment](https://github.com/instigateMobile/easy-payment-main).
## BaseGateway API
* BaseGateway()
* BaseGateway#attachCard()
* BaseGateway#removeCard()
* BaseGateway#getBindings()
* BaseGateway#payOrder()
* BaseGateway#getOrderStatus()
* BaseGateway#freezeOrder()
* BaseGateway#reverseOrderProfile()
* BaseGateway#depositOrder()
* BaseGateway#refundOrder()
--------------------------------------------------------
#### BaseGateway(options)
--------------------------------------------------------
#### BaseGateway#attachCard()
Allow to add new card in payment gateway merchant account.
#### `parameters`
`order` *(object)*
* `'amount'` *(string)*: The amount of the transaction.
* `'orderNumber'` *(string)*: The orderNumber of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'pageView'` *(string)*: The pageView of the transaction.
* `'returnUrl'` *(string)*: The returnUrl of the transaction.
* `'description'` *(string)*: The description of the transaction.
* `'clientId'` *(string)*: The clientId of the transaction.
* `'currency'` *(string)*: The currency code of the transaction.
`other` *(object)*
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#removeCard()
Removing added card from payment getaway merchant.
#### `parameters`
`bindingId` *(string)*: The bindingId of the transaction.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#getBindings()
Returned existed payment getaway merchant account bindings.
#### `parameters`
`clientId` *(string)*: The clientId of the transaction.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#payOrder()
Paying order.
#### `parameters`
`order` *(object)*
* `'orderNumber'` *(string)*: The orderNumber of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'pageView'` *(string)*: The pageView of the transaction.
* `'amount'` *(number)*: The amount of the transaction.
* `'returnUrl'` *(string)*: The returnUrl of the transaction.
* `'description'` *(string)*: The description of the transaction.
* `'clientId'` *(string)*: The clientId of the transaction.
* `'currency'` *(string)*: The currency of the transaction.
* `'bindingId'` *(string)*: The bindingId of the transaction.
* `'useBinding'` *(boolean)*: If true, the pay will use the bindingId of the transaction.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'orderId'`*(string)*: The created orderId response from the gateway.
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
### BaseGateway#getOrderStatus()
Getting order status.
#### `parameters`
`order` *(object)*
* `'orderId'` *(string)*: The orderId of the transaction.
* `'extended'` *(boolean)*: If true, get extended order status.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#freezeOrder()
Freezing order.
#### `parameters`
`order` *(object)*
* `'orderNumber'` *(string)*: The orderNumber of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'pageView'` *(string)*: The pageView of the transaction.
* `'amount'` *(number)*: The amount of the transaction.
* `'returnUrl'` *(string)*: The returnUrl of the transaction.
* `'description'` *(string)*: The description of the transaction.
* `'clientId'` *(string)*: The clientId of the transaction.
* `'currency'` *(string)*: The currency of the transaction.
* `'bindingId'` *(string)*: The bindingId of the transaction.
* `'useBinding'` *(boolean)*: If true, the freeze will use the bindingId of the transaction.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'orderId'`*(string)*: The frozen orderId response from the gateway.
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#reverseOrderProfile()
Cancellation order.
#### `parameters`
`order` *(object)*
* `'orderId'` *(string)*: The orderId of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'currency'` *(string)*: The currency of the transaction.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#depositOrder()
Completion of order payment.
#### `parameters`
`order` *(object)*
* `'orderId'` *(string)*: The orderId of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'currency'` *(string)*: The currency of the transaction.
* `'pageView'` *(string)*: The pageView of the transaction.
* `'amount'` *(number)*: The amount of the transaction.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.
--------------------------------------------------------
#### BaseGateway#refundOrder()
Refund of order payment.
#### `parameters`
`order` *(object)*
* `'orderId'` *(string)*: The orderId of the transaction.
* `'language'` *(string)*: The language of the transaction.
* `'currency'` *(string)*: The currency of the transaction.
* `'amount'` *(number)*: The amount of the transaction.
Other fields specific to a gateway SDK implementation.
Refer to specific SDK for more details.
#### `return value`
Returns a `Promise` with the following object as a result:
* `'hasError'` *(boolean)*: Identifier of the transaction status.
* `'errorStep'` *(string)*: Exist when error is happens for methods with many API/SDK requests
* `'err'`: The original error response from the gateway.
* `'data'`: The original response from the gateway.