clientToken() 공개 메소드

public clientToken ( ) : braintree\ClientTokenGateway
리턴 braintree\ClientTokenGateway
예제 #1
0
 public function testGateway_VersionDefaultsToTwo()
 {
     $gateway = new Braintree\Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key'));
     $encodedClientToken = $gateway->clientToken()->generate();
     $clientToken = base64_decode($encodedClientToken);
     $version = json_decode($clientToken)->version;
     $this->assertEquals(2, $version);
 }
예제 #2
0
 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(var_dump($response));
     }
 }