diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index 8c4d6cf1a..1a6a4d99e 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -526,17 +526,9 @@ export default { // try to call API to add donation to order // TEMP DUMMY CALL TO SIMULATE SUCCESS OR ERROR FROM API CALL - // TO BE REPLACED BY REAL CALL LATER - const donationResponse = await this.dispatchStoreActionWithLogging( - storeActions.LOOKUP_VIN_BY_PLATE, - { licensePlate: plateTemp, licenseState: "OH" }, - "test", - false - ).catch((error) => { - return error; - }); + const donationResponse = this.createMockedResponse(amount); - if (donationResponse?.status == "200") { + if (donationResponse?.wasSuccessful) { this.showDonationSuccess = true; this.showDonationError = false; const donationResponse = await baseMixin.methods.dispatchStoreAction( @@ -554,6 +546,26 @@ export default { ); } }, + //mocked response. should be removed once integrate with actual api call. + createMockedResponse(amount) { + let result; + + switch (amount) { + case 1: + result = { wasSuccessful: true, wasLocked: false }; + break; + case 3: + result = { wasSuccessful: false, wasLocked: true }; + break; + case 5: + result = { wasSuccessful: false, wasLocked: false }; + break; + default: + result = { wasSuccessful: null, wasLocked: null }; // Default case if amount doesn't match + } + + return result; + }, }, watch: { donationAmount(newValue) {