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);
        }
Beispiel #2
0
        public void Should_Disapprove_Payment()
        {
            CreateSubMerchantRequest request = CreateSubMerchantRequestBuilder.Create()
                                               .PersonalSubMerchantRequest()
                                               .Build();

            SubMerchant subMerchant = SubMerchant.Create(request, _options);

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

            Payment payment = Payment.Create(paymentRequest, _options);

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

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

            Approval.Create(approvalRequest, _options);

            Disapproval disapproval = Disapproval.Create(approvalRequest, _options);

            PrintResponse(disapproval);

            Assert.AreEqual(paymentTransactionId, disapproval.PaymentTransactionId);
            Assert.AreEqual(Status.SUCCESS.ToString(), disapproval.Status);
            Assert.AreEqual(Locale.TR.ToString(), disapproval.Locale);
            Assert.NotNull(disapproval.SystemTime);
            Assert.Null(disapproval.ErrorCode);
            Assert.Null(disapproval.ErrorMessage);
            Assert.Null(disapproval.ErrorGroup);
        }