Exemplo n.º 1
0
        private async Task <PaymentPending> RequestAlternativePaymentAsync(AlternativePaymentSource alternativePaymentSource)
        {
            PaymentRequest <IRequestSource> paymentRequest = TestHelper.CreateAlternativePaymentMethodRequest(alternativePaymentSource, currency: Currency.EUR);

            PaymentResponse apiResponse = await _api.Payments.RequestAsync(paymentRequest);

            apiResponse.IsPending.ShouldBeTrue();
            apiResponse.Pending.ShouldNotBeNull();

            PaymentPending pendingPayment = apiResponse.Pending;

            pendingPayment.Id.ShouldNotBeNullOrEmpty();
            pendingPayment.Status.ShouldBe(PaymentStatus.Pending);
            pendingPayment.Reference.ShouldBe(paymentRequest.Reference);
            pendingPayment.Customer.ShouldNotBeNull();
            pendingPayment.Customer.Id.ShouldNotBeNullOrEmpty();
            pendingPayment.Customer.Email.ShouldNotBeNullOrEmpty();
            pendingPayment.RequiresRedirect().ShouldBeTrue();
            pendingPayment.GetRedirectLink().ShouldNotBeNull();

            return(pendingPayment);
        }