diff --git a/examples/with_async/retail_outlet.js b/examples/with_async/retail_outlet.js index 2db7fad..d28013d 100644 --- a/examples/with_async/retail_outlet.js +++ b/examples/with_async/retail_outlet.js @@ -26,6 +26,18 @@ const ro = new RetailOutlet({}); // eslint-disable-next-line no-console console.log('updated payment code details:', updatedPmCode); + await ro.simulatePayment({ + retailOutletName: 'ALFAMART', + paymentCode: updatedPmCode.payment_code, + transferAmount: 12000, + }); + // eslint-disable-next-line no-console + console.log('simulated payment:', updatedPmCode); + + const paymentsByCodeId = await ro.getPaymentsByFixedPaymentCodeId({ id }); + // eslint-disable-next-line no-console + console.log('payments by fixed payment code ID:', paymentsByCodeId); + process.exit(0); } catch (e) { console.error(e); // eslint-disable-line no-console diff --git a/examples/with_promises/retail_outlet.js b/examples/with_promises/retail_outlet.js index f360948..8c25328 100644 --- a/examples/with_promises/retail_outlet.js +++ b/examples/with_promises/retail_outlet.js @@ -31,6 +31,27 @@ ro.createFixedPaymentCode({ console.log('updated payment code details:', r); return r; }) + .then(({ id, payment_code }) => + Promise.all([ + id, + ro.simulatePayment({ + retailOutletName: 'ALFAMART', + paymentCode: payment_code, + transferAmount: 12000, + }), + ]), + ) + .then(r => { + // eslint-disable-next-line no-console + console.log('simulated payment:', r); + return r; + }) + .then(([id]) => ro.getPaymentsByFixedPaymentCodeId({ id })) + .then(r => { + // eslint-disable-next-line no-console + console.log('payments by fixed payment code ID:', r); + return r; + }) .catch(e => { console.error(e); // eslint-disable-line no-console process.exit(1);