@tailored-apps/wirecard
v1.3.4
Published
basic implementation for wirecard checkout page.
Downloads
10
Readme
wirecard
wirecard is a simplified middleware library, for executing wirecard payments, for node.js. It includes predefined (async) request
and response
methods to work with Koa as well as (async) operation
method for handling Wirecard's backand operations.
This entire document is a work in progress.
Note
This library is currently tested and used for Wirecard Checkout Page and Backend Operations.
Installation
Include following line in the dependencies
section of your package.js
.
"wirecard": "git+https://gitlab.tailored-apps.com/libraries/node/wirecard.git#{version}"
Configuration
- logger: A winston logger instance.
- options:
- secret:
required
The Wirecard secret. - customerId:
required
The Wirecard customer identifier. - shopId: The wirecard shop identifer.
- toolkitPassword:
required on operation
The Wirecard toolkit password for executing backend operations. - request: You have the possibility to send all possible options which are defined on Wirecard's developer guides here.
- prepareRequest: An (async) function which gives you the possibility to modify the
options
before they will be send to Wirecard. - prepareResponse: An (async) function which gives you the possibility to prepare an other
secret
out of the givenoptions
before the fingerprint will be checked.
- secret:
Predefined Methods
- request: koa-router middleware to start a Wirecard Checkout Page, which will take custom options over request params (GET) or body (POST).
{koa-router}.get('/wirecard', new Wirecard({options}).request)
- response: koa-router middleware to handle the Wirecard Checkout Page responses
{koa-router}.get('/wirecard', new Wirecard({options}).response)
- operation: (async) function which will execute any Wirecard Backend Operations.
new Wirecard({options}).operation({special-operation-options})
- deposit: (async) function which will execute the transaction based deposit operation.
const { paymentNumber } = new Wirecard({options}).deposit({
orderNumber: 123456789,
amount: 100,
currency: 'EUR'
})
- reversal: (async) function which will execute any transaction based approved reversal operation.
new Wirecard({options}).reversal({
orderNumber: 123456789,
})
- recurPayment: (async) function which will execute a recurring payment operation based on data of a previous order.
new Wirecard({options}).recurPayment({
orderNumber: 123456789,
sourceOrderNumber: 987654321,
amount: 100,
currency: 'EUR',
orderDescription: 'Recurring Payment Test',
autoDeposit: 'No'
})
- getOrderDetails: (async) function to get all details of an order with a specific order number.
new Wirecard({options}).getOrderDetails({
orderNumber: 123456789
})
MISC
Testing
npm run test
Start Example Server
npm run example:start
Todo
- Finish README
- Make debug output less verbose and more useful
- Integrate a Wirecard Checkout Seamless solution