Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)