# sails-hook-payu

> The hook allows communication with the API of the Polish Payu payment processor.

Latest version **1.0.6** (published 2020-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install sails-hook-payu
pnpm add sails-hook-payu
yarn add sails-hook-payu
bun add sails-hook-payu
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-11-26 |
| First published | 2020-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jakub Paprocki |
| Maintainers | sacrize |
| Keywords | sails, hook, payu |

## Links

- npm: https://www.npmjs.com/package/sails-hook-payu
- Repository: https://github.com/Sacrize/sails-hook-payu
- Homepage: https://github.com/Sacrize/sails-hook-payu#readme
- Issues: https://github.com/Sacrize/sails-hook-payu/issues
- npm.io page: https://npm.io/package/sails-hook-payu

## Dependencies (1)

- [nodejs-payu-sdk](https://npm.io/package/nodejs-payu-sdk.md) ^1.0.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2020-11-26
- 1.0.5 — 2020-11-21
- 1.0.4 — 2020-11-21
- 1.0.3 — 2020-11-18
- 1.0.2 — 2020-11-18
- 1.0.0 — 2020-11-16

## README

# Sails Hook Payu

The hook allows communication with the API of the Polish Payu payment processor.

## Getting Started
Install it via npm:
```bash
npm install sails-hook-payu --save
```
Configure `config/payu.js` in your project:
```javascript
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
};
```
#### Handle notifications
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](https://github.com/Sacrize/sails-hook-custom-events) hook. You can configure an observer to process the data.

## Available methods
```javascript
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)

## License

[MIT](./LICENSE)

---
_Source: https://npm.io/package/sails-hook-payu · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
