Beispiel #1
0
        public void Validate_WithError()
        {
            //Arrange
            var charge = new ChargeRequest
            {
                Amount   = 20.5,
                Currency = "EU",
                Payments = new List <PaymentRequest>()
                {
                    new IdealPaymentRequest()
                    {
                        Amount   = 20.5,
                        Currency = "EUR",
                        Details  = new IdealDetailsRequest()
                        {
                            IssuerId     = "RABONL2U",
                            SuccessUrl   = "",
                            FailedUrl    = "",
                            CancelledUrl = "",
                            ExpiredUrl   = "",
                            PurchaseId   = Guid.NewGuid().ToString("N"),
                            Description  = "Test description."
                        }
                    }
                }
            };

            //Act
            _validate.ValidateAndThrow(charge);
        }
 /// <summary>
 ///     Method to pay with iDeal, PayPal, AfterPay, Creditcard, Sofort or Bancontact.
 /// </summary>
 /// <param name="charge">The charge object to send.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>A charge response object.</returns>
 public async Task <ChargeResponse> PayAsync(ChargeRequest charge, CancellationToken cancellationToken = default(CancellationToken))
 {
     _chargeValidator.ValidateAndThrow(charge);
     return(await PostAsync <ChargeResponse>($"charges/{ApiVersion}", charge, cancellationToken).ConfigureAwait(false));
 }