Inheritance: extends braintree\Base
 public function testCreateMerchantAccountWithAllParams()
 {
     $params = array("id" => "sub_merchant_account", "status" => "active", "masterMerchantAccount" => array("id" => "master_merchant_account", "status" => "active"), "individual" => array("firstName" => "John", "lastName" => "Doe", "email" => "*****@*****.**", "dateOfBirth" => "1970-01-01", "phone" => "3125551234", "ssnLast4" => "6789", "address" => array("streetAddress" => "123 Fake St", "locality" => "Chicago", "region" => "IL", "postalCode" => "60622")), "business" => array("dbaName" => "James's Bloggs", "taxId" => "123456789"), "funding" => array("accountNumberLast4" => "8798", "routingNumber" => "071000013", "descriptor" => "Joes Bloggs MI"));
     $merchantAccount = Braintree\MerchantAccount::factory($params);
     $this->assertEquals($merchantAccount->status, "active");
     $this->assertEquals($merchantAccount->id, "sub_merchant_account");
     $this->assertEquals($merchantAccount->masterMerchantAccount->id, "master_merchant_account");
     $this->assertEquals($merchantAccount->masterMerchantAccount->status, "active");
     $this->assertEquals($merchantAccount->individualDetails->firstName, "John");
     $this->assertEquals($merchantAccount->individualDetails->lastName, "Doe");
     $this->assertEquals($merchantAccount->individualDetails->email, "*****@*****.**");
     $this->assertEquals($merchantAccount->individualDetails->dateOfBirth, "1970-01-01");
     $this->assertEquals($merchantAccount->individualDetails->phone, "3125551234");
     $this->assertEquals($merchantAccount->individualDetails->ssnLast4, "6789");
     $this->assertEquals($merchantAccount->individualDetails->addressDetails->streetAddress, "123 Fake St");
     $this->assertEquals($merchantAccount->individualDetails->addressDetails->locality, "Chicago");
     $this->assertEquals($merchantAccount->individualDetails->addressDetails->region, "IL");
     $this->assertEquals($merchantAccount->individualDetails->addressDetails->postalCode, "60622");
     $this->assertEquals($merchantAccount->businessDetails->dbaName, "James's Bloggs");
     $this->assertEquals($merchantAccount->businessDetails->taxId, "123456789");
     $this->assertEquals($merchantAccount->fundingDetails->accountNumberLast4, "8798");
     $this->assertEquals($merchantAccount->fundingDetails->routingNumber, "071000013");
     $this->assertEquals($merchantAccount->fundingDetails->descriptor, "Joes Bloggs MI");
 }
Exemplo n.º 2
0
 /**
  * overrides default constructor
  * @ignore
  * @param array $response gateway response array
  */
 public function __construct($response)
 {
     $this->_attributes = $response;
     $this->_set('errors', new ErrorCollection($response['errors']));
     if (isset($response['verification'])) {
         $this->_set('creditCardVerification', new CreditCardVerification($response['verification']));
     } else {
         $this->_set('creditCardVerification', null);
     }
     if (isset($response['transaction'])) {
         $this->_set('transaction', Transaction::factory($response['transaction']));
     } else {
         $this->_set('transaction', null);
     }
     if (isset($response['subscription'])) {
         $this->_set('subscription', Subscription::factory($response['subscription']));
     } else {
         $this->_set('subscription', null);
     }
     if (isset($response['merchantAccount'])) {
         $this->_set('merchantAccount', MerchantAccount::factory($response['merchantAccount']));
     } else {
         $this->_set('merchantAccount', null);
     }
 }
 public function testUpdateWithInvalidFundingFields()
 {
     $params = array("funding" => array("destination" => Braintree\MerchantAccount::FUNDING_DESTINATION_EMAIL, "email" => ""));
     $result = Braintree\MerchantAccount::update("sandbox_sub_merchant_account", $params);
     $this->assertEquals(false, $result->success);
     $error = $result->errors->forKey("merchantAccount")->forKey("funding")->onAttribute("email");
     $this->assertEquals($error[0]->code, Braintree\Error\Codes::MERCHANT_ACCOUNT_FUNDING_EMAIL_IS_REQUIRED);
     $params = array("funding" => array("destination" => Braintree\MerchantAccount::FUNDING_DESTINATION_MOBILE_PHONE, "mobilePhone" => ""));
     $result = Braintree\MerchantAccount::update("sandbox_sub_merchant_account", $params);
     $this->assertEquals(false, $result->success);
     $error = $result->errors->forKey("merchantAccount")->forKey("funding")->onAttribute("mobilePhone");
     $this->assertEquals($error[0]->code, Braintree\Error\Codes::MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_REQUIRED);
 }
Exemplo n.º 4
0
 /**
  * @param string $merchantId
  * @return MerchantAccount
  */
 public function findMerchant($merchantId)
 {
     return MerchantAccount::find($merchantId);
 }