The hook allows communication with the API of the Polish Payu payment processor.
Install it via npm:
npm install sails-hook-payu --save
Configure config/payu.js
in your project:
module.exports.payu = {
clientId: '',
clientSecret: '',
posId: '',
key: '',
environment: 'production', // or test
shopId: '',
payuWhitelistProduction: [
'185.68.12.10',
'185.68.12.11',
'185.68.12.12',
'185.68.12.26',
'185.68.12.27',
'185.68.12.28',
],
payuWhitelistTest: [
'185.68.14.10',
'185.68.14.11',
'185.68.14.12',
'185.68.14.26',
'185.68.14.27',
'185.68.14.28',
],
enableNotificationsEndpoint: true, // /cb/payu
};
The hook listens for notifications on the /cb/payu
endpoint and emits a custom event payu-notification
with received data in the @Sacrize/sails-hook-custom-events hook. You can configure an observer to process the data.
sails.hooks.payu.<method>()
- getShopData(shopId)
- getOrder(orderId)
- getOrderTransactions(orderId)
- createOrder(order)
- cancelOrder(orderId)
- refundOrder(orderId, amount, description)
- amount(optional): empty means full refund
- description(optional)
- verifyNotification(json, headers)