def test_doReferenceTransaction_invalid(self, mock_request_object): reference_id = 'B-1234' amount = Decimal('10.50') mock_request_object.return_value = 'ack=Failure&l_errorcode=42&l_longmessage0=Broken' wpp = PayPalWPP(make_request()) with self.assertRaises(PayPalFailure): wpp.doReferenceTransaction({'referenceid': reference_id, 'amt': amount})
def test_doReferenceTransaction_invalid(self, mock_request_object): reference_id = 'B-1234' amount = Decimal('10.50') mock_request_object.return_value = 'ack=Failure&l_errorcode=42&l_longmessage0=Broken' wpp = PayPalWPP(REQUEST) with self.assertRaises(PayPalFailure): wpp.doReferenceTransaction({'referenceid': reference_id, 'amt': amount})
def test_doReferenceTransaction_invalid(self, mock_request_object): reference_id = "B-1234" amount = Decimal("10.50") mock_request_object.return_value = "ack=Failure&l_errorcode=42&l_longmessage0=Broken" wpp = PayPalWPP(make_request()) with self.assertRaises(PayPalFailure): wpp.doReferenceTransaction({ "referenceid": reference_id, "amt": amount })
def test_doReferenceTransaction_valid(self, mock_request_object): reference_id = 'B-1234' amount = Decimal('10.50') mock_request_object.return_value = 'ack=Success&paymentstatus=Completed&amt=%s&version=%s&billingagreementid=%s' % \ (amount, VERSION, reference_id) wpp = PayPalWPP(REQUEST) nvp = wpp.doReferenceTransaction({'referenceid': reference_id, 'amt': amount}) call_args = mock_request_object.call_args self.assertIn('VERSION=%s' % VERSION, call_args[0][1]) self.assertIn('METHOD=DoReferenceTransaction', call_args[0][1]) self.assertIn('REFERENCEID=%s' % reference_id, call_args[0][1]) self.assertIn('AMT=%s' % amount, call_args[0][1]) self.assertEqual(nvp.method, 'DoReferenceTransaction') self.assertEqual(nvp.ack, 'Success')
def test_doReferenceTransaction_valid(self, mock_request_object): reference_id = "B-1234" amount = Decimal("10.50") mock_request_object.return_value = ( "ack=Success&paymentstatus=Completed&amt=%s&version=%s&billingagreementid=%s" % (amount, VERSION, reference_id)) wpp = PayPalWPP(make_request()) nvp = wpp.doReferenceTransaction({ "referenceid": reference_id, "amt": amount }) call_args = mock_request_object.call_args self.assertIn(f"VERSION={VERSION}", call_args[0][1]) self.assertIn("METHOD=DoReferenceTransaction", call_args[0][1]) self.assertIn(f"REFERENCEID={reference_id}", call_args[0][1]) self.assertIn(f"AMT={amount}", call_args[0][1]) self.assertEqual(nvp.method, "DoReferenceTransaction") self.assertEqual(nvp.ack, "Success")