Skip to content

Commit

Permalink
Merge pull request #175 from braintree/btoptmz-164-remove-sepa-relate…
Browse files Browse the repository at this point in the history
…d-tests

BTOPTMZ-164 remove sepa related tests
  • Loading branch information
cchellberg authored and GitHub Enterprise committed Feb 28, 2018
2 parents 39aa225 + bb55a22 commit cca35a5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 321 deletions.
54 changes: 0 additions & 54 deletions tests/integration/EuropeBankAccountTest.php

This file was deleted.

25 changes: 0 additions & 25 deletions tests/integration/HttpClientApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
50 changes: 0 additions & 50 deletions tests/integration/TransactionAdvancedSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
192 changes: 0 additions & 192 deletions tests/integration/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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([
Expand Down

0 comments on commit cca35a5

Please sign in to comment.