- Timestamp:
- 04/09/08 02:54:20 (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
r39 r40 100 100 # Hackish at best... 101 101 root_tag = document.getroot().tag 102 for tag_name in ["PayResponse", "Re serveResponse", "SettleResponse"]:102 for tag_name in ["PayResponse", "RefundResponse", "ReserveResponse", "SettleResponse"]: 103 103 if self.success and root_tag.find(tag_name) >= 0: 104 104 self.transaction = TransactionResponse() … … 343 343 return self.execute(params) 344 344 345 def refund(self): 346 pass 345 def refund(self, 346 caller_token, 347 refund_sender_token, 348 transaction_id, 349 caller_reference, 350 refund_amount=None, 351 date = None, 352 charge_fee_to='Recipient', 353 ): 354 params = {'Action': 'Refund', 355 'CallerTokenId': caller_token, 356 'RefundSenderTokenId': refund_sender_token, 357 'TransactionId': transaction_id, 358 'CallerReference': caller_reference, 359 'ChargeFeeTo': charge_fee_to, 360 } 361 if date is not None: 362 params['TransactionDate'] = date 363 if refund_amount is not None: 364 params['RefundAmount.Amount'] = refund_amount 365 params['RefundAmount.CurrencyCode'] = "USD" 366 return self.execute(params) 347 367 348 368 def reserve(self, -
trunk/fpys/tests/client_test.py
r39 r40 162 162 assert response.transaction.status == "Initiated" 163 163 164 def test_refund(): 165 # the following was used to create a new token to authorize the refund 166 # fps_client.installPaymentInstruction("MyRole == 'Sender';\nOperationType == 'Refund';", 167 # "unit_test_refund_01", 168 # "SingleUse", 169 # "Refund of Test Transaction", 170 # "unit_test_refund_01") 171 response = fps_client.refund(caller_token="Z34XMGF4GCILGV7EV2D45DDO4Q6WXEJZ9175UNR5I9LFEC1H8MMX3R6NBJUJH8MQ", 172 refund_sender_token="Z74XVGZ4G2IKGVIE52D453DOEQGWXMJ491V58NR6I3LFQC2H8BM73R8NMJUJHCMN", 173 transaction_id="134OLF7MHB2L4V9T54RHADQ9FCK5NLVZHDC", 174 caller_reference="Unit Test Refund", 175 refund_amount="19.95") 176 assert response.success == True 177 assert response.transaction.status == "Initiated" 178 assert response.transaction.id == "134P2CRSN5JFN3KDV3RKPKVQ3OG4H67PPR8" 179 164 180 def test_reserve(): 165 181 response = fps_client.reserve("Z34XMGF4GCILGV7EV2D45DDO4Q6WXEJZ9175UNR5I9LFEC1H8MMX3R6NBJUJH8MQ", -
trunk/fpys/tests/wsgi_responder.py
r39 r40 71 71 return [response] 72 72 73 def Refund(self, environ): 74 response = """<ns0:RefundResponse xmlns:ns0="http://fps.amazonaws.com/doc/2007-01-08/"><ns0:TransactionResponse><TransactionId>134P2CRSN5JFN3KDV3RKPKVQ3OG4H67PPR8</TransactionId><Status>Initiated</Status></ns0:TransactionResponse><Status>Success</Status><RequestId>b1c83ba0-17d3-45c4-b188-b116d2a17c12:0</RequestId></ns0:RefundResponse>""" 75 return [response] 76 73 77 def Reserve(self, environ): 74 78 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>"""
