Пример #1
0
        public async Task <ChargeCreditCardResponse> ChargeAsync(string nonce, string referenceId, decimal amount, string customerId, string customerIpAddress)
        {
            // Build the request
            var chargeCreditCardRequest = new ChargeCreditCardRequest
            {
                CreateTransactionRequest = new CreateTransactionRequest
                {
                    MerchantAuthentication = new MerchantAuthentication {
                        LoginId = _apiLoginId, TransactionKey = _transactionKey
                    },
                    ReferenceId        = referenceId,
                    TransactionRequest = new TransactionRequest
                    {
                        Amount   = amount.ToString(),
                        Customer = new Customer {
                            Id = customerId
                        },
                        CustomerIP = customerIpAddress,
                        Duty       = new Duty(),
                        Payment    = new Payment
                        {
                            OpaqueData = new OpaqueData {
                                NonceValue = nonce
                            }
                        },
                        Shipping = new Shipping(),
                        Tax      = new Tax()
                    }
                }
            };

            return(await ChargeAsync(chargeCreditCardRequest));
        }
        public async Task <ChargeCreditCardResponse> AuthorizeAndCaptureAsync(string customerProfileId, string customerPaymentProfileId, decimal amount, string customerIP, string referenceId)
        {
            var chargeCreditCardRequest = new ChargeCreditCardRequest()
            {
                CreateTransactionRequest = new CreateTransactionRequest()
                {
                    MerchantAuthentication = _merchantAuthentication,
                    ReferenceId            = referenceId,
                    TransactionRequest     = new TransactionRequest()
                    {
                        Amount          = amount.ToString(),
                        CustomerIP      = customerIP,
                        TransactionType = "authCaptureTransaction",
                        Profile         = new CustomerProfile()
                        {
                            CustomerProfileId = customerProfileId,
                            PaymentProfile    = new CustomerPaymentProfile()
                            {
                                PaymentProfileId = customerPaymentProfileId
                            }
                        },
                        Order = new Order()
                        {
                            InvoiceNumber = referenceId
                        }
                    }
                }
            };

            var jsonRequest = new StringContent(
                JsonConvert.SerializeObject(chargeCreditCardRequest), Encoding.UTF8, "application/json");

            String jsonResponse;
            var    httpClient = _httpClientFactory.CreateClient();

            using (var response = await httpClient.PostAsync(_configuration.URL, jsonRequest))
            {
                jsonResponse = await response.Content.ReadAsStringAsync();
            }

            return(JsonConvert.DeserializeObject <ChargeCreditCardResponse>(jsonResponse));
        }
Пример #3
0
 /// <remarks/>
 public void ChargeCreditCardAsync(ChargeCreditCardRequest ChargeCreditCardRequest, object userState) {
     if ((this.ChargeCreditCardOperationCompleted == null)) {
         this.ChargeCreditCardOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChargeCreditCardOperationCompleted);
     }
     this.InvokeAsync("ChargeCreditCard", new object[] {
                 ChargeCreditCardRequest}, this.ChargeCreditCardOperationCompleted, userState);
 }
Пример #4
0
 /// <remarks/>
 public void ChargeCreditCardAsync(ChargeCreditCardRequest ChargeCreditCardRequest) {
     this.ChargeCreditCardAsync(ChargeCreditCardRequest, null);
 }
Пример #5
0
 public async Task <ChargeCreditCardResponse> ChargeAsync(ChargeCreditCardRequest chargeCreditCardRequest)
 {
     return(await new AuthorizeNetResult(_authorizeNetUrl).PostAsync <ChargeCreditCardRequest, ChargeCreditCardResponse>(chargeCreditCardRequest));
 }
    private ChargeCreditCardRequest Request_ChargeCreditCard_Legacy()
    {
        // DEVELOPER NOTE: This method charges the credit card WITHOUT using tokenization, 
        // which is NOT PCI-Compliant. This method should not be used unless otherwise informed
        // by Exigo.


        var request = new ChargeCreditCardRequest();

        request.BillingName                 = Shopping.PropertyBag.CreditCardNameOnCard;
        request.CreditCardNumber            = Shopping.PropertyBag.CreditCardNumber;
        request.ExpirationMonth             = Shopping.PropertyBag.CreditCardExpirationDate.Month;
        request.ExpirationYear              = Shopping.PropertyBag.CreditCardExpirationDate.Year;
        request.CvcCode                     = Shopping.PropertyBag.CreditCardCvc;

        request.BillingAddress              = Shopping.PropertyBag.CreditCardBillingAddress;
        request.BillingCity                 = Shopping.PropertyBag.CreditCardBillingCity;
        request.BillingState                = Shopping.PropertyBag.CreditCardBillingState;
        request.BillingZip                  = Shopping.PropertyBag.CreditCardBillingZip;
        request.BillingCountry              = Shopping.PropertyBag.CreditCardBillingCountry;

        return request;
    }