예제 #1
0
 def test_update_payment_invalid_payment_id_is_none(self):
     globee_payment = GlobeePayment()
     custom_payment_id = "NEWID"
     custom_store_reference = "NEWSTOREREF"
     updated_data = {
         "custom_payment_id": custom_payment_id,
         "custom_store_reference": custom_store_reference,
     }
     globee_payment.payment_data = updated_data
     globee_payment.payment_id = None
     with self.assertRaises(ValidationError):
         globee_payment.update_payment_request()
예제 #2
0
 def test_update_payment_invalid_payment_id(self):
     globee_payment = GlobeePayment()
     custom_payment_id = "NEWID"
     custom_store_reference = "NEWSTOREREF"
     updated_data = {
         "custom_payment_id": custom_payment_id,
         "custom_store_reference": custom_store_reference,
         'customer': {
             'email': '*****@*****.**'
         },
     }
     globee_payment.payment_data = updated_data
     with self.assertRaises(ValidationError):
         globee_payment.update_payment_request("INVALID_KEY")
예제 #3
0
 def test_update_payment_valid(self):
     data = {
         'total': 13.37,
         'currency': 'EUR',
         'customer': {
             'name': 'foobar',
             'email': '*****@*****.**'
         },
     }
     globee_payment = GlobeePayment(payment_data=data)
     self.assertTrue(globee_payment.check_required_fields())
     self.assertIn("https://test.globee.com/",
                   globee_payment.create_request())
     custom_payment_id = "NEWID"
     custom_store_reference = "NEWSTOREREF"
     updated_data = {
         "custom_payment_id": custom_payment_id,
         "custom_store_reference": custom_store_reference,
         'customer': {
             'email': '*****@*****.**'
         },
     }
     globee_payment.payment_data = updated_data
     response = globee_payment.update_payment_request()
     self.assertEqual(response['id'], globee_payment.payment_id)
     self.assertEqual(response['custom_payment_id'], custom_payment_id)
     self.assertEqual(response['custom_store_reference'],
                      custom_store_reference)
예제 #4
0
 def test_update_payment_invalid_email_not_set(self):
     data = {
         'total': 13.37,
         'currency': 'EUR',
         'customer': {
             'name': 'foobar',
             'email': '*****@*****.**'
         },
     }
     globee_payment = GlobeePayment(payment_data=data)
     self.assertTrue(globee_payment.check_required_fields())
     self.assertIn("https://test.globee.com/",
                   globee_payment.create_request())
     custom_payment_id = "NEWID"
     custom_store_reference = "NEWSTOREREF"
     updated_data = {
         "custom_payment_id": custom_payment_id,
         "custom_store_reference": custom_store_reference,
     }
     globee_payment.payment_data = updated_data
     with self.assertRaises(ValidationError):
         globee_payment.update_payment_request()
예제 #5
0
 def test_update_payment_invalid_payment_data_is_none(self):
     globee_payment = GlobeePayment()
     globee_payment.payment_data = None
     globee_payment.payment_id = "SOME KEY"
     with self.assertRaises(ValidationError):
         globee_payment.update_payment_request()