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

This commit is contained in:
Guido 2025-04-17 11:34:07 -03:00
parent aae4f7a48a
commit 75f4e43c57
1 changed files with 12 additions and 12 deletions

View File

@ -4,19 +4,19 @@ import { api } from 'boot/axios';
export const tpvStore = defineStore('tpv', {
actions: {
async check(route) {
const order = route.query.tpvOrder;
const orderId = route.query.tpvOrder;
const status = route.query.tpvStatus;
if (!(order && status)) return null;
if (!(orderId && status)) return null;
await api.post('tpvTransactions/end', {
orderId: order,
status: status
orderId,
status
});
if (status === 'ko') {
const retry = confirm('retryPayQuestion');
if (retry) {
this.retryPay(order);
this.retryPay(orderId);
}
}
@ -27,17 +27,17 @@ export const tpvStore = defineStore('tpv', {
await this.realPay(amount * 100, company);
},
async retryPay(order) {
async retryPay(orderId) {
const { data: transactions } = await api.get(
'clients/transactions',
{
params: {
orderFk: order
orderFk: orderId
}
}
);
if (transactions && transactions.length > 0) {
const transaction = transactions[0];
const [transaction] = transactions;
await this.realPay(
transaction.amount * 100,
transaction.merchantFk
@ -45,15 +45,15 @@ export const tpvStore = defineStore('tpv', {
}
},
async realPay(amount, company) {
async realPay(amount, companyId) {
if (!isNumeric(amount) || amount <= 0) {
throw new Error('payAmountError');
}
const { data: json } = await api.post('tpvTransactions/start', {
amount: amount,
amount,
companyId,
urlOk: this.makeUrl('ok'),
urlKo: this.makeUrl('ko'),
companyId: company
urlKo: this.makeUrl('ko')
});
const postValues = json.postValues;