RIAEvangelist / node-dominos-pizza-api

This is a node.js wrapper for the dominos pizza apis
MIT License
514 stars 126 forks source link

Changing expected Coupon type from String to Object to apply correctly #105

Closed Joeprobruh closed 3 years ago

Joeprobruh commented 3 years ago

I found that applying the coupon codes directly as Strings did not apply the coupon to the order. While the coupon existed on the order after validation/pricing, it did not adjust the value of the order to account for the savings.

After trying a few things, I found that coupons can be applied following this style:

// OLD STYLE
coupons: ['FREE_PIZZA']; // Doesn't apply the coupon

// NEW STYLE
coupons: [{'Code' : 'FREE_PIZZA'}]; //This applies the coupon and shows the appropriate change(s) in the price response

Updated the appropriate unit test as well.

RIAEvangelist commented 3 years ago

Do you know if you met the requirements for the coupon?

You might try a simpler one that is less likely to have strict business rules around it, like a simple discount code or something simple like that.

If a simpler coupon also does not make a difference when pricing the order, perhaps we should look more deeply into how the dominos web order works with coupons.

On Thu, Mar 18, 2021, 1:20 PM JoeProBruh @.***> wrote:

I found that applying the coupon codes directly as Strings did not apply the coupon to the order. While the coupon existed on the order after validation/pricing, it did not adjust the value of the order to account for the savings.

After trying a few things, I found that coupons can be applied following this style:

// OLD STYLE coupons: ['FREE_PIZZA']; // Doesn't apply the coupon

// NEW STYLE coupons: [{'Code' : 'FREE_PIZZA'}]; //This applies the coupon and shows the appropriate change(s) in the price response

Updated the appropriate unit test as well.

You can view, comment on, or merge this pull request online at:

https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105 Commit Summary

  • Changing expected Coupon type from String to Object to apply correctly

File Changes

Patch Links:

- https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105.patch

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC2DEKM5PKMOSUVVJY25S3TEJOBJANCNFSM4ZNKK6WQ .

RIAEvangelist commented 3 years ago

Nevermind I replied before completely reviewing your message, I am on my phone at the moment.

I will review the code when I am at my laptop again, thanks for the submission!

On Thu, Mar 18, 2021, 2:53 PM Brandon Nozaki Miller @.***> wrote:

Do you know if you met the requirements for the coupon?

You might try a simpler one that is less likely to have strict business rules around it, like a simple discount code or something simple like that.

If a simpler coupon also does not make a difference when pricing the order, perhaps we should look more deeply into how the dominos web order works with coupons.

On Thu, Mar 18, 2021, 1:20 PM JoeProBruh @.***> wrote:

I found that applying the coupon codes directly as Strings did not apply the coupon to the order. While the coupon existed on the order after validation/pricing, it did not adjust the value of the order to account for the savings.

After trying a few things, I found that coupons can be applied following this style:

// OLD STYLE coupons: ['FREE_PIZZA']; // Doesn't apply the coupon

// NEW STYLE coupons: [{'Code' : 'FREE_PIZZA'}]; //This applies the coupon and shows the appropriate change(s) in the price response

Updated the appropriate unit test as well.

You can view, comment on, or merge this pull request online at:

https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105 Commit Summary

  • Changing expected Coupon type from String to Object to apply correctly

File Changes

Patch Links:

- https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105.patch

https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RIAEvangelist/node-dominos-pizza-api/pull/105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC2DEKM5PKMOSUVVJY25S3TEJOBJANCNFSM4ZNKK6WQ .