decodedClientToken() 공개 정적인 메소드

public static decodedClientToken ( $params = [] )
예제 #1
0
 public function nonceForPayPalAccount($options)
 {
     $clientToken = json_decode(Test\Helper::decodedClientToken());
     $options["authorization_fingerprint"] = $clientToken->authorizationFingerprint;
     $response = $this->post('/client_api/v1/payment_methods/paypal_accounts.json', json_encode($options));
     if ($response["status"] == 201 || $response["status"] == 202) {
         $body = json_decode($response["body"], true);
         return $body["paypalAccounts"][0]["nonce"];
     } else {
         throw new Exception(var_dump($response));
     }
 }
예제 #2
0
 public function test_ClientTokenAcceptsMerchantAccountId()
 {
     $clientToken = Test\Helper::decodedClientToken(array('merchantAccountId' => 'my_merchant_account'));
     $merchantAccountId = json_decode($clientToken)->merchantAccountId;
     $this->assertEquals('my_merchant_account', $merchantAccountId);
 }
예제 #3
0
 public static function generateValidUsBankAccountNonce()
 {
     $client_token = json_decode(Helper::decodedClientToken(), true);
     $url = $client_token['braintree_api']['url'] . '/tokens';
     $token = $client_token['braintree_api']['access_token'];
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($curl, CURLOPT_URL, $url);
     $headers[] = 'Content-Type: application/json';
     $headers[] = 'Braintree-Version: 2015-11-01';
     $headers[] = 'Authorization: Bearer ' . $token;
     curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
     $requestBody = ['type' => 'us_bank_account', 'billing_address' => ['street_address' => '123 Ave', 'region' => 'CA', 'locality' => 'San Francisco', 'postal_code' => '94112'], 'account_type' => 'checking', 'routing_number' => '123456789', 'account_number' => '567891234', 'account_holder_name' => 'Dan Schulman', 'account_description' => 'PayPal Checking - 1234', 'ach_mandate' => ['text' => '']];
     curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($requestBody));
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     $response = curl_exec($curl);
     $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     $error_code = curl_errno($curl);
     curl_close($curl);
     $jsonResponse = json_decode($response, true);
     return $jsonResponse['data']['id'];
 }