Skip to content

Commit f37bce8

Browse files
Merge pull request Magicjarvis#2 from wardcraigj/canada
Canada
2 parents deb5e12 + b03a434 commit f37bce8

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

pizzapi/address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def __init__(self, street, city, region='', zip='', country=COUNTRY_USA, *args):
77
self.street = street.strip()
88
self.city = city.strip()
99
self.region = region.strip()
10-
self.zip = str(zip).strip(),
10+
self.zip = str(zip).strip()
1111
self.urls = Urls(country)
1212
self.country = country
1313

pizzapi/order.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,28 +88,35 @@ def validate(self):
8888
return response['Status'] != -1
8989

9090
# TODO: Actually test this
91-
def place(self, card):
91+
def place(self, card=False):
9292
self.pay_with(card)
9393
response = self._send(self.urls.place_url(), False)
9494
return response
9595

9696
# TODO: Add self.price() and update whenever called and items were changed
97-
def pay_with(self, card):
97+
def pay_with(self, card=False):
9898
"""Use this instead of self.place when testing"""
9999
# get the price to check that everything worked okay
100100
response = self._send(self.urls.price_url(), True)
101101

102102
if response['Status'] == -1:
103103
raise Exception('get price failed: %r' % response)
104-
self.credit_card = card
105-
self.data['Payments'] = [
106-
{
107-
'Type': 'CreditCard',
108-
'Expiration': self.credit_card.expiration,
109-
'Amount': self.data['Amounts'].get('Customer', 0),
110-
'CardType': self.credit_card.card_type,
111-
'Number': int(self.credit_card.number),
112-
'SecurityCode': int(self.credit_card.cvv),
113-
'PostalCode': int(self.credit_card.zip)
114-
}
115-
]
104+
105+
if card == False:
106+
self.data['Payments'] = [
107+
{
108+
'Type': 'DebitDoor',
109+
}
110+
]
111+
else:
112+
self.data['Payments'] = [
113+
{
114+
'Type': 'CreditCard',
115+
'Expiration': self.credit_card.expiration,
116+
'Amount': self.data['Amounts'].get('Customer', 0),
117+
'CardType': self.credit_card.card_type,
118+
'Number': int(self.credit_card.number),
119+
'SecurityCode': int(self.credit_card.cvv),
120+
'PostalCode': int(self.credit_card.zip)
121+
}
122+
]

0 commit comments

Comments
 (0)