refs #5122 Hotfix: Basic implementation for payment confirmation
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3d6ec3c033
commit
109556ae2e
|
@ -0,0 +1,47 @@
|
|||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('confirm', {
|
||||
description: 'Confirms electronic payment transaction',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'Ds_SignatureVersion',
|
||||
type: 'string',
|
||||
required: true,
|
||||
}, {
|
||||
arg: 'Ds_MerchantParameters',
|
||||
type: 'string',
|
||||
required: true,
|
||||
}, {
|
||||
arg: 'Ds_Signature',
|
||||
type: 'string',
|
||||
required: true,
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: 'Boolean',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/confirm`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.confirm = async(signatureVersion, merchantParameters, signature) => {
|
||||
const buffer = Buffer.from(merchantParameters, 'base64');
|
||||
const params = JSON.parse(buffer.toString());
|
||||
console.debug('Payment confirmation received:', params);
|
||||
await Self.rawSql(
|
||||
'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [
|
||||
params['Ds_Amount'],
|
||||
params['Ds_Order'],
|
||||
params['Ds_MerchantCode'],
|
||||
params['Ds_Currency'],
|
||||
params['Ds_Response'],
|
||||
params['Ds_ErrorCode']
|
||||
]
|
||||
);
|
||||
return true;
|
||||
};
|
||||
};
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/tpv-transaction/confirm')(Self);
|
||||
};
|
Loading…
Reference in New Issue