public async Task CanGetThreeDsPaymentBeforeAuth() { PaymentRequest <CardSource> paymentRequest = TestHelper.CreateCardPaymentRequest(); paymentRequest.ThreeDS = true; PaymentResponse paymentResponse = await _api.Payments.RequestAsync(paymentRequest); paymentResponse.IsPending.ShouldBe(true); GetPaymentResponse paymentDetails = await _api.Payments.GetAsync(paymentResponse.Pending.Id); paymentDetails.ShouldNotBeNull(); paymentDetails.Id.ShouldBe(paymentResponse.Pending.Id); paymentDetails.Customer.ShouldNotBeNull(); paymentDetails.Customer.Id.ShouldBe(paymentResponse.Pending.Customer.Id); paymentDetails.Customer.Email.ShouldBe(paymentRequest.Customer.Email); paymentDetails.Amount.ShouldBe(paymentRequest.Amount); paymentDetails.Currency.ShouldBe(paymentRequest.Currency); paymentDetails.Reference.ShouldNotBeNullOrWhiteSpace(); paymentDetails.PaymentType.ShouldBe(PaymentType.Regular); paymentDetails.Risk.ShouldNotBeNull(); paymentDetails.RequestedOn.ShouldBeGreaterThan(DateTime.MinValue); paymentDetails.ThreeDS.ShouldNotBeNull(); paymentDetails.ThreeDS.Downgraded.ShouldBe(false); paymentDetails.ThreeDS.Enrolled.ShouldNotBeNullOrEmpty(); paymentDetails.RequiresRedirect().ShouldBe(true); paymentDetails.GetRedirectLink().ShouldNotBeNull(); paymentDetails.Links.ShouldNotBeNull(); paymentDetails.Links.ShouldNotBeEmpty(); paymentDetails.Status.ShouldBe(PaymentStatus.Pending); paymentDetails.Source.AsCard().ShouldNotBeNull(); paymentDetails.Approved.ShouldBeFalse(); }
public async Task CanGetNonThreeDsPayment() { PaymentRequest <CardSource> paymentRequest = TestHelper.CreateCardPaymentRequest(); paymentRequest.PaymentType = PaymentType.Recurring; PaymentResponse paymentResponse = await _api.Payments.RequestAsync(paymentRequest); GetPaymentResponse paymentDetails = await _api.Payments.GetAsync(paymentResponse.Payment.Id); paymentDetails.ShouldNotBeNull(); paymentDetails.Id.ShouldBe(paymentResponse.Payment.Id); paymentDetails.Customer.ShouldNotBeNull(); paymentDetails.Customer.Id.ShouldBe(paymentResponse.Payment.Customer.Id); paymentDetails.Customer.Email.ShouldBe(paymentRequest.Customer.Email); paymentDetails.Amount.ShouldBe(paymentResponse.Payment.Amount); paymentDetails.Currency.ShouldBe(paymentResponse.Payment.Currency); paymentDetails.PaymentType.ShouldBe(paymentRequest.PaymentType); paymentDetails.BillingDescriptor.ShouldNotBeNull(); paymentDetails.Reference.ShouldNotBeNullOrWhiteSpace(); paymentDetails.Risk.ShouldNotBeNull(); paymentDetails.RequestedOn.ShouldBeGreaterThan(paymentResponse.Payment.ProcessedOn.AddMinutes(-1)); paymentDetails.ThreeDS.ShouldBeNull(); paymentDetails.Links.ShouldNotBeNull(); paymentDetails.Links.ShouldNotBeEmpty(); paymentDetails.Status.ShouldBe(PaymentStatus.Authorized); paymentDetails.Source.AsCard().ShouldNotBeNull(); paymentDetails.Approved.ShouldBeTrue(); }
public void ShouldDeserializeDefaultGetPaymentResponseInstrumentSender() { var fileContent = GetJsonFileContent("./Resources/Sender/GetPaymentResponseInstrumentSender.json"); GetPaymentResponse getPaymentResponse = (GetPaymentResponse) new JsonSerializer().Deserialize(fileContent, typeof(GetPaymentResponse)); getPaymentResponse.ShouldNotBeNull(); getPaymentResponse.Sender.ShouldNotBeNull(); getPaymentResponse.Sender.Type().ShouldBe(PaymentSenderType.Instrument); getPaymentResponse.Sender.ShouldBeAssignableTo(typeof(PaymentInstrumentSender)); }
public void ShouldDeserializeDefaultGetPaymentResponseAlternativeSender() { var fileContent = GetJsonFileContent("./Resources/Sender/GetPaymentResponseAlternativeSender.json"); GetPaymentResponse getPaymentResponse = (GetPaymentResponse) new JsonSerializer().Deserialize(fileContent, typeof(GetPaymentResponse)); getPaymentResponse.ShouldNotBeNull(); getPaymentResponse.Sender.ShouldNotBeNull(); getPaymentResponse.Sender.Type().ShouldBeNull(); getPaymentResponse.Sender.ShouldBeAssignableTo(typeof(ResponseAlternativeSender)); ResponseAlternativeSender sender = (ResponseAlternativeSender)getPaymentResponse.Sender; sender["type"].ShouldBe("xyz"); }
public void ShouldDeserializeDefaultGetPaymentResponseCorporateSender() { var fileContent = GetJsonFileContent("./Resources/Sender/GetPaymentResponseCorporateSender.json"); GetPaymentResponse getPaymentResponse = (GetPaymentResponse) new JsonSerializer().Deserialize(fileContent, typeof(GetPaymentResponse)); getPaymentResponse.ShouldNotBeNull(); getPaymentResponse.Sender.ShouldNotBeNull(); getPaymentResponse.Sender.Type().ShouldBe(PaymentSenderType.Corporate); getPaymentResponse.Sender.ShouldBeAssignableTo(typeof(PaymentCorporateSender)); PaymentCorporateSender sender = (PaymentCorporateSender)getPaymentResponse.Sender; sender.CompanyName.ShouldNotBeEmpty(); }
public async Task CanGetAlternativePayment() { var alternativePaymentSource = new AlternativePaymentSource("giropay") { { "bic", "TESTDETT421" }, { "purpose", "CKO giropay test" } }; PaymentPending payment = await RequestAlternativePaymentAsync(alternativePaymentSource); GetPaymentResponse verifiedPayment = await _api.Payments.GetAsync(payment.Id); verifiedPayment.ShouldNotBeNull(); verifiedPayment.Id.ShouldBe(payment.Id); var verifiedSource = verifiedPayment.Source.AsAlternativePayment(); foreach (string key in verifiedSource.Keys) { verifiedSource[key].ShouldBe(alternativePaymentSource[key]); } }