Ejemplo n.º 1
0
        public async Task Should_Create_User_And_Add_Card()
        {
            string          externalUserId  = RandomGenerator.RandomId;
            CardInformation cardInformation = CardInformationBuilder
                                              .Create()
                                              .Build();

            CreateCardRequest createCardRequest = CreateCardRequestBuilder.Create()
                                                  .Card(cardInformation)
                                                  .ExternalId(externalUserId)
                                                  .Email("*****@*****.**")
                                                  .Build();

            Card card = await Card.CreateAsync(createCardRequest, Options);

            PrintResponse(card);

            Assert.AreEqual(Locale.TR.ToString(), card.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), card.Status);
            Assert.NotNull(card.SystemTime);
            Assert.AreEqual("123456789", card.ConversationId);
            Assert.AreEqual("*****@*****.**", card.Email);
            Assert.AreEqual("552879", card.BinNumber);
            Assert.AreEqual("card alias", card.CardAlias);
            Assert.AreEqual("CREDIT_CARD", card.CardType);
            Assert.AreEqual("MASTER_CARD", card.CardAssociation);
            Assert.AreEqual("Paraf", card.CardFamily);
            Assert.AreEqual("Halk Bankası", card.CardBankName);
            Assert.True(card.CardBankCode.Equals(12L));
        }
Ejemplo n.º 2
0
        private async Task <Card> CreateCard()
        {
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .Email("*****@*****.**")
                                            .Build();

            return(await Card.CreateAsync(cardRequest, Options));
        }
        private Card CreateCard()
        {
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .Email("*****@*****.**")
                                            .Build();

            return(Card.Create(cardRequest, Options));
        }
Ejemplo n.º 4
0
        public async Task Should_Create_Payment_With_Registered_Card()
        {
            string          externalUserId  = RandomGenerator.RandomId;
            CardInformation cardInformation = CardInformationBuilder.Create()
                                              .Build();

            CreateCardRequest cardRequest = CreateCardRequestBuilder.Create()
                                            .Card(cardInformation)
                                            .ExternalId(externalUserId)
                                            .Email("*****@*****.**")
                                            .Build();

            Card card = await Card.CreateAsync(cardRequest, Options);

            PaymentCard paymentCard = PaymentCardBuilder.Create()
                                      .CardUserKey(card.CardUserKey)
                                      .CardToken(card.CardToken)
                                      .Build();

            CreatePaymentRequest request = CreatePaymentRequestBuilder.Create()
                                           .StandardListingPayment()
                                           .PaymentCard(paymentCard)
                                           .Build();

            Payment payment = await Payment.CreateAsync(request, Options);

            PrintResponse(payment);

            Assert.Null(payment.ConnectorName);
            Assert.AreEqual(Locale.TR.ToString(), payment.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), payment.Status);
            Assert.NotNull(payment.SystemTime);
            Assert.AreEqual("123456789", payment.ConversationId);
            Assert.Null(payment.ErrorCode);
            Assert.Null(payment.ErrorMessage);
            Assert.Null(payment.ErrorGroup);
            Assert.NotNull(payment.PaymentId);
            Assert.NotNull(payment.BasketId);
            Assert.AreEqual("1", payment.Price);
            Assert.AreEqual("1.1", payment.PaidPrice);
            Assert.AreEqual("0.02887500", payment.IyziCommissionRateAmount);
            Assert.AreEqual("0.25000000", payment.IyziCommissionFee);
            Assert.AreEqual("10.00000000", payment.MerchantCommissionRate);
            Assert.AreEqual("0.1", payment.MerchantCommissionRateAmount);
            Assert.AreEqual(0.028875, payment.IyziCommissionRateAmount.ParseDouble());
            Assert.AreEqual(0.25, payment.IyziCommissionFee.ParseDouble());
            Assert.AreEqual(10, payment.MerchantCommissionRate.ParseDouble());
            AssertDecimal.AreEqual(0.02887500M, payment.IyziCommissionRateAmount.ParseDecimal());
            AssertDecimal.AreEqual(0.25000000M, payment.IyziCommissionFee.ParseDecimal());
            AssertDecimal.AreEqual(10.00000000M, payment.MerchantCommissionRate.ParseDecimal());
            Assert.AreEqual(1, payment.Installment);
        }