def test_delete_payment_profile(self, DeleteRequest): _request = Mock() DeleteRequest.return_value = _request # Scenario: call is successful return_value = delete_payment_profile(self.customer_id, self.payment_profile_id) DeleteRequest.assert_called_once_with(customerProfileId=self.customer_id, customerPaymentProfileId=self.payment_profile_id) self.assertTrue(return_value) # Scenario: call raises AuthorizeNetException _request.make_request.side_effect = AuthorizeNetException('') return_value = delete_payment_profile(self.customer_id, self.payment_profile_id) self.assertFalse(return_value)
def test_delete_payment_profile(self, DeleteRequest): _request = Mock() DeleteRequest.return_value = _request # Scenario: call is successful return_value = delete_payment_profile(self.customer_id, self.payment_profile_id) DeleteRequest.assert_called_once_with(customerProfileId=self.customer_id, customerPaymentProfileId=self.payment_profile_id) self.assertTrue(return_value) # Scenario: call raises AuthorizeNetException _request.make_request.side_effect = AuthorizeNetException('') return_value = delete_payment_profile(self.customer_id, self.payment_profile_id) self.assertFalse(return_value)
def delete_payment_method(user, payment_method_id): profile_id = CustomerID.get_id(user._id) success = api.delete_payment_profile(profile_id, payment_method_id) if success: PayID.delete(user, payment_method_id)
def delete_payment_method(user, payment_method_id): profile_id = CustomerID.get_id(user._id) success = api.delete_payment_profile(profile_id, payment_method_id) if success: PayID.delete(user, payment_method_id)