Working authorize needs work
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
<!-- Customer Info Card -->
|
||||
<div class="bg-neutral rounded-lg p-5">
|
||||
<div class="text-xl font-bold mb-2">Customer</div>
|
||||
<!-- This section uses your original v-if logic -->
|
||||
<div>
|
||||
<div class="font-bold">{{ customer.customer_first_name }} {{ customer.customer_last_name }}</div>
|
||||
<div>{{customer.customer_address}}</div>
|
||||
@@ -76,7 +75,7 @@
|
||||
<span v-if="deliveryOrder.delivery_status == 0">waiting</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 1">delivered</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 2">Today</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 3">Tommorrow </span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 3">Tomorrow</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 4">Partial Delivery</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 5">misdelivery</span>
|
||||
<span v-else-if="deliveryOrder.delivery_status == 6">unknown</span>
|
||||
@@ -150,10 +149,17 @@
|
||||
<div class="flex justify-between items-center border-t border-base-100 pt-3">
|
||||
<span class="text-lg font-bold">
|
||||
<span v-if="deliveryOrder.payment_type == 0">Cash Total</span>
|
||||
<span v-else-if="deliveryOrder.payment_type == 1 || deliveryOrder.payment_type == 2 || deliveryOrder.payment_type == 3">Pre Charge Total</span>
|
||||
<span v-else-if="deliveryOrder.payment_type == 1 || deliveryOrder.payment_type == 2 || deliveryOrder.payment_type == 3">Pre-Auth Estimate</span>
|
||||
<span v-else>Total Amount</span>
|
||||
</span>
|
||||
<span class="text-2xl font-bold text-success">${{ Number(total_amount).toFixed(2) }}</span>
|
||||
<span class="text-2xl font-bold text-success">
|
||||
<span v-if="deliveryOrder.payment_type == 1 || deliveryOrder.payment_type == 2 || deliveryOrder.payment_type == 3">
|
||||
${{ Number(preChargeTotal).toFixed(2) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
${{ Number(total_amount).toFixed(2) }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -168,7 +174,7 @@
|
||||
|
||||
<div>
|
||||
<label class="label"><span class="label-text font-bold">Gallons Delivered</span></label>
|
||||
<input v-model="FinalizeOilOrderForm.gallons_delivered" class="input input-bordered input-sm w-full max-w-xs" type="number" placeholder="# gallons" />
|
||||
<input v-model="FinalizeOilOrderForm.gallons_delivered" class="input input-bordered input-sm w-full max-w-xs" type="number" step="0.01" placeholder="# gallons" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -176,13 +182,11 @@
|
||||
<input v-model="FinalizeOilOrderForm.fill_location" class="input input-bordered input-sm w-full max-w-xs" type="text" placeholder="Fill location (e.g., 1-12)" />
|
||||
</div>
|
||||
|
||||
<!-- FIX: Cash Received input is now ALWAYS visible -->
|
||||
<div>
|
||||
<label class="label"><span class="label-text font-bold">Cash Received</span></label>
|
||||
<input v-model="FinalizeOilOrderForm.cash_recieved" class="input input-bordered input-sm w-full max-w-xs" type="number" placeholder="Amount received" />
|
||||
<input v-model="FinalizeOilOrderForm.cash_recieved" class="input input-bordered input-sm w-full max-w-xs" type="number" step="0.01" placeholder="Amount received" />
|
||||
</div>
|
||||
|
||||
<!-- FIX: Check # input is now ALWAYS visible -->
|
||||
<div>
|
||||
<label class="label"><span class="label-text font-bold">Check #</span></label>
|
||||
<input v-model="FinalizeOilOrderForm.check_number" class="input input-bordered input-sm w-full max-w-xs" type="text" placeholder="Check Number" />
|
||||
@@ -221,7 +225,6 @@
|
||||
<Footer />
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import axios from 'axios'
|
||||
@@ -229,10 +232,8 @@ import authHeader from '../../../services/auth.header'
|
||||
import Header from '../../../layouts/headers/headerauth.vue'
|
||||
import SideBar from '../../../layouts/sidebar/sidebar.vue'
|
||||
import Footer from '../../../layouts/footers/footer.vue'
|
||||
import useValidate from "@vuelidate/core";
|
||||
import { notify } from "@kyvg/vue3-notification"
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'finalizeTicket',
|
||||
|
||||
@@ -244,48 +245,24 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
v$: useValidate(),
|
||||
loaded: false,
|
||||
user: {
|
||||
id: 0
|
||||
},
|
||||
user: { id: 0 },
|
||||
userCardfound: false,
|
||||
deliveryStatus: [],
|
||||
userCards: [],
|
||||
deliveryNotesDriver: [],
|
||||
priceprime: 0,
|
||||
pricesameday: 0,
|
||||
total_amount: 0,
|
||||
preChargeTotal: 0,
|
||||
|
||||
FinalizeOilOrderForm: {
|
||||
cash: false,
|
||||
card: false,
|
||||
check: false,
|
||||
other: false,
|
||||
cash_recieved: '',
|
||||
fill_location: 0,
|
||||
check_number: 0,
|
||||
delivery_status: 10,
|
||||
userCards: [],
|
||||
credit_card_id: 0,
|
||||
driver: 0,
|
||||
gallons_delivered: '',
|
||||
customer_filled: false,
|
||||
prime: false,
|
||||
same_day: false,
|
||||
emergency: false,
|
||||
},
|
||||
CreateOilOrderForm: {
|
||||
basicInfo: {
|
||||
gallons_delivered: '',
|
||||
prime: false,
|
||||
same_day: false,
|
||||
cash: false,
|
||||
card: false,
|
||||
check: false,
|
||||
other: false,
|
||||
userCards: []
|
||||
},
|
||||
},
|
||||
userCard: {
|
||||
date_added: '',
|
||||
@@ -315,18 +292,10 @@ export default defineComponent({
|
||||
},
|
||||
customerDescription: {
|
||||
customer_id: 0,
|
||||
account_number: '',
|
||||
account_number: '',
|
||||
company_id: 0,
|
||||
fill_location: 0,
|
||||
description: '',
|
||||
},
|
||||
deliveryMoney: {
|
||||
time_added: '',
|
||||
total_amount_oil: '',
|
||||
total_amount_emergency: '',
|
||||
total_amount_prime: '',
|
||||
total_amount_fee: '',
|
||||
total_amount: '',
|
||||
description: '',
|
||||
},
|
||||
deliveryOrder: {
|
||||
id: '',
|
||||
@@ -370,338 +339,208 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.userStatus()
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.sumdelivery(this.$route.params.id);
|
||||
this.getOilOrder(this.$route.params.id);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.sumdelivery(this.$route.params.id);
|
||||
this.getOilOrder(this.$route.params.id);
|
||||
const deliveryId = this.$route.params.id;
|
||||
this.sumdelivery(deliveryId);
|
||||
this.getOilOrder(deliveryId);
|
||||
this.getOilPricing();
|
||||
this.getDeliveryStatusList();
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
userStatus() {
|
||||
let path = import.meta.env.VITE_BASE_URL + '/auth/whoami';
|
||||
axios({
|
||||
method: 'get',
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.user = response.data.user;
|
||||
this.user.id = response.data.user_id;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getOilOrder(delivery_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/order/" + delivery_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/delivery/order/${delivery_id}`;
|
||||
axios.get(path, { withCredentials: true, headers: authHeader() })
|
||||
.then((response: any) => {
|
||||
if (response.data && response.data.ok) {
|
||||
this.deliveryOrder = response.data.delivery
|
||||
this.getCustomer(this.deliveryOrder.customer_id)
|
||||
this.deliveryOrder = response.data.delivery;
|
||||
this.getCustomer(this.deliveryOrder.customer_id);
|
||||
|
||||
if (this.deliveryOrder.payment_type === 1) {
|
||||
if ([1, 2, 3].includes(this.deliveryOrder.payment_type)) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id);
|
||||
}
|
||||
if (this.deliveryOrder.payment_type === 2) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id);
|
||||
}
|
||||
if (this.deliveryOrder.payment_type === 3) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id);
|
||||
}
|
||||
|
||||
|
||||
this.FinalizeOilOrderForm.cash_recieved = response.data.delivery.cash_recieved;
|
||||
this.FinalizeOilOrderForm.check_number = response.data.delivery.check_number;
|
||||
this.FinalizeOilOrderForm.credit_card_id = response.data.delivery.payment_card_id;
|
||||
|
||||
if (response.data.delivery.customer_filled == 1) {
|
||||
this.FinalizeOilOrderForm.customer_filled = true
|
||||
}
|
||||
this.FinalizeOilOrderForm.customer_filled = response.data.delivery.customer_filled == 1;
|
||||
} else {
|
||||
console.error("API Error:", response.data.error || "Failed to fetch delivery data.");
|
||||
}
|
||||
})
|
||||
.catch((error: any) => console.error("Error fetching oil order:", error));
|
||||
},
|
||||
|
||||
getPaymentCard(card_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/payment/card/" + card_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/payment/card/${card_id}`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
|
||||
if (response.data.userCard.card_number === ''){
|
||||
this.userCard === null;
|
||||
this.userCardfound = false;
|
||||
}
|
||||
else{
|
||||
if (response.data.userCard && response.data.userCard.card_number !== '') {
|
||||
this.userCard = response.data;
|
||||
this.userCardfound = true;
|
||||
} else {
|
||||
this.userCardfound = false;
|
||||
}
|
||||
this.FinalizeOilOrderForm.userCards = response.data.id
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
getPaymentCards(user_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/payment/cards/" + user_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.userCards = response.data;
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error: any) => {
|
||||
this.userCardfound = false;
|
||||
console.error(`Error fetching payment card ${card_id}:`, error);
|
||||
});
|
||||
},
|
||||
|
||||
getCustomer(user_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/" + user_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/customer/${user_id}`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
this.customer = response.data;
|
||||
this.getCustomerDescription(this.deliveryOrder.customer_id);
|
||||
this.getPaymentCards(this.deliveryOrder.customer_id);
|
||||
if (this.deliveryOrder.payment_type == 1) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id)
|
||||
}
|
||||
if (this.deliveryOrder.payment_type == 2) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id)
|
||||
}
|
||||
if (this.deliveryOrder.payment_type == 3) {
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not find customer",
|
||||
type: "error",
|
||||
});
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Could not find customer", type: "error" });
|
||||
console.error("Error fetching customer:", error);
|
||||
});
|
||||
},
|
||||
|
||||
getCustomerDescription(user_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/customer/description/" + user_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/customer/description/${user_id}`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
this.customerDescription = response.data;
|
||||
this.FinalizeOilOrderForm.fill_location =this.customerDescription.fill_location
|
||||
this.FinalizeOilOrderForm.fill_location = this.customerDescription.fill_location;
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not find customer",
|
||||
type: "error",
|
||||
});
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Could not find customer description", type: "error" });
|
||||
console.error("Error fetching customer description:", error);
|
||||
});
|
||||
},
|
||||
|
||||
getOilPricing() {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/info/price/oil/table";
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/info/price/oil/table`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
this.pricing = response.data;
|
||||
})
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Could not get oil pricing", type: "error" });
|
||||
console.error("Error fetching oil pricing:", error);
|
||||
});
|
||||
},
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not get oil pricing",
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
},
|
||||
sumdelivery(delivery_id: any) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/delivery/total/" + delivery_id;
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/delivery/total/${delivery_id}`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
this.priceprime = response.data.priceprime;
|
||||
this.pricesameday = response.data.pricesameday;
|
||||
this.total_amount = response.data.total_amount;
|
||||
this.preChargeTotal = response.data.total_amount;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not get oil pricing",
|
||||
type: "error",
|
||||
});
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Could not get delivery total", type: "error" });
|
||||
console.error("Error summing delivery:", error);
|
||||
});
|
||||
},
|
||||
UpdateAuto(payload: {
|
||||
gallons: string,
|
||||
delivery_id: string,
|
||||
}) {
|
||||
let path = import.meta.env.VITE_AUTO_URL + "/confirm/delivery"
|
||||
axios({
|
||||
method: "put",
|
||||
url: path,
|
||||
data: payload,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
notify({
|
||||
text: 'Update',
|
||||
type: 'postive',
|
||||
title: 'top'
|
||||
})
|
||||
this.$router.push({ name: "deliveryOutForDelivery" });
|
||||
}
|
||||
else {
|
||||
notify({
|
||||
text: 'Auto Failure',
|
||||
type: 'negative',
|
||||
title: 'Update'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getDeliveryStatusList() {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/query/deliverystatus";
|
||||
axios({
|
||||
method: "get",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
})
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/query/deliverystatus`;
|
||||
axios.get(path, { withCredentials: true })
|
||||
.then((response: any) => {
|
||||
this.deliveryStatus = response.data;
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
.catch((error: any) => console.error("Error fetching delivery status list:", error));
|
||||
},
|
||||
|
||||
CreateTransaction() {
|
||||
let path = import.meta.env.VITE_MONEY_URL + "/delivery/add/" + this.deliveryOrder.id;
|
||||
axios({
|
||||
method: "post",
|
||||
url: path,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
const path = `${import.meta.env.VITE_MONEY_URL}/delivery/add/${this.deliveryOrder.id}`;
|
||||
axios.post(path, {}, { withCredentials: true, headers: authHeader() })
|
||||
.then((response: any) => {
|
||||
if (response.status == 201) {
|
||||
notify({
|
||||
title: "Success",
|
||||
text: "Confirmed Transaction",
|
||||
type: "success",
|
||||
})
|
||||
}
|
||||
else {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Error Confirming Transaction",
|
||||
type: "error",
|
||||
})
|
||||
if (response.status === 201) {
|
||||
notify({ title: "Success", text: "Confirmed Transaction", type: "success" });
|
||||
} else {
|
||||
notify({ title: "Error", text: "Error Confirming Transaction", type: "error" });
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Failed to create transaction", type: "error" });
|
||||
console.error("CreateTransaction error:", error);
|
||||
});
|
||||
},
|
||||
|
||||
FinalizeOrder(payload: {
|
||||
cash_recieved: string,
|
||||
check_number: number,
|
||||
delivery_status: any,
|
||||
driver_employee_id: number,
|
||||
gallons_delivered: string,
|
||||
customer_filled: boolean,
|
||||
fill_location: number,
|
||||
|
||||
}) {
|
||||
let path = import.meta.env.VITE_BASE_URL + "/deliverydata/finalize/" + this.deliveryOrder.id;
|
||||
axios({
|
||||
method: "put",
|
||||
url: path,
|
||||
data: payload,
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
})
|
||||
FinalizeOrder(payload: any) {
|
||||
const path = `${import.meta.env.VITE_BASE_URL}/deliverydata/finalize/${this.deliveryOrder.id}`;
|
||||
axios.put(path, payload, { withCredentials: true, headers: authHeader() })
|
||||
.then((response: any) => {
|
||||
if (response.data.ok) {
|
||||
notify({
|
||||
title: "Success",
|
||||
text: "Ticket is finalized",
|
||||
type: "success",
|
||||
});
|
||||
this.CreateTransaction()
|
||||
// Navigate to delivery view page with proper error handling
|
||||
if (this.deliveryOrder && this.deliveryOrder.id) {
|
||||
this.$router.push({ name: "deliveryOrder", params: { id: this.deliveryOrder.id } });
|
||||
} else {
|
||||
// Fallback if delivery ID is not available
|
||||
this.$router.push({ name: "delivery" });
|
||||
}
|
||||
|
||||
}
|
||||
if (response.data.error) {
|
||||
notify({
|
||||
title: "Error",
|
||||
text: "Could not finalize ticket",
|
||||
type: "error",
|
||||
});
|
||||
notify({ title: "Success", text: "Ticket is finalized", type: "success" });
|
||||
this.CreateTransaction();
|
||||
this.$router.push({ name: "deliveryOrder", params: { id: this.deliveryOrder.id } });
|
||||
} else {
|
||||
notify({ title: "Error", text: response.data.error || "Could not finalize ticket", type: "error" });
|
||||
this.$router.push({ name: "delivery" });
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
notify({ title: "Error", text: "Failed to finalize order", type: "error" });
|
||||
console.error("FinalizeOrder error:", error);
|
||||
});
|
||||
},
|
||||
onSubmit() {
|
||||
if (this.deliveryOrder.automatic == 1) {
|
||||
let auto_payload = {
|
||||
gallons: this.CreateOilOrderForm.basicInfo.gallons_delivered,
|
||||
delivery_id: this.deliveryOrder.id
|
||||
}
|
||||
this.UpdateAuto(auto_payload);
|
||||
}
|
||||
let payload = {
|
||||
|
||||
async onSubmit() {
|
||||
// First, check if there's a pre-authorized transaction for this delivery.
|
||||
try {
|
||||
// This is the CORRECT URL for the backend endpoint.
|
||||
const correctedUrl = `${import.meta.env.VITE_AUTHORIZE_URL}/api/transaction/delivery/${this.$route.params.id}`;
|
||||
|
||||
const transactionResponse = await axios.get(correctedUrl, {
|
||||
withCredentials: true,
|
||||
headers: authHeader(),
|
||||
});
|
||||
|
||||
// If a valid, approved, pre-auth transaction is found...
|
||||
if (transactionResponse.data && transactionResponse.data.transaction_type === 1 && transactionResponse.data.status === 0) {
|
||||
|
||||
// Recalculate the final amount based on the GALLONS DELIVERED from the form
|
||||
const gallons = this.FinalizeOilOrderForm.gallons_delivered || '0';
|
||||
const pricePerGallon = parseFloat(this.deliveryOrder.customer_price);
|
||||
let finalAmount = parseFloat(gallons) * pricePerGallon;
|
||||
|
||||
if (this.deliveryOrder.prime == 1) {
|
||||
finalAmount += parseFloat(this.pricing.price_prime.toString()) || 0;
|
||||
}
|
||||
if (this.deliveryOrder.same_day == 1) {
|
||||
finalAmount += parseFloat(this.pricing.price_same_day.toString()) || 0;
|
||||
}
|
||||
|
||||
// ...then redirect to the capture page with the correct data.
|
||||
this.$router.push({
|
||||
name: 'captureAuthorize',
|
||||
params: { id: this.$route.params.id },
|
||||
query: {
|
||||
gallons: gallons,
|
||||
amount: finalAmount.toFixed(2).toString()
|
||||
}
|
||||
});
|
||||
return; // IMPORTANT: Stop execution here to prevent finalization.
|
||||
}
|
||||
} catch (error: any) { // ✅ FIX: Added ': any' to solve TypeScript error
|
||||
// This is the expected path if no pre-auth transaction exists.
|
||||
// We log the error for debugging but continue to the finalization logic below.
|
||||
console.log("No pre-authorized transaction found. Proceeding with standard finalization.");
|
||||
}
|
||||
|
||||
// If no pre-auth transaction was found, proceed with the normal finalization flow.
|
||||
const payload = {
|
||||
cash_recieved: this.FinalizeOilOrderForm.cash_recieved,
|
||||
check_number: this.FinalizeOilOrderForm.check_number,
|
||||
delivery_status: this.FinalizeOilOrderForm.delivery_status,
|
||||
driver_employee_id: this.FinalizeOilOrderForm.driver,
|
||||
gallons_delivered: this.FinalizeOilOrderForm.gallons_delivered,
|
||||
customer_filled: this.FinalizeOilOrderForm.customer_filled,
|
||||
|
||||
fill_location: this.FinalizeOilOrderForm.fill_location,
|
||||
};
|
||||
|
||||
this.FinalizeOrder(payload);
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user