コード例 #1
0
 function testFind()
 {
     $params = array_merge(array(), self::$validParams);
     $result = Braintree_MerchantAccount::create(self::$validParams);
     $this->assertEquals(true, $result->success);
     $this->assertEquals(Braintree_MerchantAccount::STATUS_PENDING, $result->merchantAccount->status);
     $id = $result->merchantAccount->id;
     $merchantAccount = Braintree_MerchantAccount::find($id);
     $this->assertEquals(Braintree_MerchantAccount::STATUS_ACTIVE, $merchantAccount->status);
     $this->assertEquals($params['individual']['firstName'], $merchantAccount->individualDetails->firstName);
     $this->assertEquals($params['individual']['lastName'], $merchantAccount->individualDetails->lastName);
 }
コード例 #2
0
 public function providerB_bankingSubmit()
 {
     $this->_braintreeConfigure();
     $result = new stdClass();
     $result = Braintree_MerchantAccount::create(array('individual' => array('firstName' => Input::get('first_name'), 'lastName' => Input::get('last_name'), 'email' => Input::get('email'), 'phone' => Input::get('phone'), 'dateOfBirth' => date('Y-m-d', strtotime(Input::get('dob'))), 'ssn' => Input::get('ssn'), 'address' => array('streetAddress' => Input::get('streetAddress'), 'locality' => Input::get('locality'), 'region' => Input::get('region'), 'postalCode' => Input::get('postalCode'))), 'funding' => array('descriptor' => 'UberForX', 'destination' => Braintree_MerchantAccount::FUNDING_DESTINATION_BANK, 'email' => Input::get('bankemail'), 'mobilePhone' => Input::get('bankphone'), 'accountNumber' => Input::get('accountNumber'), 'routingNumber' => Input::get('routingNumber')), 'tosAccepted' => true, 'masterMerchantAccountId' => Config::get('app.masterMerchantAccountId'), 'id' => "taxinow" . Input::get('id')));
     Log::info('res = ' . print_r($result, true));
     if ($result->success) {
         $pro = Walker::where('id', Input::get('id'))->first();
         $pro->merchant_id = $result->merchantAccount->id;
         $pro->save();
         Log::info(print_r($pro, true));
         Log::info('Adding banking details to provider from Admin = ' . print_r($result, true));
         return Redirect::to("/");
     } else {
         Log::info('Error in adding banking details: ' . $result->message);
         return Redirect::to("banking_provider_mobile");
     }
 }
コード例 #3
0
 } else {
     if ($_POST['_act'] == 'findPaymentMethod') {
         $paymentMethod = Braintree_PaymentMethod::find($_POST['token']);
         print_r($paymentMethod);
     } else {
         if ($_POST['_act'] == 'deletePaymentMethod') {
             $search = (string) $_POST['token'];
             $file = './data/token.txt';
             $contents = file_get_contents($file);
             echo $contents = str_replace($_POST['token'], trim((string) $_POST['token'] . "_DELETED\r\n"), $contents);
             file_put_contents($file, $contents);
             $paymentMethod = Braintree_PaymentMethod::delete($_POST['token']);
             print_r($paymentMethod);
         } else {
             if ($_POST['_act'] == 'createSubMerchant') {
                 $result = Braintree_MerchantAccount::create(array('individual' => array('firstName' => $_POST['firstName'], 'lastName' => $_POST['lastName'], 'email' => $_POST['email'], 'phone' => $_POST['phone'], 'dateOfBirth' => $_POST['dateOfBirth'], 'ssn' => $_POST['ssn'], 'address' => array('streetAddress' => $_POST['streetAddress'], 'locality' => $_POST['locality'], 'region' => $_POST['region'], 'postalCode' => $_POST['postalCode'])), 'business' => array('legalName' => $_POST['legalName'], 'dbaName' => $_POST['dbaName'], 'taxId' => $_POST['taxId'], 'address' => array('streetAddress' => $_POST['streetAddress2'], 'locality' => $_POST['locality2'], 'region' => $_POST['region2'], 'postalCode' => $_POST['postalCode2'])), 'funding' => array('descriptor' => $_POST['descriptor'], 'destination' => Braintree_MerchantAccount::FUNDING_DESTINATION_BANK, 'email' => $_POST['email'], 'mobilePhone' => $_POST['mobilePhone'], 'accountNumber' => $_POST['accountNumber'], 'routingNumber' => $_POST['routingNumber']), 'tosAccepted' => true, 'masterMerchantAccountId' => "qzmnkckz54r94r4f", 'id' => "mc_" . time()));
                 $file = './data/subMerchant.txt';
                 //[ADD Customer ID to text file]
                 $subMerchantID = $result->merchantAccount->id . "\r\n";
                 // Write the contents to the file,
                 // using the FILE_APPEND flag to append the content to the end of the file
                 // and the LOCK_EX flag to prevent anyone else writing to the file at the same time
                 file_put_contents($file, $subMerchantID, FILE_APPEND | LOCK_EX);
                 print_r($result);
             } else {
                 if ($_POST['_act'] == 'CreateTransEscrow') {
                     $result = Braintree_Transaction::sale(array('merchantAccountId' => $_POST["sub_merchant_id"], 'amount' => $_POST["amount"], 'paymentMethodNonce' => $_POST["payment_method_nonce"], 'serviceFeeAmount' => $_POST["serviceFeeAmount"], 'options' => array('holdInEscrow' => true)));
                     print_r($result);
                     $file = './data/trans_id.txt';
                     //[ADD Customer ID to text file]
                     $transID = $result->transaction->id . "\r\n";
コード例 #4
0
ファイル: YiiBraintree.php プロジェクト: tejrajs/yiibraintree
 public function createSubMerchant($data)
 {
     $result = Braintree_MerchantAccount::create($data);
     if ($result->success) {
         return array('success' => 1, 'sub_merchant_id' => $result->merchantAccount->id, 'status' => $result->merchantAccount->status, 'currency_code' => $result->merchantAccount->currencyIsoCode);
         /*
           eg:Array
         			    (
         				[success] => 1
         				[sub_merchant_id] => jane_doe_instant5
         				[status] => pending
         				[currency_code] => USD
         			    )
         			    /*  firstname=>approve_me
         			    Array
         			      (
         				  [success] => 1
         				  [sub_merchant_id] => approve_me_doe_instant
         				  [status] => pending
         				  [currency_code] => USD
         			      )
         */
     } else {
         return array('success' => 0, 'errors' => $result->errors->deepAll());
         /* eg:
                           Array
         		      (
         			  [success] => 0
         			  [errors] => Array
         			      (
         				  [0] => Braintree_Error_Validation Object
         				      (
         					  [_attribute:Braintree_Error_Validation:private] => mobilePhone
         					  [_code:Braintree_Error_Validation:private] => 82683
         					  [_message:Braintree_Error_Validation:private] => Funding mobile phone is invalid.
         				      )
         
         			      )
         
         		      )
         
                         */
     }
 }