- Timestamp:
- 03/25/08 01:11:34 (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
r34 r35 45 45 "%Y-%m-%dT%H:%M:%S") 46 46 47 class TransactionResponse(object): 48 def __init__(self, id=None, status=None): 49 self.id = id 50 self.status = status 51 47 52 class FPSResponse(object): 48 53 def __init__(self, document=None): 49 54 if document is not None: 50 55 document = ET.ElementTree(document) 56 log.debug(ET.tostring(document.getroot())) 51 57 self.document = document 52 58 … … 91 97 self.balances[bal] = (float(document.find("//" + bal).find("Amount").text), 92 98 document.find("//" + bal).find("CurrencyCode").text) 99 100 if document.getroot().tag.find("PayResponse") >= 0: 101 self.transaction = TransactionResponse() 102 self.transaction.id = document.find("//TransactionId").text 103 self.transaction.status = document.find("//Status").text 93 104 94 105 … … 195 206 data = httperror.read() 196 207 httperror.close() 197 log.debug("returned_data == %s" % data)198 208 199 209 return FPSResponse(ET.fromstring(data)) -
trunk/fpys/tests/client_test.py
r34 r35 132 132 pass 133 133 134 def test_pay(): 135 """Initiates a payment""" 136 response = fps_client.pay(caller_token="Z34XMGF4GCILGV7EV2D45DDO4Q6WXEJZ9175UNR5I9LFEC1H8MMX3R6NBJUJH8MQ", 137 sender_token="2646ZQ3Z19JBRPIBXCM97QRHKT6APPGB2VE9ATJD48N7CF1LXNEZ3YFHBDBPXFGM", 138 recipient_token="Z44X4G84G1ILGV4ER2DQ5HDO3Q2WXBJS91C5QNREICLF3CZH8SMA3RXN1JUDH9MC", 139 amount=2.0, 140 caller_reference="FPeS Invoice 37") 141 assert response.success == True 142 assert response.transaction.id == "133I77HJS56JVM7M54OZIRITRVLUT5F227U" 143 assert response.transaction.status == "Initiated" -
trunk/fpys/tests/wsgi_responder.py
r34 r35 57 57 return [response] 58 58 59 def Pay(self, environ): 60 response = """<ns0:PayResponse xmlns:ns0="http://fps.amazonaws.com/doc/2007-01-08/"><ns0:TransactionResponse><TransactionId>133I77HJS56JVM7M54OZIRITRVLUT5F227U</TransactionId><Status>Initiated</Status></ns0:TransactionResponse><Status>Success</Status><RequestId>99a81daa-1a13-46eb-872e-98c61bde612e:0</RequestId></ns0:PayResponse>""" 61 return [response] 59 62 60 63 flexible_payment_service = FlexiblePaymentService()
