refactor(tpv): Se cambió el nombre de la variable de order a orderId y se actualizaron las llamadas a la API relacionadas.
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
This commit is contained in:
parent
aae4f7a48a
commit
75f4e43c57
|
@ -4,19 +4,19 @@ import { api } from 'boot/axios';
|
||||||
export const tpvStore = defineStore('tpv', {
|
export const tpvStore = defineStore('tpv', {
|
||||||
actions: {
|
actions: {
|
||||||
async check(route) {
|
async check(route) {
|
||||||
const order = route.query.tpvOrder;
|
const orderId = route.query.tpvOrder;
|
||||||
const status = route.query.tpvStatus;
|
const status = route.query.tpvStatus;
|
||||||
if (!(order && status)) return null;
|
if (!(orderId && status)) return null;
|
||||||
|
|
||||||
await api.post('tpvTransactions/end', {
|
await api.post('tpvTransactions/end', {
|
||||||
orderId: order,
|
orderId,
|
||||||
status: status
|
status
|
||||||
});
|
});
|
||||||
|
|
||||||
if (status === 'ko') {
|
if (status === 'ko') {
|
||||||
const retry = confirm('retryPayQuestion');
|
const retry = confirm('retryPayQuestion');
|
||||||
if (retry) {
|
if (retry) {
|
||||||
this.retryPay(order);
|
this.retryPay(orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,17 +27,17 @@ export const tpvStore = defineStore('tpv', {
|
||||||
await this.realPay(amount * 100, company);
|
await this.realPay(amount * 100, company);
|
||||||
},
|
},
|
||||||
|
|
||||||
async retryPay(order) {
|
async retryPay(orderId) {
|
||||||
const { data: transactions } = await api.get(
|
const { data: transactions } = await api.get(
|
||||||
'clients/transactions',
|
'clients/transactions',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
orderFk: order
|
orderFk: orderId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (transactions && transactions.length > 0) {
|
if (transactions && transactions.length > 0) {
|
||||||
const transaction = transactions[0];
|
const [transaction] = transactions;
|
||||||
await this.realPay(
|
await this.realPay(
|
||||||
transaction.amount * 100,
|
transaction.amount * 100,
|
||||||
transaction.merchantFk
|
transaction.merchantFk
|
||||||
|
@ -45,15 +45,15 @@ export const tpvStore = defineStore('tpv', {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async realPay(amount, company) {
|
async realPay(amount, companyId) {
|
||||||
if (!isNumeric(amount) || amount <= 0) {
|
if (!isNumeric(amount) || amount <= 0) {
|
||||||
throw new Error('payAmountError');
|
throw new Error('payAmountError');
|
||||||
}
|
}
|
||||||
const { data: json } = await api.post('tpvTransactions/start', {
|
const { data: json } = await api.post('tpvTransactions/start', {
|
||||||
amount: amount,
|
amount,
|
||||||
|
companyId,
|
||||||
urlOk: this.makeUrl('ok'),
|
urlOk: this.makeUrl('ok'),
|
||||||
urlKo: this.makeUrl('ko'),
|
urlKo: this.makeUrl('ko')
|
||||||
companyId: company
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const postValues = json.postValues;
|
const postValues = json.postValues;
|
||||||
|
|
Loading…
Reference in New Issue