Пример #1
0
        public async Task <CardConnectVoidResponse> VoidAuthorization(CardConnectVoidRequest request)
        {
            CardConnectVoidResponse attempt;

            if (ShouldMockCardConnectResponse())
            {
                // Returns a mocked void object (only in Test and UAT)
                attempt = MockCardConnectVoidResponse(request);
            }
            else
            {
                attempt = await this
                          .Request("cardconnect/rest/void", request.currency)
                          .PutJsonAsync(request)
                          .ReceiveJson <CardConnectVoidResponse>();
            }

            if (attempt.WasSuccessful())
            {
                return(attempt);
            }
            throw new CreditCardVoidException(new ApiError()
            {
                Data      = attempt,
                Message   = attempt.resptext, // response codes: https://developer.cardconnect.com/cardconnect-api?lang=json#void-service-url
                ErrorCode = attempt.respcode
            }, attempt);
        }
Пример #2
0
        private CardConnectVoidResponse MockCardConnectVoidResponse(CardConnectVoidRequest request)
        {
            CardConnectVoidResponse response;

            response = new CardConnectVoidResponse()
            {
                amount   = 100000,
                resptext = "Successful Mocked Response",
                respstat = "A",
                respcode = "0",
            };

            return(response);
        }
Пример #3
0
        public async Task <CardConnectVoidResponse> VoidAuthorization(CardConnectVoidRequest request)
        {
            var attempt = await this
                          .Request("cardconnect/rest/void", request.currency)
                          .PutJsonAsync(request)
                          .ReceiveJson <CardConnectVoidResponse>();

            if (attempt.WasSuccessful())
            {
                return(attempt);
            }
            throw new CreditCardVoidException(new ApiError()
            {
                Data      = attempt,
                Message   = attempt.resptext, // response codes: https://developer.cardconnect.com/cardconnect-api?lang=json#void-service-url
                ErrorCode = attempt.respcode
            }, attempt);
        }