RIAEvangelist / node-dominos-pizza-api

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

Coupon support? #62

Closed aprivette closed 7 years ago

aprivette commented 7 years ago

Is there a way to use coupon codes in the API? I see there's some code for it in the repo and I also see that a menu request will return coupons, but I cant find a way to actually apply the codes to an order. An example would be very helpful. Thanks!

RIAEvangelist commented 7 years ago

Yes, I believe @julianh2o did add this. I'll look into the code

RIAEvangelist commented 7 years ago

It appears you just create a new coupon the same way you would create a new item.

aprivette commented 7 years ago

Thanks for your response - I actually tried that but it tells me that "addCoupon" is not a function.

RIAEvangelist commented 7 years ago

can you show your code?

aprivette commented 7 years ago

order.addCoupon( new pizzapi.Coupon( { code: 'CODE', quantity: 1 } ) );

RIAEvangelist commented 7 years ago

are you using the dominos npm module or the pizzaapi module?

aprivette commented 7 years ago

pizzapi

RIAEvangelist commented 7 years ago

thats the problem :) its very out of date. I will take it out of the docs.

RIAEvangelist commented 7 years ago

use the dominos api

aprivette commented 7 years ago

Ok! Is there a way to prevent it from actually ordering pizza until I'm done testing?

RIAEvangelist commented 7 years ago

use a bad card. I think there should also be another method but if not it is something we could probably add. or you could contribute it too. Either way.

madelinecameron commented 7 years ago

Hahah. Sorry about that all! I've been meaning to come back to it and update it but just have been busy between work and other projects!

aprivette commented 7 years ago

Thanks all! Great project, I can't wait to use it.

RIAEvangelist commented 7 years ago

@madelinecameron it happens! Glad you are keeping busy!