Skip to content

Commit

Permalink
Merge pull request #120 from ekibagascan/feat/add-qris-metadata
Browse files Browse the repository at this point in the history
Adding qr_code metadata
  • Loading branch information
xen-HendryZheng authored Nov 23, 2021
2 parents 59529ba + 1b9e9ab commit 376e21c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/with_async/qr_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const q = new QrCode({});
type: QrCode.Type.Dynamic,
callbackURL: 'https://httpstat.us/200',
amount: 10000,
metadata: {
meta2: 'data2',
},
});
console.log('created QR code', qrcode); // eslint-disable-line no-console

Expand Down
3 changes: 3 additions & 0 deletions examples/with_promises/qr_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ q.createCode({
type: QrCode.Type.Dynamic,
callbackURL: 'https://httpstat.us/200',
amount: 10000,
metadata: {
meta2: 'data2',
},
})
.then(r => {
console.log('created QR code', r); // eslint-disable-line no-console
Expand Down
3 changes: 3 additions & 0 deletions integration_test/qr_code.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module.exports = function() {
type: QrCode.Type.Dynamic,
callbackURL: 'https://httpstat.us/200',
amount: 10000,
metadata: {
meta2: 'data2',
},
})
.then(r => q.getCode({ externalID: r.external_id }))
.then(r =>
Expand Down
1 change: 1 addition & 0 deletions src/qr_code/qr_code.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export = class QrCode {
type: QrCodeTypes;
callbackURL: string;
amount?: number;
metadata?: object;
}): Promise<object>;
getCode(data: { externalID: string }): Promise<object>;
getPayments(data: {
Expand Down
1 change: 1 addition & 0 deletions src/qr_code/qr_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ QrCode.prototype.createCode = function(data) {
type: data.type,
callback_url: data.callbackURL,
amount: data.amount,
metadata: data.metadata,
}),
})
.then(resolve)
Expand Down
2 changes: 2 additions & 0 deletions test/qr_code/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const VALID_CREATE_CODE_RESPONSE = {
merchant_callback_url: CALLBACK_URL,
type: TYPE,
status: 'ACTIVE',
metadata: null,
created: '2020-01-08T18:18:18.661Z',
updated: '2020-01-08T18:18:18.661Z',
};
Expand All @@ -32,6 +33,7 @@ const VALID_PAYMENT = {
type: TYPE,
},
status: 'COMPLETED',
metadata: null,
};
const VALID_PAYMENT_ARRAY = [VALID_PAYMENT, VALID_PAYMENT];

Expand Down

0 comments on commit 376e21c

Please sign in to comment.