Changeset 43
- Timestamp:
- 04/15/08 22:09:33 (4 years ago)
- Location:
- trunk/fpys
- Files:
-
- 3 modified
-
client.py (modified) (3 diffs)
-
tests/client_test.py (modified) (1 diff)
-
tests/wsgi_responder.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fpys/client.py
r42 r43 44 44 self.dateInstalled = datetime.strptime(di, 45 45 "%Y-%m-%dT%H:%M:%S") 46 47 class Transaction(object): 48 def __init__(self, transaction_element): 49 for element in transaction_element.getchildren(): 50 attr_name = element.tag[0].lower() + element.tag[1:] 51 setattr(self, attr_name, element.text) 46 52 47 53 class TransactionResponse(object): … … 90 96 if document.find("Token"): 91 97 self.token = Token(document.find("Token")) 98 99 if document.find("Transaction"): 100 self.transaction = Transaction(document.find("Transaction")) 92 101 93 102 if document.find("AccountBalance"): … … 293 302 return self.execute(params) 294 303 295 def getTransaction(self): 296 pass 304 def getTransaction(self, transaction_id): 305 params = {'Action': 'GetTransaction', 306 'TransactionId': transaction_id} 307 return self.execute(params) 297 308 298 309 def installPaymentInstruction(self, -
trunk/fpys/tests/client_test.py
r42 r43 155 155 # TODO sample, please? 156 156 pass 157 158 def test_getTransaction(): 159 response = fps_client.getTransaction("135AHMQA9H3NEFJL73GQ33873PLPNGLQZP1") 160 assert response.success == True 161 assert response.transaction.transactionId == "135AHMQA9H3NEFJL73GQ33873PLPNGLQZP1" 162 assert response.transaction.senderName == "Kate M DeHaven" 163 assert response.transaction.operation == "Pay" 164 assert response.transaction.paymentMethod == "CC" 157 165 158 166 def test_pay(): -
trunk/fpys/tests/wsgi_responder.py
r42 r43 61 61 return [response] 62 62 63 def GetTransaction(self, environ): 64 response = """<ns0:GetTransactionResponse xmlns:ns0="http://fps.amazonaws.com/doc/2007-01-08/"><Transaction><TransactionId>135AHMQA9H3NEFJL73GQ33873PLPNGLQZP1</TransactionId><CallerTransactionDate>2008-04-15T19:43:01.000-07:00</CallerTransactionDate><DateReceived>2008-04-15T19:41:09.000-07:00</DateReceived><DateCompleted>2008-04-15T19:41:10.000-07:00</DateCompleted><TransactionAmount><CurrencyCode>USD</CurrencyCode><Amount>1.000000</Amount></TransactionAmount><Fees><CurrencyCode>USD</CurrencyCode><Amount>0.100000</Amount></Fees><CallerTokenId>Z34XMGF4GCILGV7EV2D45DDO4Q6WXEJZ9175UNR5I9LFEC1H8MMX3R6NBJUJH8MQ</CallerTokenId><SenderTokenId>2446UQQZ1KJ6RPCB7CM774RH1TCAP7GA2VU9ATJ345N7JFGLXLEP3Y2HTDBRXRGR</SenderTokenId><RecipientTokenId>ZS4X4GK4GDIFGVDED2DF54DOTQAWX8JC91I5UNR7I4LFFCUH8KM53RKNDJUMHFM3</RecipientTokenId><Operation>Pay</Operation><PaymentMethod>CC</PaymentMethod><Status>Success</Status><SenderName>Kate M DeHaven</SenderName><CallerName>Timothy P. Freund</CallerName><RecipientName>Timothy P. Freund</RecipientName><TransactionParts><AccountId>JMXHWUQJONDR53DM28EHVCGFILGI4RGNX541Z9</AccountId><Role>Caller</Role><Name>Timothy P. Freund</Name><Reference>FPeS Invoice #10</Reference><FeePaid><CurrencyCode>USD</CurrencyCode><Amount>0.000000</Amount></FeePaid></TransactionParts><TransactionParts><AccountId>GGPXABTDHHRY73MECXBLPFR7JN14ZJQT694V22</AccountId><Role>Sender</Role><Name>Kate M DeHaven</Name><FeePaid><CurrencyCode>USD</CurrencyCode><Amount>0.000000</Amount></FeePaid></TransactionParts><TransactionParts><AccountId>JMXHWUQJONDR53DM28EHVCGFILGI4RGNX541Z9</AccountId><Role>Recipient</Role><Name>Timothy P. Freund</Name><FeePaid><CurrencyCode>USD</CurrencyCode><Amount>0.100000</Amount></FeePaid></TransactionParts><StatusHistory><Date>2008-04-15T19:41:10.000-07:00</Date><Status>Initiated</Status></StatusHistory><StatusHistory><Date>2008-04-15T19:41:10.000-07:00</Date><Status>Success</Status></StatusHistory></Transaction><Status>Success</Status><RequestId>cb093851-e322-4396-acc1-7618bdff81eb:0</RequestId></ns0:GetTransactionResponse>""" 65 return [response] 66 63 67 def InstallPaymentInstruction(self, environ): 64 68 if environ['fps.params']['PaymentInstruction'][0].find("Invalid") != -1:
