function testCanExchangeNonceForEuropeBankAccount()
 {
     $gateway = new Braintree_Gateway(array('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 Braintree_HttpClientApi($gateway->config);
     $nonce = $clientApi->nonceForNewEuropeanBankAccount(array("customerId" => $customer->id, "sepa_mandate" => array("locale" => "de-DE", "bic" => "DEUTDEFF", "iban" => "DE89370400440532013000", "accountHolderName" => "Bob Holder", "billingAddress" => array("streetAddress" => "123 Currywurst Way", "extendedAddress" => "Lager Suite", "firstName" => "Wilhelm", "lastName" => "Dix", "locality" => "Frankfurt", "postalCode" => "60001", "countryCodeAlpha2" => "DE", "region" => "Hesse"))));
     $result = $gateway->paymentMethod()->create(array("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");
 }
 function testHandlesEuropeBankAccounts()
 {
     $gateway = new Braintree_Gateway(array('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 Braintree_HttpClientApi($gateway->config);
     $nonce = $clientApi->nonceForNewEuropeanBankAccount(array("customerId" => $customer->id, "sepa_mandate" => array("locale" => "de-DE", "bic" => "DEUTDEFF", "iban" => "DE89370400440532013000", "accountHolderName" => "Bob Holder", "billingAddress" => array("streetAddress" => "123 Currywurst Way", "extendedAddress" => "Lager Suite", "firstName" => "Wilhelm", "lastName" => "Dix", "locality" => "Frankfurt", "postalCode" => "60001", "countryCodeAlpha2" => "DE", "region" => "Hesse"))));
     $transactionResult = $gateway->transaction()->sale(array("customerId" => $customer->id, "paymentMethodNonce" => $nonce, "merchantAccountId" => "fake_sepa_ma", "amount" => 100));
     $this->assertTrue($transactionResult->success);
     $collection = $gateway->transaction()->search(array(Braintree_TransactionSearch::customerId()->is($customer->id), Braintree_TransactionSearch::europeBankAccountIban()->is("DE89370400440532013000")));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($transactionResult->transaction->id, $collection->firstItem()->id);
 }
Beispiel #3
0
 function testSettlementDeclineAltPayTransaction()
 {
     $gateway = new Braintree_Gateway(array('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 Braintree_HttpClientApi($gateway->config);
     $nonce = $clientApi->nonceForNewEuropeanBankAccount(array("customerId" => $customer->id, "sepa_mandate" => array("locale" => "de-DE", "bic" => "DEUTDEFF", "iban" => "DE89370400440532013000", "accountHolderName" => "Bob Holder", "billingAddress" => array("streetAddress" => "123 Currywurst Way", "extendedAddress" => "Lager Suite", "firstName" => "Wilhelm", "lastName" => "Dix", "locality" => "Frankfurt", "postalCode" => "60001", "countryCodeAlpha2" => "DE", "region" => "Hesse"))));
     $result = $gateway->transaction()->sale(array('amount' => '47.00', 'merchantAccountId' => 'fake_sepa_ma', 'paymentMethodNonce' => $nonce, 'options' => array('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);
 }