@@ -88,28 +88,35 @@ def validate(self):
88
88
return response ['Status' ] != - 1
89
89
90
90
# TODO: Actually test this
91
- def place (self , card ):
91
+ def place (self , card = False ):
92
92
self .pay_with (card )
93
93
response = self ._send (self .urls .place_url (), False )
94
94
return response
95
95
96
96
# 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 ):
98
98
"""Use this instead of self.place when testing"""
99
99
# get the price to check that everything worked okay
100
100
response = self ._send (self .urls .price_url (), True )
101
101
102
102
if response ['Status' ] == - 1 :
103
103
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