Working flow authorize

This commit is contained in:
2025-09-16 12:45:42 -04:00
parent 3cf6d1911a
commit bd95e14bb3
8 changed files with 356 additions and 43 deletions

View File

@@ -59,9 +59,10 @@
<AutomaticDeliveries v-if="automatic_status === 1 && autodeliveries.length > 0" :deliveries="autodeliveries" />
<HistoryTabs
<HistoryTabs
:deliveries="deliveries"
:service-calls="serviceCalls"
:transactions="transactions"
@open-service-modal="openEditModal"
/>
</div>
@@ -78,12 +79,13 @@
<CustomerStats :stats="customer_stats" :last_delivery="customer_last_delivery" />
<TankInfo :customer_id="customer.id" :tank="customer_tank" :description="customer_description" />
<EquipmentParts :parts="currentParts" @open-parts-modal="openPartsModal" />
<CreditCards
:cards="credit_cards"
:count="credit_cards_count"
<CreditCards
:cards="credit_cards"
:count="credit_cards_count"
:user_id="customer.user_id"
@edit-card="editCard"
@remove-card="removeCard"
:auth_net_profile_id="customer.auth_net_profile_id"
@edit-card="editCard"
@remove-card="removeCard"
/>
</div>
@@ -248,10 +250,11 @@ export default defineComponent({
deliveries: [] as Delivery[],
autodeliveries: [] as AutomaticDelivery[],
serviceCalls: [] as ServiceCall[],
transactions: [] as any[],
// --- END OF UPDATES ---
automatic_response: 0,
credit_cards_count: 0,
customer: { id: 0, user_id: 0, customer_first_name: '', customer_last_name: '', customer_town: '', customer_address: '', customer_state: 0, customer_zip: '', customer_apt: '', customer_home_type: 0, customer_phone_number: '', customer_latitude: 0, customer_longitude: 0, correct_address: true, account_number: '' },
customer: { id: 0, user_id: 0, customer_first_name: '', customer_last_name: '', customer_town: '', customer_address: '', customer_state: 0, customer_zip: '', customer_apt: '', customer_home_type: 0, customer_phone_number: '', customer_latitude: 0, customer_longitude: 0, correct_address: true, account_number: '', auth_net_profile_id: null },
customer_description: { id: 0, customer_id: 0, account_number: '', company_id: '', fill_location: 0, description: '' },
customer_tank: { id: 0, last_tank_inspection: null, tank_status: false, outside_or_inside: false, tank_size: 0 },
customer_stats: { id: 0, customer_id: 0, total_calls: 0, service_calls_total: 0, service_calls_total_spent: 0, service_calls_total_profit: 0, oil_deliveries: 0, oil_total_gallons: 0, oil_total_spent: 0, oil_total_profit: 0 },
@@ -323,6 +326,7 @@ export default defineComponent({
this.getServiceCalls(this.customer.id);
this.fetchCustomerParts(this.customer.id);
this.loadServicePlan(this.customer.id);
this.getCustomerTransactions(this.customer.id);
}).catch((error: any) => {
console.error("CRITICAL: Failed to fetch main customer data. Aborting other calls.", error);
@@ -576,6 +580,19 @@ onSubmitSocial(commentText: string) {
console.error("Failed to get customer service calls:", error);
});
},
getCustomerTransactions(customerId: number) {
let path = `${import.meta.env.VITE_BASE_URL}/payment/transactions/customer/${customerId}/1`;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
this.transactions = response.data;
}).catch((error: any) => {
console.error("Failed to get customer transactions:", error);
this.transactions = [];
});
},
openEditModal(service: ServiceCall) {
this.selectedServiceForEdit = service;
},