public function testGatewayCreate() { $gateway = new Braintree\Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key')); $result = $gateway->merchantAccount()->create(self::$validParams); $this->assertEquals(true, $result->success); $merchantAccount = $result->merchantAccount; $this->assertEquals(Braintree\MerchantAccount::STATUS_PENDING, $merchantAccount->status); $this->assertEquals("sandbox_master_merchant_account", $merchantAccount->masterMerchantAccount->id); }
public function testCreateForCurrencyWithDuplicateId() { $gateway = new Braintree\Gateway(['clientId' => 'client_id$development$signup_client_id', 'clientSecret' => 'client_secret$development$signup_client_secret']); $result = $gateway->merchant()->create(['email' => '*****@*****.**', 'countryCodeAlpha3' => 'GBR', 'paymentMethods' => ['credit_card', 'paypal']]); $this->assertEquals(true, $result->success); $gateway = new Braintree\Gateway(['accessToken' => $result->credentials->accessToken]); $merchantAccount = $result->merchant->merchantAccounts[0]; $result = $gateway->merchantAccount()->createForCurrency(['currency' => "USD", 'id' => $merchantAccount->id]); $this->assertEquals(false, $result->success); $errors = $result->errors->forKey('merchant')->onAttribute('id'); $this->assertEquals(Braintree\Error\Codes::MERCHANT_MERCHANT_ACCOUNT_EXISTS_FOR_ID, $errors[0]->code); }