public function CheckoutTest::testNoBillingCheckout in Commerce Stripe 8
Tests checkout without billing information.
This uses a card which does not trigger SCA or 3DS authentication.
@dataProvider dataProviderUserAuthenticated
File
- tests/
src/ FunctionalJavascript/ CheckoutTest.php, line 135
Class
- CheckoutTest
- Tests checkout with Stripe.
Namespace
Drupal\Tests\commerce_stripe\FunctionalJavascriptCode
public function testNoBillingCheckout($authenticated) {
$payment_gateway = PaymentGateway::load('stripe_testing');
$configuration = $payment_gateway
->getPlugin()
->getConfiguration();
$configuration['collect_billing_information'] = FALSE;
$payment_gateway
->getPlugin()
->setConfiguration($configuration);
$payment_gateway
->save();
if ($authenticated) {
$customer = $this
->createUser();
$this
->drupalLogin($customer);
}
$this
->drupalGet($this->product
->toUrl()
->toString());
$this
->submitForm([], 'Add to cart');
$this
->drupalGet('checkout/1');
if (!$authenticated) {
$this
->submitForm([], 'Continue as Guest');
$this
->getSession()
->getPage()
->fillField('contact_information[email]', 'guest@example.com');
$this
->getSession()
->getPage()
->fillField('contact_information[email_confirm]', 'guest@example.com');
}
$this
->fillCreditCardData('4242424242424242', '0322', '123');
$this
->submitForm([], 'Continue to review');
$this
->assertWaitForText('Visa ending in 4242');
$this
->assertWaitForText('Expires 3/2022');
$this
->submitForm([], 'Pay and complete purchase');
$this
->assertWaitForText('Your order number is 1. You can view your order on your account page when logged in.');
}