createNoValidate() public static method

public static createNoValidate ( array $attribs = [] ) : Customer
$attribs array
return Customer
 public function testCreate_fromPaymentMethodToken()
 {
     $customer = Braintree\Customer::createNoValidate();
     $card = Braintree\CreditCard::create(['customerId' => $customer->id, 'cardholderName' => 'Cardholder', 'number' => '5105105105105100', 'expirationDate' => '05/12'])->creditCard;
     $result = Braintree\PaymentMethodNonce::create($card->token);
     $this->assertTrue($result->success);
     $this->assertNotNull($result->paymentMethodNonce);
     $this->assertNotNull($result->paymentMethodNonce->nonce);
 }
 public function test_createdAt()
 {
     $customer = Braintree\Customer::createNoValidate();
     $past = clone $customer->createdAt;
     $past->modify("-1 hour");
     $future = clone $customer->createdAt;
     $future->modify("+1 hour");
     $collection = Braintree\Customer::search(array(Braintree\CustomerSearch::id()->is($customer->id), Braintree\CustomerSearch::createdAt()->between($past, $future)));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($customer->id, $collection->firstItem()->id);
     $collection = Braintree\Customer::search(array(Braintree\CustomerSearch::id()->is($customer->id), Braintree\CustomerSearch::createdAt()->lessThanOrEqualTo($future)));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($customer->id, $collection->firstItem()->id);
     $collection = Braintree\Customer::search(array(Braintree\CustomerSearch::id()->is($customer->id), Braintree\CustomerSearch::createdAt()->greaterThanOrEqualTo($past)));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($customer->id, $collection->firstItem()->id);
 }
 public function testSale_createsASaleUsingGivenToken()
 {
     $customer = Braintree\Customer::createNoValidate();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = Test\Helper::generateValidUsBankAccountNonce();
     $result = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $result = Braintree\UsBankAccount::sale($result->paymentMethod->token, ['merchantAccountId' => 'us_bank_merchant_account', 'amount' => '100.00']);
     $this->assertTrue($result->success);
     $transaction = $result->transaction;
     $this->assertEquals(Braintree\Transaction::SETTLEMENT_PENDING, $transaction->status);
     $this->assertEquals(Braintree\Transaction::SALE, $transaction->type);
     $this->assertEquals('100.00', $transaction->amount);
     $this->assertEquals('021000021', $transaction->usBankAccount->routingNumber);
     $this->assertEquals('1234', $transaction->usBankAccount->last4);
     $this->assertEquals('checking', $transaction->usBankAccount->accountType);
     $this->assertEquals('PayPal Checking - 1234', $transaction->usBankAccount->accountDescription);
     $this->assertEquals('Dan Schulman', $transaction->usBankAccount->accountHolderName);
     $this->assertRegExp('/CHASE/', $transaction->usBankAccount->bankName);
 }
 public function testSale_createsASaleUsingGivenToken()
 {
     $nonce = Braintree\Test\Nonces::$paypalFuturePayment;
     $customer = Braintree\Customer::createNoValidate(['paymentMethodNonce' => $nonce]);
     $paypalAccount = $customer->paypalAccounts[0];
     $result = Braintree\PayPalAccount::sale($paypalAccount->token, ['amount' => '100.00']);
     $this->assertTrue($result->success);
     $this->assertEquals('100.00', $result->transaction->amount);
     $this->assertEquals($customer->id, $result->transaction->customerDetails->id);
     $this->assertEquals($paypalAccount->token, $result->transaction->paypalDetails->token);
 }
 public static function createCreditCard()
 {
     $customer = Braintree\Customer::createNoValidate(['creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/2010']]);
     return $customer->creditCards[0];
 }
 public function testUnknownCardTypeIndicators()
 {
     $customer = Braintree\Customer::createNoValidate();
     $result = Braintree\CreditCard::create(array('customerId' => $customer->id, 'cardholderName' => 'Cardholder', 'number' => CardTypeIndicators::UNKNOWN, 'expirationDate' => '05/12', 'options' => array('verifyCard' => true)));
     $this->assertEquals(Braintree\CreditCard::PREPAID_UNKNOWN, $result->creditCard->prepaid);
     $this->assertEquals(Braintree\CreditCard::DURBIN_REGULATED_UNKNOWN, $result->creditCard->durbinRegulated);
     $this->assertEquals(Braintree\CreditCard::PAYROLL_UNKNOWN, $result->creditCard->payroll);
     $this->assertEquals(Braintree\CreditCard::DEBIT_UNKNOWN, $result->creditCard->debit);
     $this->assertEquals(Braintree\CreditCard::HEALTHCARE_UNKNOWN, $result->creditCard->healthcare);
     $this->assertEquals(Braintree\CreditCard::COMMERCIAL_UNKNOWN, $result->creditCard->commercial);
     $this->assertEquals(Braintree\CreditCard::COUNTRY_OF_ISSUANCE_UNKNOWN, $result->creditCard->countryOfIssuance);
     $this->assertEquals(Braintree\CreditCard::ISSUING_BANK_UNKNOWN, $result->creditCard->issuingBank);
 }
 public function testDelete_worksWithPayPalAccounts()
 {
     $paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
     $customer = Braintree\Customer::createNoValidate();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken]]);
     $paypalAccountResult = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $this->assertTrue($paypalAccountResult->success);
     Braintree\PaymentMethod::delete($paymentMethodToken);
     $this->setExpectedException('Braintree\\Exception\\NotFound');
     Braintree\PaymentMethod::find($paymentMethodToken);
 }
 public function testCreate_fromPayPalACcount()
 {
     $paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
     $customer = Braintree\Customer::createNoValidate();
     $plan = SubscriptionHelper::triallessPlan();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken]]);
     $paypalResult = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $subscriptionResult = Braintree\Subscription::create(['paymentMethodToken' => $paymentMethodToken, 'planId' => $plan['id']]);
     $this->assertTrue($subscriptionResult->success);
     $transaction = $subscriptionResult->subscription->transactions[0];
     $this->assertEquals('*****@*****.**', $transaction->paypalDetails->payerEmail);
 }
