public void CreateChargeWithCardId() { var customer = CheckoutClient.CustomerService.CreateCustomer(TestHelper.GetCustomerCreateModelWithCard()).Model; var cardIdChargeCreateModel = TestHelper.GetCardIdChargeCreateModel(customer.Cards.Data[0].Id, customer.Email); var response = CheckoutClient.ChargeService.ChargeWithCardId(cardIdChargeCreateModel); ////Check if charge details match Assert.NotNull(response); Assert.IsTrue(response.HttpStatusCode == System.Net.HttpStatusCode.OK); Assert.IsTrue(response.Model.Id.StartsWith("charge_")); Assert.IsTrue(response.Model.AutoCapTime == cardIdChargeCreateModel.AutoCapTime); Assert.IsTrue(response.Model.AutoCapture.Equals(cardIdChargeCreateModel.AutoCapture, System.StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(response.Model.Email.Equals(cardIdChargeCreateModel.Email, System.StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(response.Model.Currency.Equals(cardIdChargeCreateModel.Currency, System.StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(response.Model.Description.Equals(cardIdChargeCreateModel.Description, System.StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(response.Model.Value == cardIdChargeCreateModel.Value); Assert.IsTrue(response.Model.Card.Id == cardIdChargeCreateModel.CardId); Assert.IsNotNullOrEmpty(response.Model.Status); Assert.IsNotNullOrEmpty(response.Model.AuthCode); Assert.IsNotNullOrEmpty(response.Model.ResponseCode); }
public void CreateChargeWithCardId() { var customer = CheckoutClient.CustomerService.CreateCustomer(TestHelper.GetCustomerCreateModelWithCard()).Model; var cardIdChargeCreateModel = TestHelper.GetCardIdChargeCreateModel(customer.Cards.Data[0].Id, customer.Email); var response = CheckoutClient.ChargeService.ChargeWithCardId(cardIdChargeCreateModel); ////Check if charge details match response.Should().NotBeNull(); response.HttpStatusCode.Should().Be(HttpStatusCode.OK); response.Model.Id.Should().StartWith("charge_"); response.Model.AutoCapTime.Should().Be(cardIdChargeCreateModel.AutoCapTime); response.Model.AutoCapture.Should().BeEquivalentTo(cardIdChargeCreateModel.AutoCapture); response.Model.Email.Should().BeEquivalentTo(cardIdChargeCreateModel.Email); response.Model.Currency.Should().BeEquivalentTo(cardIdChargeCreateModel.Currency); response.Model.Description.Should().BeEquivalentTo(cardIdChargeCreateModel.Description); response.Model.Value.Should().Be(cardIdChargeCreateModel.Value); response.Model.Card.Id.Should().Be(cardIdChargeCreateModel.CardId); response.Model.Status.Should().NotBeNullOrEmpty(); response.Model.AuthCode.Should().NotBeNullOrEmpty(); response.Model.ResponseCode.Should().NotBeNullOrEmpty(); }
public void CreateChargeWithCardId_N3DChargeMode() { var customer = CheckoutClient.CustomerService.CreateCustomer(TestHelper.GetCustomerCreateModelWithCard()).Model; var cardIdChargeCreateModel = TestHelper.GetCardIdChargeCreateModel(customer.Cards.Data[0].Id, customer.Email); cardIdChargeCreateModel.ChargeMode = 1; cardIdChargeCreateModel.AttemptN3D = true; var response = CheckoutClient.ChargeService.ChargeWithCardId(cardIdChargeCreateModel); //Check if charge details match response.Should().NotBeNull(); response.HttpStatusCode.Should().Be(HttpStatusCode.OK); response.Model.Id.Should().StartWith("charge_test"); response.Model.ChargeMode.Should().Be(1); response.Model.AttemptN3D.Should().BeTrue(); //response.Model.RedirectUrl.Should().StartWith("http"); // only use if redirect URL is configured response.Model.ResponseCode.Should().NotBeNullOrEmpty(); response.Model.TrackId.ShouldBeEquivalentTo(cardIdChargeCreateModel.TrackId); }
public void CreateChargeWithCardId_3DChargeMode() { var customer = CheckoutClient.CustomerService.CreateCustomer(TestHelper.GetCustomerCreateModelWithCard()).Model; var cardIdChargeCreateModel = TestHelper.GetCardIdChargeCreateModel(customer.Cards.Data[0].Id, customer.Email); cardIdChargeCreateModel.ChargeMode = 2; var response = CheckoutClient.ChargeService.ChargeWithCardId(cardIdChargeCreateModel); //Check if charge details match response.Should().NotBeNull(); response.HttpStatusCode.Should().Be(HttpStatusCode.OK); response.Model.Id.Should().StartWith("pay_tok"); response.Model.ChargeMode.Should().Be(2); response.Model.RedirectUrl.Should().StartWith("http"); response.Model.ResponseCode.Should().NotBeNullOrEmpty(); response.Model.TrackId.ShouldBeEquivalentTo(cardIdChargeCreateModel.TrackId); }