Skip to content

Commit

Permalink
Improved: payload for updating the shipping method so as to use exist…
Browse files Browse the repository at this point in the history
…ing contactMech (#92)
  • Loading branch information
amansinghbais committed Dec 3, 2024
1 parent 3155ace commit b4c3da4
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/views/Order.vue
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export default defineComponent({
isUpdated = await this.updatePickupFacility(shipGroup)
showToast(translate(isUpdated ? "Pickup facility updated successfully." : "Failed to update the pickup store."))
} else {
isUpdated = await this.updateShippingAddress(shipGroup)
isUpdated = await this.updateShippingMethod(shipGroup)
if(isUpdated) {
const isUpdated = await this.brokerOrderItem(shipGroup.items, true);
Expand All @@ -645,7 +645,7 @@ export default defineComponent({
}
if(shipGroup.selectedShipmentMethodTypeId !== "STOREPICKUP" && this.customerAddress.address1 && itemsForShipping.length) {
if(await this.updateShippingAddress(shipGroup)) {
if(await this.updateShippingMethod(shipGroup)) {
isUpdated = await this.brokerOrderItem(itemsForShipping, true);
if(!isUpdated) hasFailure = true;
} else {
Expand Down Expand Up @@ -705,7 +705,7 @@ export default defineComponent({
return false;
},
async updateShippingAddress(shipGroup: any) {
async updateShippingMethod(shipGroup: any) {
let resp
const payload = {
Expand All @@ -714,19 +714,13 @@ export default defineComponent({
"shipmentMethod": `${this.deliveryMethod}@_NA_`,
"contactMechPurposeTypeId": "SHIPPING_LOCATION",
"facilityId": "_NA_",
"toName": this.customerAddress.toName,
"address1": this.customerAddress.address1,
"city": this.customerAddress.city,
"stateProvinceGeoId": this.customerAddress.stateProvinceGeoId,
"postalCode": this.customerAddress.postalCode,
"countryGeoId": this.customerAddress.countryGeoId,
"contactMechId": this.customerAddress.id,
"token": this.token
} as any
try {
resp = await OrderService.updateShippingAddress(payload);
if(!hasError(resp)) {
shipGroup.shipTo.postalAddress = this.customerAddress
this.isOrderUpdated = true
return true;
} else {
Expand Down

0 comments on commit b4c3da4

Please sign in to comment.