bepago 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/index.mjs +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,17 @@ await bp.payouts.cancel(payout.id);
|
|
|
59
59
|
await bp.payouts.balance();
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
Lote de pagos (hasta 1000 por llamada; queda pendiente de aprobación en el
|
|
63
|
+
panel, cuatro ojos, salvo auto-aprobación por API habilitada):
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const lote = await bp.payouts.batches.create(
|
|
67
|
+
{ payouts: [{ amount: 150000, destination: { type: 'alias', alias: 'juan.perez' }, external_id: 'premio-88' }] },
|
|
68
|
+
'idem-key-unica',
|
|
69
|
+
);
|
|
70
|
+
await bp.payouts.batches.get(lote.id);
|
|
71
|
+
```
|
|
72
|
+
|
|
62
73
|
### Verificar un webhook
|
|
63
74
|
|
|
64
75
|
bePago firma cada webhook con `HMAC-SHA256` sobre `timestamp + body` usando el
|
package/index.mjs
CHANGED
|
@@ -84,6 +84,20 @@ export default function BePago(secret, opts = {}) {
|
|
|
84
84
|
get: (id) => request('GET', `/v1/payouts/${encodeURIComponent(id)}`),
|
|
85
85
|
cancel: (id) => request('POST', `/v1/payouts/${encodeURIComponent(id)}/cancel`),
|
|
86
86
|
balance: () => request('GET', '/v1/balance'),
|
|
87
|
+
/**
|
|
88
|
+
* Lotes de pagos masivos. `create` carga el lote entero (hasta 1000 pagos);
|
|
89
|
+
* queda pendiente de aprobación en el panel (cuatro ojos) salvo que el
|
|
90
|
+
* comercio tenga habilitada la auto-aprobación por API.
|
|
91
|
+
*
|
|
92
|
+
* const lote = await bp.payouts.batches.create({
|
|
93
|
+
* payouts: [{ amount: 150000, destination: { type: 'alias', alias: 'juan.perez' }, external_id: 'premio-88' }],
|
|
94
|
+
* }, 'idem-key-unica');
|
|
95
|
+
* await bp.payouts.batches.get(lote.id);
|
|
96
|
+
*/
|
|
97
|
+
batches: {
|
|
98
|
+
create: (params, idempotencyKey) => request('POST', '/v1/payouts/batches', params, { idempotencyKey }),
|
|
99
|
+
get: (id) => request('GET', `/v1/payouts/batches/${encodeURIComponent(id)}`),
|
|
100
|
+
},
|
|
87
101
|
},
|
|
88
102
|
webhooks: {
|
|
89
103
|
/**
|