Esempio n. 1
0
        public Transaction ManageTransaction(ManagementBuilder builder)
        {
            if (string.IsNullOrEmpty(AccessToken))
            {
                SignIn();
            }

            GpApiRequest request = GpApiManagementRequestBuilder.BuildRequest(builder, this);

            if (request != null)
            {
                var response = DoTransaction(request.Verb, request.Endpoint, request.RequestBody, request.QueryStringParams, builder.IdempotencyKey);
                if (builder.PaymentMethod is TransactionReference && builder.PaymentMethod.PaymentMethodType == PaymentMethodType.APM)
                {
                    return(GpApiMapping.MapResponseAPM(response));
                }
                return(GpApiMapping.MapResponse(response));
            }
            return(null);
        }
Esempio n. 2
0
        public Transaction ProcessAuthorization(AuthorizationBuilder builder)
        {
            if (string.IsNullOrEmpty(AccessToken))
            {
                SignIn();
            }

            GpApiRequest request = GpApiAuthorizationRequestBuilder.BuildRequest(builder, this);

            if (request != null)
            {
                var response = DoTransaction(request.Verb, request.Endpoint, request.RequestBody, request.QueryStringParams, builder.IdempotencyKey);
                if (builder.PaymentMethod is AlternativePaymentMethod)
                {
                    return(GpApiMapping.MapResponseAPM(response));
                }
                return(GpApiMapping.MapResponse(response));
            }
            return(null);
        }