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 testGatewayCreate_fromVaultedCreditCardNonce() { $customer = Braintree_Customer::createNoValidate(); $http = new Braintree_HttpClientApi(Braintree_Configuration::$global); $nonce = $http->nonce_for_new_card(array('credit_card' => array('number' => '4111111111111111', 'expirationMonth' => '11', 'expirationYear' => '2099'), 'share' => true)); $gateway = new Braintree_Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key')); $result = $gateway->paymentMethod()->create(array('customerId' => $customer->id, 'paymentMethodNonce' => $nonce)); $this->assertSame('411111', $result->paymentMethod->bin); $this->assertSame('1111', $result->paymentMethod->last4); $this->assertNotNull($result->paymentMethod->token); $this->assertNotNull($result->paymentMethod->imageUrl); }