Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
4d2d75e066
|
@ -12,6 +12,9 @@ services:
|
|||
placement:
|
||||
constraints:
|
||||
- node.role == worker
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||
build: .
|
||||
|
@ -38,6 +41,9 @@ services:
|
|||
placement:
|
||||
constraints:
|
||||
- node.role == worker
|
||||
resources:
|
||||
limits:
|
||||
memory: 4G
|
||||
configs:
|
||||
datasources:
|
||||
external: true
|
||||
|
|
|
@ -32,45 +32,66 @@ module.exports = Self => {
|
|||
|
||||
Self.confirm = async(signatureVersion, merchantParameters, signature) => {
|
||||
const $ = Self.app.models;
|
||||
let transaction;
|
||||
|
||||
const decodedParams = JSON.parse(
|
||||
base64url.decode(merchantParameters, 'utf8'));
|
||||
const params = {};
|
||||
try {
|
||||
const decodedParams = JSON.parse(
|
||||
base64url.decode(merchantParameters, 'utf8'));
|
||||
const params = {};
|
||||
|
||||
for (const param in decodedParams)
|
||||
params[param] = decodeURIComponent(decodedParams[param]);
|
||||
for (const param in decodedParams)
|
||||
params[param] = decodeURIComponent(decodedParams[param]);
|
||||
|
||||
const orderId = params['Ds_Order'];
|
||||
const merchantId = parseInt(params['Ds_MerchantCode']);
|
||||
const orderId = params['Ds_Order'];
|
||||
if (!orderId)
|
||||
throw new UserError('Order id not provided');
|
||||
|
||||
if (!orderId)
|
||||
throw new UserError('Order id not found');
|
||||
if (!merchantId)
|
||||
throw new UserError('Mechant id not found');
|
||||
transaction = await Self.findById(orderId, {fields: ['id']});
|
||||
if (!transaction)
|
||||
throw new UserError('Order not found');
|
||||
|
||||
const merchant = await $.TpvMerchant.findById(merchantId, {
|
||||
fields: ['id', 'secretKey']
|
||||
});
|
||||
await transaction.updateAttributes({
|
||||
merchantParameters,
|
||||
signature,
|
||||
signatureVersion,
|
||||
});
|
||||
|
||||
const base64hmac = Self.createSignature(
|
||||
orderId,
|
||||
merchant.secretKey,
|
||||
merchantParameters
|
||||
);
|
||||
const merchantId = parseInt(params['Ds_MerchantCode']);
|
||||
if (!merchantId)
|
||||
throw new UserError('Merchant id not provided');
|
||||
|
||||
if (base64hmac !== base64url.toBase64(signature))
|
||||
throw new UserError('Invalid signature');
|
||||
const merchant = await $.TpvMerchant.findById(merchantId, {
|
||||
fields: ['id', 'secretKey']
|
||||
});
|
||||
if (!merchant)
|
||||
throw new UserError('Merchant not found');
|
||||
|
||||
await Self.rawSql(
|
||||
'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [
|
||||
params['Ds_Amount'],
|
||||
const base64hmac = Self.createSignature(
|
||||
orderId,
|
||||
merchantId,
|
||||
params['Ds_Currency'],
|
||||
params['Ds_Response'],
|
||||
params['Ds_ErrorCode']
|
||||
]);
|
||||
merchant.secretKey,
|
||||
merchantParameters
|
||||
);
|
||||
|
||||
return true;
|
||||
if (base64hmac !== base64url.toBase64(signature))
|
||||
throw new UserError('Invalid signature');
|
||||
|
||||
await Self.rawSql(
|
||||
'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [
|
||||
params['Ds_Amount'],
|
||||
orderId,
|
||||
merchantId,
|
||||
params['Ds_Currency'],
|
||||
params['Ds_Response'],
|
||||
params['Ds_ErrorCode']
|
||||
]);
|
||||
|
||||
return true;
|
||||
} catch (err) {
|
||||
if (transaction)
|
||||
await transaction.updateAttribute('responseError', err.message);
|
||||
else
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -35,6 +35,18 @@
|
|||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
},
|
||||
"merchantParameters": {
|
||||
"type": "string"
|
||||
},
|
||||
"signature": {
|
||||
"type": "string"
|
||||
},
|
||||
"signatureVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"responseError": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -45,4 +57,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
description="$ctrl.invoiceOut.ref"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-dot-menu>
|
||||
<vn-invoice-out-descriptor-menu
|
||||
<vn-invoice-out-descriptor-menu
|
||||
invoice-out="$ctrl.invoiceOut"
|
||||
parent-reload="$ctrl.reload()"
|
||||
/>
|
||||
|
@ -11,23 +11,23 @@
|
|||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value
|
||||
label="Date"
|
||||
label="Date"
|
||||
value="{{$ctrl.invoiceOut.issued | date: 'dd/MM/yyyy'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Import"
|
||||
label="Import"
|
||||
value="{{$ctrl.invoiceOut.amount | currency: 'EUR': 2}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Client">
|
||||
<span
|
||||
<span
|
||||
ng-click="clientDescriptor.show($event, $ctrl.invoiceOut.client.id)"
|
||||
class="link">
|
||||
{{$ctrl.invoiceOut.client.name}}
|
||||
</span>
|
||||
</vn-label-value>
|
||||
<vn-label-value
|
||||
label="Company"
|
||||
label="Company"
|
||||
value="{{$ctrl.invoiceOut.company.code}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
|
@ -53,4 +53,7 @@
|
|||
</vn-descriptor-content>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-invoice-out-summary invoice-out="$ctrl.invoiceOut"></vn-invoice-out-summary>
|
||||
</vn-popup>
|
||||
</vn-popup>
|
||||
<vn-client-descriptor-popover
|
||||
vn-id="clientDescriptor">
|
||||
</vn-client-descriptor-popover>
|
||||
|
|
|
@ -59,17 +59,10 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
const writeStream = fs.createWriteStream(filePath);
|
||||
writeStream.on('open', () => {
|
||||
response.pipe(writeStream);
|
||||
});
|
||||
|
||||
writeStream.on('error', async error => {
|
||||
await errorHandler(image.itemFk, error, filePath);
|
||||
});
|
||||
|
||||
writeStream.on('finish', async function() {
|
||||
writeStream.end();
|
||||
});
|
||||
writeStream.on('open', () => response.pipe(writeStream));
|
||||
writeStream.on('error', async error =>
|
||||
await errorHandler(image.itemFk, error, filePath));
|
||||
writeStream.on('finish', writeStream.end());
|
||||
|
||||
writeStream.on('close', async function() {
|
||||
try {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
SELECT
|
||||
io.amount,
|
||||
io.ref,
|
||||
io.issued,
|
||||
io2.amount,
|
||||
io2.ref,
|
||||
io2.issued,
|
||||
ict.description
|
||||
FROM invoiceOut io
|
||||
JOIN invoiceCorrection ic ON ic.correctingFk = io.id
|
||||
JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk
|
||||
JOIN invoiceOut io2 ON io2.id = ic.correctedFk
|
||||
LEFT JOIN ticket t ON t.refFk = io.ref
|
||||
WHERE io.ref = ?
|
||||
JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk
|
||||
WHERE io.ref = ?
|
||||
|
|
Loading…
Reference in New Issue