本文整理汇总了PHP中Braintree_Customer::createNoValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Customer::createNoValidate方法的具体用法?PHP Braintree_Customer::createNoValidate怎么用?PHP Braintree_Customer::createNoValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_Customer
的用法示例。
在下文中一共展示了Braintree_Customer::createNoValidate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate_fromPaymentMethodToken
function testCreate_fromPaymentMethodToken()
{
$customer = Braintree_Customer::createNoValidate();
$card = Braintree_CreditCard::create(array('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);
}
示例2: test_createdAt
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);
}
示例3: testUnknownCardTypeIndicators
function testUnknownCardTypeIndicators()
{
$customer = Braintree_Customer::createNoValidate();
$result = Braintree_CreditCard::create(array('customerId' => $customer->id, 'cardholderName' => 'Cardholder', 'number' => Braintree_CreditCardNumbers_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);
}
示例4: test_rangeNode_amount
function test_rangeNode_amount()
{
$customer = Braintree_Customer::createNoValidate();
$creditCard = Braintree_CreditCard::create(array('customerId' => $customer->id, 'cardholderName' => 'Jane Everywoman' . rand(), 'number' => '5105105105105100', 'expirationDate' => '05/12'))->creditCard;
$t_1000 = Braintree_Transaction::saleNoValidate(array('amount' => '1000.00', 'paymentMethodToken' => $creditCard->token));
$t_1500 = Braintree_Transaction::saleNoValidate(array('amount' => '1500.00', 'paymentMethodToken' => $creditCard->token));
$t_1800 = Braintree_Transaction::saleNoValidate(array('amount' => '1800.00', 'paymentMethodToken' => $creditCard->token));
$collection = Braintree_Transaction::search(array(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(array(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(array(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);
}
示例5: testCreditNoValidate_throwsIfInvalid
function testCreditNoValidate_throwsIfInvalid()
{
$customer = Braintree_Customer::createNoValidate(array('creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12')));
$creditCard = $customer->creditCards[0];
$this->setExpectedException('Braintree_Exception_ValidationsFailed');
Braintree_Customer::creditNoValidate($customer->id, array('amount' => 'invalid'));
}
示例6: testUpdateNoValidate
function testUpdateNoValidate()
{
$customer = Braintree_Customer::createNoValidate();
$createdAddress = Braintree_Address::createNoValidate(array('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, array('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);
}
示例7: testDelete_worksWithPayPalAccounts
function testDelete_worksWithPayPalAccounts()
{
$paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
$customer = Braintree_Customer::createNoValidate();
$nonce = Braintree_HttpClientApi::nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken)));
$paypalAccountResult = Braintree_PaymentMethod::create(array('customerId' => $customer->id, 'paymentMethodNonce' => $nonce));
$this->assertTrue($paypalAccountResult->success);
Braintree_PaymentMethod::delete($paymentMethodToken);
$this->setExpectedException('Braintree_Exception_NotFound');
Braintree_PaymentMethod::find($paymentMethodToken);
}
示例8: testCreate_fromPayPalACcount
function testCreate_fromPayPalACcount()
{
$paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
$customer = Braintree_Customer::createNoValidate();
$plan = Braintree_SubscriptionTestHelper::triallessPlan();
$nonce = Braintree_HttpClientApi::nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken)));
$paypalResult = Braintree_PaymentMethod::create(array('customerId' => $customer->id, 'paymentMethodNonce' => $nonce));
$subscriptionResult = Braintree_Subscription::create(array('paymentMethodToken' => $paymentMethodToken, 'planId' => $plan['id']));
$this->assertTrue($subscriptionResult->success);
$transaction = $subscriptionResult->subscription->transactions[0];
$this->assertEquals('payer@example.com', $transaction->paypalDetails->payerEmail);
}
示例9: testCreate_withVaultedPayPal
function testCreate_withVaultedPayPal()
{
$paymentMethodToken = 'PAYPAL_TOKEN-' . strval(rand());
$customer = Braintree_Customer::createNoValidate();
$nonce = Braintree_HttpClientApi::nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken)));
Braintree_PaymentMethod::create(array('customerId' => $customer->id, 'paymentMethodNonce' => $nonce));
$result = Braintree_Transaction::sale(array('amount' => Braintree_Test_TransactionAmounts::$authorize, 'paymentMethodToken' => $paymentMethodToken));
$this->assertTrue($result->success);
$transaction = $result->transaction;
$this->assertEquals('payer@example.com', $transaction->paypalDetails->payerEmail);
$this->assertNotNull($transaction->paypalDetails->imageUrl);
$this->assertNotNull($transaction->paypalDetails->debugId);
}
示例10: createCreditCard
static function createCreditCard()
{
$customer = Braintree_Customer::createNoValidate(array('creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/2010')));
return $customer->creditCards[0];
}
示例11: testGatewayRejectionIsNullOnProcessorDecline
function testGatewayRejectionIsNullOnProcessorDecline()
{
$old_merchant_id = Braintree_Configuration::merchantId();
$old_public_key = Braintree_Configuration::publicKey();
$old_private_key = Braintree_Configuration::privateKey();
Braintree_Configuration::merchantId('processing_rules_merchant_id');
Braintree_Configuration::publicKey('processing_rules_public_key');
Braintree_Configuration::privateKey('processing_rules_private_key');
$customer = Braintree_Customer::createNoValidate();
$result = Braintree_CreditCard::create(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/2011', 'cvv' => '200', 'options' => array('verifyCard' => true)));
Braintree_Configuration::merchantId($old_merchant_id);
Braintree_Configuration::publicKey($old_public_key);
Braintree_Configuration::privateKey($old_private_key);
$this->assertFalse($result->success);
$this->assertNull($result->creditCardVerification->gatewayRejectionReason);
}
示例12: testSale_createsASaleUsingGivenToken
function testSale_createsASaleUsingGivenToken()
{
$nonce = Braintree_Test_Nonces::$paypalFuturePayment;
$customer = Braintree_Customer::createNoValidate(array('paymentMethodNonce' => $nonce));
$paypalAccount = $customer->paypalAccounts[0];
$result = Braintree_PayPalAccount::sale($paypalAccount->token, array('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);
}