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",

View File

@@ -339,8 +339,7 @@ export default defineComponent({
})
.then((response: any) => {
if (response.data.ok) {
console.log('%%%%%%%%%%%%%%%')
console.log(response.data)
this.priceprime = response.data.priceprime;
this.pricesameday = response.data.pricesameday;
@@ -348,7 +347,7 @@ export default defineComponent({
this.total_amount = response.data.total_amount;
this.discount = response.data.discount;
this.total_amount_after_discount = response.data.total_amount_after_discount;
console.log('%%%%%%%%%%%%%%%')
}
})
.catch(() => {
@@ -408,7 +407,6 @@ export default defineComponent({
});
},
getOilOrder(delivery_id: any) {
console.log("=== DEBUG: getOilOrder called with delivery_id:", delivery_id);
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
axios({
method: "get",
@@ -500,6 +498,13 @@ export default defineComponent({
type: "success",
});
}
if (payment_type == 11) {
notify({
title: "Success",
text: "marked payment as CC - Authorize (API)",
type: "success",
});
}
this.$router.push({ name: "customerProfile", params: { id: this.customer.id } });
}
})