示例#9
0
 public function testUpdateNoValidate()
 {
     $customer = Braintree\Customer::createNoValidate();
     $createdAddress = Braintree\Address::createNoValidate(['customerId' => $customer->id, 'firstName' => 'Old First', 'lastName' => 'Old Last', 'company' => 'Old Company', 'streetAddress' => '1 E Old St', 'extendedAddress' => 'Apt Old', 'locality' => 'Old Chicago', 'region' => 'Old Region', 'postalCode' => 'Old Postal', 'countryName' => 'United States of America']);
     $address = Braintree\Address::updateNoValidate($customer->id, $createdAddress->id, ['firstName' => 'New First', 'lastName' => 'New Last', 'company' => 'New Company', 'streetAddress' => '1 E New St', 'extendedAddress' => 'Apt New', 'locality' => 'New Chicago', 'region' => 'New Region', 'postalCode' => 'New Postal', 'countryName' => 'Mexico']);
     $this->assertEquals('New First', $address->firstName);
     $this->assertEquals('New Last', $address->lastName);
     $this->assertEquals('New Company', $address->company);
     $this->assertEquals('1 E New St', $address->streetAddress);
     $this->assertEquals('Apt New', $address->extendedAddress);
     $this->assertEquals('New Chicago', $address->locality);
     $this->assertEquals('New Region', $address->region);
     $this->assertEquals('New Postal', $address->postalCode);
     $this->assertEquals('Mexico', $address->countryName);
 }
 public function test_rangeNode_amount()
 {
     $customer = Braintree\Customer::createNoValidate();
     $creditCard = Braintree\CreditCard::create(['customerId' => $customer->id, 'cardholderName' => 'Jane Everywoman' . rand(), 'number' => '5105105105105100', 'expirationDate' => '05/12'])->creditCard;
     $t_1000 = Braintree\Transaction::saleNoValidate(['amount' => '1000.00', 'paymentMethodToken' => $creditCard->token]);
     $t_1500 = Braintree\Transaction::saleNoValidate(['amount' => '1500.00', 'paymentMethodToken' => $creditCard->token]);
     $t_1800 = Braintree\Transaction::saleNoValidate(['amount' => '1800.00', 'paymentMethodToken' => $creditCard->token]);
     $collection = Braintree\Transaction::search([Braintree\TransactionSearch::creditCardCardholderName()->is($creditCard->cardholderName), Braintree\TransactionSearch::amount()->greaterThanOrEqualTo('1700')]);
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($t_1800->id, $collection->firstItem()->id);
     $collection = Braintree\Transaction::search([Braintree\TransactionSearch::creditCardCardholderName()->is($creditCard->cardholderName), Braintree\TransactionSearch::amount()->lessThanOrEqualTo('1250')]);
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($t_1000->id, $collection->firstItem()->id);
     $collection = Braintree\Transaction::search([Braintree\TransactionSearch::creditCardCardholderName()->is($creditCard->cardholderName), Braintree\TransactionSearch::amount()->between('1100', '1600')]);
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($t_1500->id, $collection->firstItem()->id);
 }
示例#11
0
 public function testCreditNoValidate_throwsIfInvalid()
 {
     $customer = Braintree\Customer::createNoValidate(['creditCard' => ['number' => '5105105105105100', 'expirationDate' => '05/12']]);
     $creditCard = $customer->creditCards[0];
     $this->setExpectedException('Braintree\\Exception\\ValidationsFailed');
     Braintree\Customer::creditNoValidate($customer->id, ['amount' => 'invalid']);
 }
示例#12
0
 public function testCreate_withVaultedPayPal()
 {
     $paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
     $customer = Braintree\Customer::createNoValidate();
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken]]);
     Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $nonce]);
     $result = Braintree\Transaction::sale(['amount' => Braintree\Test\TransactionAmounts::$authorize, 'paymentMethodToken' => $paymentMethodToken]);
     $this->assertTrue($result->success);
     $transaction = $result->transaction;
     $this->assertEquals('*****@*****.**', $transaction->paypalDetails->payerEmail);
     $this->assertNotNull($transaction->paypalDetails->imageUrl);
     $this->assertNotNull($transaction->paypalDetails->debugId);
 }