Good progress

This commit is contained in:
2025-09-18 13:02:28 -04:00
parent 827debd1cc
commit 6baefe9f50
6 changed files with 397 additions and 186 deletions

View File

@@ -315,9 +315,9 @@ export default defineComponent({
})
.then((response: any) => {
if (response.data.ok) {
this.total_amount = response.data.total_amount;
this.discount = response.data.discount;
this.total_amount_after_discount = response.data.total_amount_after_discount;
this.total_amount = parseFloat(response.data.total_amount) || 0;
this.discount = parseFloat(response.data.discount) || 0;
this.total_amount_after_discount = parseFloat(response.data.total_amount_after_discount) || 0;
// Auto-populate charge amount with the calculated total
if (this.promo_active) {
@@ -513,8 +513,8 @@ export default defineComponent({
const response = await axios.post(chargePath, chargePayload, { withCredentials: true, headers: authHeader() });
// Assuming your backend charge response has the same structure
if (response.data && response.data.status === 'APPROVED') { // Adjust based on your actual response
// Status codes: 0 = APPROVED, 1 = DECLINED (based on backend TransactionStatus enum)
if (response.data && response.data.status === 0) { // 0 = APPROVED
this.success = `Charge successful! Transaction ID: ${response.data.auth_net_transaction_id || 'N/A'}`;
setTimeout(() => {
this.$router.push({ name: "customerProfile", params: { id: this.customer.id } });
@@ -525,6 +525,7 @@ export default defineComponent({
}
}
} catch (error: any) {
console.log(error)
this.error = error.response?.data?.detail || `Failed to ${actionType} payment`
notify({
title: "Error",