本文整理匯總了PHP中Braintree_Subscription::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Braintree_Subscription::factory方法的具體用法?PHP Braintree_Subscription::factory怎麽用?PHP Braintree_Subscription::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Braintree_Subscription
的用法示例。
在下文中一共展示了Braintree_Subscription::factory方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* overrides default constructor
* @ignore
* @param array $response gateway response array
*/
public function __construct($response)
{
$this->_attributes = $response;
$this->_set('errors', new Braintree_Error_ErrorCollection($response['errors']));
if (isset($response['verification'])) {
$this->_set('creditCardVerification', new Braintree_Result_CreditCardVerification($response['verification']));
} else {
$this->_set('creditCardVerification', null);
}
if (isset($response['transaction'])) {
$this->_set('transaction', Braintree_Transaction::factory($response['transaction']));
} else {
$this->_set('transaction', null);
}
if (isset($response['subscription'])) {
$this->_set('subscription', Braintree_Subscription::factory($response['subscription']));
} else {
$this->_set('subscription', null);
}
if (isset($response['merchantAccount'])) {
$this->_set('merchantAccount', Braintree_MerchantAccount::factory($response['merchantAccount']));
} else {
$this->_set('merchantAccount', null);
}
}
示例2: _initialize
protected function _initialize($attributes)
{
$this->_attributes = $attributes;
if (isset($attributes['subject']['apiErrorResponse'])) {
$wrapperNode = $attributes['subject']['apiErrorResponse'];
} else {
$wrapperNode = $attributes['subject'];
}
if (isset($wrapperNode['subscription'])) {
$this->_set('subscription', Braintree_Subscription::factory($attributes['subject']['subscription']));
}
if (isset($wrapperNode['merchantAccount'])) {
$this->_set('merchantAccount', Braintree_MerchantAccount::factory($wrapperNode['merchantAccount']));
}
if (isset($wrapperNode['transaction'])) {
$this->_set('transaction', Braintree_Transaction::factory($wrapperNode['transaction']));
}
if (isset($wrapperNode['disbursement'])) {
$this->_set('disbursement', Braintree_Disbursement::factory($wrapperNode['disbursement']));
}
if (isset($wrapperNode['partnerMerchant'])) {
$this->_set('partnerMerchant', Braintree_PartnerMerchant::factory($wrapperNode['partnerMerchant']));
}
if (isset($wrapperNode['errors'])) {
$this->_set('errors', new Braintree_Error_ValidationErrorCollection($wrapperNode['errors']));
$this->_set('message', $wrapperNode['message']);
}
}
示例3: _initialize
protected function _initialize($attributes)
{
$this->_attributes = $attributes;
if (isset($attributes['subject']) && isset($attributes['subject']['subscription'])) {
$this->_set('subscription', Braintree_Subscription::factory($attributes['subject']['subscription']));
}
}
示例4: _initialize
/**
* sets instance properties from an array of values
*
* @access protected
* @param array $paypalAccountAttribs array of paypalAccount data
* @return none
*/
protected function _initialize($paypalAccountAttribs)
{
// set the attributes
$this->_attributes = $paypalAccountAttribs;
$subscriptionArray = array();
if (isset($paypalAccountAttribs['subscriptions'])) {
foreach ($paypalAccountAttribs['subscriptions'] as $subscription) {
$subscriptionArray[] = Braintree_Subscription::factory($subscription);
}
}
$this->_set('subscriptions', $subscriptionArray);
}
示例5: _initialize
/**
* sets instance properties from an array of values
*
* @access protected
* @param array $applePayCardAttribs array of Apple Pay card properties
* @return none
*/
protected function _initialize($applePayCardAttribs)
{
// set the attributes
$this->_attributes = $applePayCardAttribs;
$subscriptionArray = array();
if (isset($applePayCardAttribs['subscriptions'])) {
foreach ($applePayCardAttribs['subscriptions'] as $subscription) {
$subscriptionArray[] = Braintree_Subscription::factory($subscription);
}
}
$this->_set('subscriptions', $subscriptionArray);
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
}
示例6: _initialize
/**
* sets instance properties from an array of values
*
* @access protected
* @param array $creditCardAttribs array of creditcard data
* @return none
*/
protected function _initialize($creditCardAttribs)
{
// set the attributes
$this->_attributes = $creditCardAttribs;
// map each address into its own object
$billingAddress = isset($creditCardAttribs['billingAddress']) ? Braintree_Address::factory($creditCardAttribs['billingAddress']) : null;
$subscriptionArray = array();
if (isset($creditCardAttribs['subscriptions'])) {
foreach ($creditCardAttribs['subscriptions'] as $subscription) {
$subscriptionArray[] = Braintree_Subscription::factory($subscription);
}
}
$this->_set('subscriptions', $subscriptionArray);
$this->_set('billingAddress', $billingAddress);
$this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
$this->_set('maskedNumber', $this->bin . '******' . $this->last4);
}
示例7: _verifyGatewayResponse
/**
* @ignore
*/
private function _verifyGatewayResponse($response)
{
if (isset($response['subscription'])) {
return new Braintree_Result_Successful(Braintree_Subscription::factory($response['subscription']));
} else {
if (isset($response['transaction'])) {
// return a populated instance of Braintree_Transaction, for subscription retryCharge
return new Braintree_Result_Successful(Braintree_Transaction::factory($response['transaction']));
} else {
if (isset($response['apiErrorResponse'])) {
return new Braintree_Result_Error($response['apiErrorResponse']);
} else {
throw new Braintree_Exception_Unexpected("Expected subscription, transaction, or apiErrorResponse");
}
}
}
}