- Timestamp:
- 04/08/08 23:50:22 (4 years ago)
- Location:
- trunk/fpys
- Files:
-
- 3 modified
-
client.py (modified) (2 diffs)
-
tests/client_test.py (modified) (1 diff)
-
tests/wsgi_responder.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fpys/client.py
r37 r38 98 98 document.find("//" + bal).find("CurrencyCode").text) 99 99 100 if document.getroot().tag.find("PayResponse") >= 0: 100 # Hackish at best... 101 root_tag = document.getroot().tag 102 if root_tag.find("PayResponse") >= 0 or root_tag.find("ReserveResponse") >= 0: 101 103 self.transaction = TransactionResponse() 102 104 self.transaction.id = document.find("//TransactionId").text … … 343 345 pass 344 346 345 def reserve(self): 346 pass 347 def reserve(self, 348 caller_token, 349 sender_token, 350 recipient_token, 351 amount, 352 caller_reference, 353 date = None, 354 charge_fee_to='Recipient'): 355 params = {'Action': 'Reserve', 356 'CallerTokenId': caller_token, 357 'SenderTokenId': sender_token, 358 'RecipientTokenId': recipient_token, 359 'TransactionAmount.Amount': amount, 360 'TransactionAmount.CurrencyCode': 'USD', 361 'CallerReference': caller_reference, 362 'ChargeFeeTo': charge_fee_to, 363 } 364 if date is not None: 365 params['TransactionDate'] = date 366 367 return self.execute(params) 347 368 348 369 def retryTransaction(self): -
trunk/fpys/tests/client_test.py
r37 r38 161 161 assert response.transaction.id == "133I77HJS56JVM7M54OZIRITRVLUT5F227U" 162 162 assert response.transaction.status == "Initiated" 163 164 def test_reserve(): 165 response = fps_client.reserve("Z34XMGF4GCILGV7EV2D45DDO4Q6WXEJZ9175UNR5I9LFEC1H8MMX3R6NBJUJH8MQ", 166 "2146KQCZ13JKRP8BHCMI7JRHPTBAPZGU2VB9FTJ84UN7UF7LXAE33YJHSDB8XCG2", 167 "Z44XQGE4GAI1GV4E92DU5KDOTQPWXKJC91V5MNRII7LFICFH8HMX3RNNPJU4HCMN", 168 "19.95", 169 "unit_test_ref_1") 170 assert response.success == True 171 assert response.transaction.status == "Initiated" 172 assert response.transaction.id == "134OLF7MHB2L4V9T54RHADQ9FCK5NLVZHDC" 173 174 -
trunk/fpys/tests/wsgi_responder.py
r37 r38 71 71 return [response] 72 72 73 def Reserve(self, environ): 74 response = """<ns0:ReserveResponse xmlns:ns0="http://fps.amazonaws.com/doc/2007-01-08/"><ns0:TransactionResponse><TransactionId>134OLF7MHB2L4V9T54RHADQ9FCK5NLVZHDC</TransactionId><Status>Initiated</Status></ns0:TransactionResponse><Status>Success</Status><RequestId>cedef0ad-76f0-4604-82bb-ad28020a4ddc:0</RequestId></ns0:ReserveResponse>""" 75 return [response] 76 73 77 flexible_payment_service = FlexiblePaymentService() 74 78
