-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: order initialization should have a credit_card arg #22
Comments
Sure that'd be great, thanks |
@peterskipper Hey, Peter! I pulled in a commit yesterday that fixes this. See here. Rather than initialize the Order object with a card (I don't think you need it to call pay_with), I just modified the calls that use credit_card to use the card object that the caller passes in. I'm going to close this issue out - let me know if you have any objections. |
Thanks for responding! I'm a little bit concerned, though I may not understand the fix. It looks like pay_with uses card=False by default, and that in turn causes a 'Cash' payment to be sent? Won't that cause me to accidentally order a pizza with cash when I'm just testing my code out with pay_with? |
@peterskipper Excellent question! pay_with and place use two distinct (but similar-looking) URL endpoints. You can see the actual endpoints in the urls module here. There's one API for getting a price for the order, and then another one for actually placing it. So, you could repeatedly price your order as you add toppings etc, and then place it once you've confirmed your price looks as intended.
|
The README example(s) order.pay_with(card) and order.place(card) do not currently work because an order object expects to have a credit_card attribute. The function signature for order should have a credit_card attribute set to None:
def init(self, store, customer, address, credit_card=None, country=COUNTRY_USA):
And then the pay_with method should check if self.credit_card is None
I can contribute a fix if you'd like!
The text was updated successfully, but these errors were encountered: