From bb55a229c9ece96d965cb085f68e4b878ccec703 Mon Sep 17 00:00:00 2001 From: Corin Chellberg Date: Mon, 26 Feb 2018 23:28:02 +0000 Subject: [PATCH] BTOPTMZ-164 remove sepa related tests Signed-off-by: Anna Ho --- tests/integration/EuropeBankAccountTest.php | 54 ----- tests/integration/HttpClientApi.php | 25 --- .../TransactionAdvancedSearchTest.php | 50 ----- tests/integration/TransactionTest.php | 192 ------------------ 4 files changed, 321 deletions(-) delete mode 100644 tests/integration/EuropeBankAccountTest.php diff --git a/tests/integration/EuropeBankAccountTest.php b/tests/integration/EuropeBankAccountTest.php deleted file mode 100644 index a047b3e6..00000000 --- a/tests/integration/EuropeBankAccountTest.php +++ /dev/null @@ -1,54 +0,0 @@ - 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - $result = $gateway->paymentMethod()->create([ - "customerId" => $customer->id, - "paymentMethodNonce" => $nonce - ]); - - $this->assertTrue($result->success); - $paymentMethod = $result->paymentMethod; - $account = $gateway->paymentMethod()->find($paymentMethod->token); - $this->assertEquals($paymentMethod->token, $account->token); - $this->assertEquals($account->bic, "DEUTDEFF"); - } -} diff --git a/tests/integration/HttpClientApi.php b/tests/integration/HttpClientApi.php index 7b0a4dc5..42e18ea3 100644 --- a/tests/integration/HttpClientApi.php +++ b/tests/integration/HttpClientApi.php @@ -91,31 +91,6 @@ public function nonce_for_new_card($options) { } } - public function nonceForNewEuropeanBankAccount($options) { - $clientTokenOptions = [ - 'sepaMandateType' => 'business', - 'sepaMandateAcceptanceLocation' => 'Rostock, Germany' - ]; - - if (array_key_exists("customerId", $options)) { - $clientTokenOptions["customerId"] = $options["customerId"]; - unset($options["customerId"]); - } - - $gateway = new Braintree\Gateway($this->_config); - - $clientToken = json_decode(base64_decode($gateway->clientToken()->generate($clientTokenOptions))); - $options["authorization_fingerprint"] = $clientToken->authorizationFingerprint; - - $response = $this->post('/client_api/v1/sepa_mandates/', json_encode($options)); - if ($response["status"] == 201 || $response["status"] == 202) { - $body = json_decode($response["body"]); - return $body->europeBankAccounts[0]->nonce; - } else { - throw new Exception(print_r($response, true)); - } - } - public function nonceForPayPalAccount($options) { $clientToken = json_decode(Test\Helper::decodedClientToken()); $options["authorization_fingerprint"] = $clientToken->authorizationFingerprint; diff --git a/tests/integration/TransactionAdvancedSearchTest.php b/tests/integration/TransactionAdvancedSearchTest.php index 051eef0e..e138d063 100644 --- a/tests/integration/TransactionAdvancedSearchTest.php +++ b/tests/integration/TransactionAdvancedSearchTest.php @@ -1521,54 +1521,4 @@ public function testHandlesPayPalAccounts() $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($result->transaction->id, $collection->firstItem()->id); } - - public function testHandlesEuropeBankAccounts() - { - $gateway = new Braintree\Gateway([ - 'environment' => 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - $transactionResult = $gateway->transaction()->sale([ - "customerId" => $customer->id, - "paymentMethodNonce" => $nonce, - "merchantAccountId" => "fake_sepa_ma", - "amount" => 100 - ]); - - $this->assertTrue($transactionResult->success); - - $collection = $gateway->transaction()->search([ - Braintree\TransactionSearch::customerId()->is($customer->id), - Braintree\TransactionSearch::europeBankAccountIban()->is("DE89370400440532013000") - ]); - - $this->assertEquals(1, $collection->maximumCount()); - $this->assertEquals($transactionResult->transaction->id, $collection->firstItem()->id); - } } diff --git a/tests/integration/TransactionTest.php b/tests/integration/TransactionTest.php index 82a777b1..8f4bd0e2 100644 --- a/tests/integration/TransactionTest.php +++ b/tests/integration/TransactionTest.php @@ -107,53 +107,6 @@ public function testGatewayCreateTransactionUsingNonce() $this->assertEquals('47.00', $transaction->amount); } - public function testCreateTransactionUsingEuropeBankAccountNonce() - { - $gateway = new Braintree\Gateway([ - 'environment' => 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - - $result = $gateway->transaction()->sale([ - 'amount' => '47.00', - 'merchantAccountId' => 'fake_sepa_ma', - 'paymentMethodNonce' => $nonce - ]); - - $this->assertTrue($result->success); - $transaction = $result->transaction; - $this->assertEquals(Braintree\Transaction::AUTHORIZED, $transaction->status); - $this->assertEquals(Braintree\Transaction::SALE, $transaction->type); - $this->assertEquals('47.00', $transaction->amount); - $this->assertEquals('DEUTDEFF', $transaction->europeBankAccount->bic); - } - public function testSaleWithUsBankAccountNonce() { $result = Braintree\Transaction::sale([ @@ -1679,151 +1632,6 @@ public function testSale_withLineItemsValidationErrorTooManyLineItems() ); } - public function testSettleAltPayTransaction() - { - $gateway = new Braintree\Gateway([ - 'environment' => 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - - $result = $gateway->transaction()->sale([ - 'amount' => '47.00', - 'merchantAccountId' => 'fake_sepa_ma', - 'paymentMethodNonce' => $nonce, - 'options' => [ - 'submitForSettlement' => true - ] - ]); - - $transaction = $result->transaction; - $gateway->testing()->settle($transaction->id); - $transaction = $gateway->transaction()->find($transaction->id); - $this->assertSame(Braintree\Transaction::SETTLED, $transaction->status); - } - - public function testSettlementConfirmAltPayTransaction() - { - $gateway = new Braintree\Gateway([ - 'environment' => 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - - $result = $gateway->transaction()->sale([ - 'amount' => '47.00', - 'merchantAccountId' => 'fake_sepa_ma', - 'paymentMethodNonce' => $nonce, - 'options' => [ - 'submitForSettlement' => true - ] - ]); - - $transaction = $result->transaction; - $gateway->testing()->settlementConfirm($transaction->id); - $transaction = $gateway->transaction()->find($transaction->id); - $this->assertSame(Braintree\Transaction::SETTLEMENT_CONFIRMED, $transaction->status); - } - - public function testSettlementDeclineAltPayTransaction() - { - $gateway = new Braintree\Gateway([ - 'environment' => 'development', - 'merchantId' => 'altpay_merchant', - 'publicKey' => 'altpay_merchant_public_key', - 'privateKey' => 'altpay_merchant_private_key' - ]); - - $result = $gateway->customer()->create(); - $this->assertTrue($result->success); - $customer = $result->customer; - $clientApi = new HttpClientApi($gateway->config); - $nonce = $clientApi->nonceForNewEuropeanBankAccount([ - "customerId" => $customer->id, - "sepa_mandate" => [ - "locale" => "de-DE", - "bic" => "DEUTDEFF", - "iban" => "DE89370400440532013000", - "accountHolderName" => "Bob Holder", - "billingAddress" => [ - "streetAddress" => "123 Currywurst Way", - "extendedAddress" => "Lager Suite", - "firstName" => "Wilhelm", - "lastName" => "Dix", - "locality" => "Frankfurt", - "postalCode" => "60001", - "countryCodeAlpha2" => "DE", - "region" => "Hesse" - ] - ] - ]); - - $result = $gateway->transaction()->sale([ - 'amount' => '47.00', - 'merchantAccountId' => 'fake_sepa_ma', - 'paymentMethodNonce' => $nonce, - 'options' => [ - 'submitForSettlement' => true - ] - ]); - - $transaction = $result->transaction; - $gateway->testing()->settlementConfirm($transaction->id); - $gateway->testing()->settlementDecline($transaction->id); - $transaction = $gateway->transaction()->find($transaction->id); - $this->assertSame(Braintree\Transaction::SETTLEMENT_DECLINED, $transaction->status); - } - public function testCreateTransactionUsingFakeApplePayNonce() { $result = Braintree\Transaction::sale([