You are here

public function BraintreeApiIntegrationTest::testCreatePaymentRejectedConsumedNonce in Commerce Braintree 8

Tests a re-used nonce.

@dataProvider dataProviderBillingProfile

File

tests/src/Kernel/BraintreeApiIntegrationTest.php, line 123

Class

BraintreeApiIntegrationTest
Tests the Braintree SDK integration.

Namespace

Drupal\Tests\commerce_braintree\Kernel

Code

public function testCreatePaymentRejectedConsumedNonce($billing_profile) {
  $this
    ->expectException(InvalidRequestException::class);
  $this
    ->expectExceptionMessage('Cannot use a paymentMethodNonce more than once.');

  /** @var \Drupal\commerce_braintree\Plugin\Commerce\PaymentGateway\HostedFieldsInterface $gateway_plugin */
  $gateway_plugin = $this->gateway
    ->getPlugin();
  $gateway_plugin
    ->createPayment($this
    ->generateTestPayment($billing_profile, '10.00', \Braintree\Test\Nonces::$consumed));
}