/// <summary> /// Popula o objeto RequestBase em comum a todos. /// </summary> private void FillRequestBase(String operation, String merchantId, String merchantKey, String referenceNum, decimal chargeTotal, String creditCardNumber , String expMonth, String expYear, String cvvInd, String cvvNumber, String authentication, String processorId , String numberOfInstallments, String chargeInterest, String ipAddress, String customerIdExt, String currencyCode , String fraudCheck, String softDescriptor, decimal? iataFee) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase rBase = new RequestBase(); if (operation.Equals("sale")) order.Sale = rBase; else if (operation.Equals("auth")) order.Auth = rBase; rBase.ReferenceNum = referenceNum; rBase.ProcessorId = processorId; rBase.Authentication = authentication; rBase.IpAddress = ipAddress; rBase.CustomerIdExt = customerIdExt; rBase.FraudCheck = fraudCheck; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Payment payment = new Payment(); rBase.Payment = payment; payment.ChargeTotal = chargeTotal; payment.CurrencyCode = currencyCode; payment.SoftDescriptor = softDescriptor; payment.IataFee = iataFee; if (String.IsNullOrEmpty(numberOfInstallments)) numberOfInstallments = "0"; int tranInstallments = int.Parse(numberOfInstallments); //Verifica se vai precisar criar o nó de parcelas e juros. if (!String.IsNullOrEmpty(chargeInterest) && tranInstallments > 1) { payment.CreditInstallment = new CreditInstallment(); payment.CreditInstallment.ChargeInterest = chargeInterest.ToUpper(); payment.CreditInstallment.NumberOfInstallments = numberOfInstallments; } TransactionDetail detail = rBase.TransactionDetail; PayType payType = detail.PayType; CreditCard creditCard = new CreditCard(); payType.CreditCard = creditCard; creditCard.CvvInd = cvvInd; creditCard.CvvNumber = cvvNumber; creditCard.ExpMonth = expMonth; creditCard.ExpYear = expYear; creditCard.Number = creditCardNumber; }
/// <summary> /// Faz a transação passando o token do cartão já salvo na base. /// </summary> private ResponseBase PayWithToken(String operation, String merchantId, String merchantKey, String referenceNum, decimal chargeTotal, String processorId , String token, String customerId, String numberOfInstallments, String chargeInterest, String ipAddress, String currencyCode, String fraudCheck) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase rBase = new RequestBase(); if (operation.Equals("sale")) order.Sale = rBase; else if (operation.Equals("auth")) order.Auth = rBase; rBase.ReferenceNum = referenceNum; rBase.ProcessorId = processorId; rBase.IpAddress = ipAddress; rBase.FraudCheck = fraudCheck; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Payment payment = new Payment(); rBase.Payment = payment; payment.ChargeTotal = chargeTotal; payment.CurrencyCode = currencyCode; if (String.IsNullOrEmpty(numberOfInstallments)) numberOfInstallments = "0"; int tranInstallments = int.Parse(numberOfInstallments); //Verifica se vai precisar criar o nó de parcelas e juros. if (!String.IsNullOrEmpty(chargeInterest) && tranInstallments > 1) { payment.CreditInstallment = new CreditInstallment(); payment.CreditInstallment.ChargeInterest = chargeInterest.ToUpper(); payment.CreditInstallment.NumberOfInstallments = numberOfInstallments; } TransactionDetail detail = rBase.TransactionDetail; PayType payType = detail.PayType; payType.OnFile = new OnFile(); payType.OnFile.CustomerId = customerId; payType.OnFile.Token = token; return new Utils().SendRequest<TransactionRequest>(this.request, this.Environment); }
/// <summary> /// Passa uma transação salvando o número de cartão automaticamente. /// </summary> private ResponseBase PaySavingCreditCardAutomatically(String operation, String merchantId, String merchantKey, String referenceNum, decimal chargeTotal , String creditCardNumber, String expMonth, String expYear, String cvvInd, String cvvNumber , String processorId, String numberOfInstallments, String chargeInterest, String ipAddress , String customerToken, String onFileEndDate, String onFilePermission, String onFileComment , String onFileMaxChargeAmount, String billingName, String billingAddress, String billingAddress2 , String billingCity, String billingState, String billingPostalCode, String billingCountry , String billingPhone, String billingEmail, String currencyCode, String fraudCheck) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase rBase = new RequestBase(); if (operation.Equals("sale")) order.Sale = rBase; else if (operation.Equals("auth")) order.Auth = rBase; rBase.ReferenceNum = referenceNum; rBase.ProcessorId = processorId; rBase.IpAddress = ipAddress; rBase.FraudCheck = fraudCheck; Billing billing = new Billing(); rBase.Billing = billing; billing.Address1 = billingAddress; billing.Address2 = billingAddress2; billing.City = billingCity; billing.Country = billingCountry; billing.Email = billingEmail; billing.Name = billingName; billing.Phone = billingPhone; billing.Postalcode = billingPostalCode; billing.State = billingState; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Payment payment = new Payment(); rBase.Payment = payment; payment.ChargeTotal = chargeTotal; payment.CurrencyCode = currencyCode; if (String.IsNullOrEmpty(numberOfInstallments)) numberOfInstallments = "0"; int tranInstallments = int.Parse(numberOfInstallments); //Verifica se vai precisar criar o nó de parcelas e juros. if (!String.IsNullOrEmpty(chargeInterest) && tranInstallments > 1) { payment.CreditInstallment = new CreditInstallment(); payment.CreditInstallment.ChargeInterest = chargeInterest.ToUpper(); payment.CreditInstallment.NumberOfInstallments = numberOfInstallments; } TransactionDetail detail = rBase.TransactionDetail; PayType payType = detail.PayType; CreditCard creditCard = new CreditCard(); payType.CreditCard = creditCard; creditCard.CvvInd = cvvInd; creditCard.CvvNumber = cvvNumber; creditCard.ExpMonth = expMonth; creditCard.ExpYear = expYear; creditCard.Number = creditCardNumber; rBase.SaveOnFile = new SaveOnFile(); rBase.SaveOnFile.CustomerToken = customerToken; rBase.SaveOnFile.OnFileComment = onFileComment; rBase.SaveOnFile.OnFileEndDate = onFileEndDate; rBase.SaveOnFile.OnFileMaxChargeAmount = onFileMaxChargeAmount; rBase.SaveOnFile.OnFilePermission = onFilePermission; return new Utils().SendRequest<TransactionRequest>(this.request, this.Environment); }
/// <summary> /// Efetua o preenchimento comum aos métodos de Recorrente /// </summary> private void FillRecurringBase(String merchantId, String merchantKey, String referenceNum, decimal chargeTotal , String processorId, String numberOfInstallments, String chargeInterest , String ipAddress, String action, String startDate , String frequency, String period, String installments, String failureThreshold , String currencyCode) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase recurringPayment = new RequestBase(); order.RecurringPayment = recurringPayment; recurringPayment.ReferenceNum = referenceNum; recurringPayment.ProcessorId = processorId; recurringPayment.IpAddress = ipAddress; Payment payment = new Payment(); recurringPayment.Payment = payment; payment.ChargeTotal = chargeTotal; payment.CurrencyCode = currencyCode; if (String.IsNullOrEmpty(numberOfInstallments)) numberOfInstallments = "0"; int tranInstallments = int.Parse(numberOfInstallments); //Verifica se vai precisar criar o nó de parcelas e juros. if (!String.IsNullOrEmpty(chargeInterest) && tranInstallments > 1) { payment.CreditInstallment = new CreditInstallment(); payment.CreditInstallment.ChargeInterest = chargeInterest.ToUpper(); payment.CreditInstallment.NumberOfInstallments = numberOfInstallments; } Recurring recurring = new Recurring(); recurringPayment.Recurring = recurring; recurring.Action = action; recurring.FailureThreshold = failureThreshold; recurring.Frequency = frequency; recurring.Installments = installments; recurring.Period = period; recurring.StartDate = startDate; }
public ResponseBase OnlineDebit(String merchantId, String merchantKey, String referenceNum, decimal chargeTotal , String processorId, String parametersUrl, String ipAddress, String customerIdExt) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase sale = new RequestBase(); order.Sale = sale; sale.ReferenceNum = referenceNum; sale.ProcessorId = processorId; sale.IpAddress = ipAddress; sale.CustomerIdExt = customerIdExt; Payment payment = new Payment(); sale.Payment = payment; payment.ChargeTotal = chargeTotal; TransactionDetail detail = sale.TransactionDetail; PayType payType = detail.PayType; OnlineDebit debit = new OnlineDebit(); payType.OnlineDebit = debit; if (parametersUrl == null) parametersUrl = String.Empty; debit.ParametersURL = parametersUrl; return new Utils().SendRequest<TransactionRequest>(this.request, this.Environment); }
/// <summary> /// Faz uma requisição de boleto. /// </summary> public ResponseBase Boleto(String merchantId, String merchantKey, String referenceNum, decimal chargeTotal, String processorId , String ipAddress, String customerIdExt, String expirationDate, String number, String instructions , String billingName, String billingAddress, String billingAddress2, String billingCity, String billingState , String billingPostalCode, String billingCountry, String billingPhone, String billingEmail) { this.request = new TransactionRequest(merchantId, merchantKey); Order order = this.request.Order; RequestBase sale = new RequestBase(); order.Sale = sale; sale.ReferenceNum = referenceNum; sale.ProcessorId = processorId; sale.IpAddress = ipAddress; sale.CustomerIdExt = customerIdExt; Billing billing = new Billing(); sale.Billing = billing; billing.Address1 = billingAddress; billing.Address2 = billingAddress2; billing.City = billingCity; billing.Country = billingCountry; billing.Email = billingEmail; billing.Name = billingName; billing.Phone = billingPhone; billing.Postalcode = billingPostalCode; billing.State = billingState; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Payment payment = new Payment(); sale.Payment = payment; payment.ChargeTotal = chargeTotal; TransactionDetail detail = sale.TransactionDetail; PayType payType = detail.PayType; Boleto boleto = new Boleto(); payType.Boleto = boleto; boleto.ExpirationDate = expirationDate; boleto.Instructions = instructions; boleto.Number = number; return new Utils().SendRequest<TransactionRequest>(this.request, this.Environment); }
public CaptureOrReturn() { Payment = new Payment(); }