Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/apiReqs/apiReqsUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const {
updateNode,
deleteNode,
generateApplePayToken,
generateECashBarcode,
createTransaction,
getTransaction,
getAllNodeTransactions,
Expand Down Expand Up @@ -240,6 +241,13 @@ module.exports[generateApplePayToken] = ({ node_id, bodyParams, userInfo }) => {
return axios.patch(url, bodyParams, { headers });
};

module.exports[generateECashBarcode] = ({ node_id, bodyParams, userInfo }) => {
const { host, headers, id } = userInfo;
const url = `${host}/users/${id}/nodes/${node_id}/barcode`;

return axios.post(url, bodyParams, { headers });
Comment thread
tszajna0 marked this conversation as resolved.
Outdated
};

module.exports[createTransaction] = ({ node_id, bodyParams, userInfo }) => {
const { host, headers, id } = userInfo;
const url = `${host}/users/${id}/nodes/${node_id}/trans`;
Expand Down
1 change: 1 addition & 0 deletions src/constants/apiReqNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
updateNode: 'updateNode',
deleteNode: 'deleteNode',
generateApplePayToken: 'generateApplePayToken',
generateECashBarcode: 'generateECashBarcode',
createTransaction: 'createTransaction',
getTransaction: 'getTransaction',
getAllNodeTransactions: 'getAllNodeTransactions',
Expand Down
16 changes: 16 additions & 0 deletions src/lib/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const {
updateNode,
deleteNode,
generateApplePayToken,
generateECashBarcode,
createTransaction,
getTransaction,
getAllNodeTransactions,
Expand Down Expand Up @@ -341,6 +342,21 @@ class User {
});
}

// POST GENERATE ECASH BARCODE
generateECashBarcode(node_id, amount, currency, retailer_id) {
return apiRequests.user[generateECashBarcode]({
node_id,
bodyParams: {
amount: {
amount,
currency,
},
retailer_id,
},
userInfo: this
});
}

// POST CREATE TRANSACTION
createTransaction(node_id, bodyParams, idempotency_key = null) {
if (idempotency_key) {
Expand Down