public PaymentCreator() { createdPayment = new PaymentClass(); createdPayment.Type = PaymentType.CreditCard; createdPayment.Amount = 15700; createdPayment.Installments = 1; createdPayment.CreditCard = new CreditCardCreator().Result; }
internal static dynamic BuildPayment(PaymentModel.Payment payment) { dynamic paymentInfo = new JObject(); paymentInfo.Type = payment.Type.ToString(); paymentInfo.Amount = payment.Amount; paymentInfo.Installments = payment.Installments; if (payment.CreditCard != null) { paymentInfo.CreditCard = BuildCreditCard(payment.CreditCard); } return(paymentInfo); }
public void Init() { credentials = new Credential(); credentials.AddCredentialItem("MerchantId", "41d05cb1-9f41-4981-9cd2-25994f37cd4c"); credentials.AddCredentialItem("MerchantKey", "BNFUCGHXSSKTFLMSMRSYIGPARRYXNYBTCYNQPTIH"); customerCreator = new CustomerCreator(); paymentCreator = new PaymentCreator(); creditCardCreator = new CreditCardCreator(); customerData = customerCreator.Result; paymentData = paymentCreator.Result; creditCardData = creditCardCreator.Result; }
public void ShouldReturnErrorWhenSendAuthorizationTransactionWithAmountEqualToZero() { //Arrange PaymentClass paymentWithAmountZero = paymentCreator.WithAmount(0).Result; paymentWithAmountZero.CreditCard = creditCardData; AuthorizationRequest authorizationRequestData = new AuthorizationRequest() { MerchantOrderId = "12345", Customer = customerData, Payment = paymentWithAmountZero }; CieloTransaction authorizationTransaction = new CieloTransaction(TransactionType.Authorization, credentials, ApiEnvironment.Sandbox); //Act AuthorizationResponse authorizationResponse = (AuthorizationResponse)authorizationTransaction.Execute(authorizationRequestData); //Assert Assert.AreEqual("Ocorreu um erro de validação na chamada da transação de autorização. Verifique o log de informação para mais detalhes", authorizationResponse.ReturnMessage); }