Exemplo n.º 1
0
        public async Task Should_Approve_Payment_Item()
        {
            CreateSubMerchantRequest request = CreateSubMerchantRequestBuilder.Create()
                                               .PersonalSubMerchantRequest()
                                               .Build();

            SubMerchant subMerchant = await SubMerchant.CreateAsync(request, Options);

            CreatePaymentRequest paymentRequest = CreatePaymentRequestBuilder.Create()
                                                  .MarketplacePayment(subMerchant.SubMerchantKey)
                                                  .Build();

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

            string paymentTransactionId = payment.PaymentItems[0].PaymentTransactionId;

            CreateApprovalRequest approvalRequest = CreateApprovalRequestBuilder.Create()
                                                    .PaymentTransactionId(paymentTransactionId)
                                                    .Build();

            Approval approval = await Approval.CreateAsync(approvalRequest, Options);

            Assert.AreEqual(paymentTransactionId, approval.PaymentTransactionId);
            Assert.AreEqual(Locale.TR.ToString(), payment.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), payment.Status);
            Assert.NotNull(payment.SystemTime);
            Assert.Null(payment.ErrorCode);
            Assert.Null(payment.ErrorMessage);
            Assert.Null(payment.ErrorGroup);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ApproveSubMerchant(int id)
        {
            CreateApprovalRequest request = new CreateApprovalRequest

            {
                Locale               = "tr",
                ConversationId       = "123456789",
                PaymentTransactionId = "11807130"
            };

            Approval approval = await Approval.CreateAsync(request, option);

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 3
0
        public async Task Should_Approve_Payment_Item()
        {
            CreateApprovalRequest request = new CreateApprovalRequest
            {
                Locale               = Locale.TR.ToString(),
                ConversationId       = "123456789",
                PaymentTransactionId = "1"
            };

            Approval approval = await Approval.CreateAsync(request, Options);

            PrintResponse(approval);

            Assert.AreEqual(Status.SUCCESS.ToString(), approval.Status);
            Assert.AreEqual(Locale.TR.ToString(), approval.Locale);
            Assert.AreEqual("123456789", approval.ConversationId);
            Assert.IsNotNull(approval.SystemTime);
            Assert.IsNull(approval.ErrorCode);
            Assert.IsNull(approval.ErrorMessage);
            Assert.IsNull(approval.ErrorGroup);
        }