webhookNotification()->parse($signature, $payload); } public static function verify($challenge) { return Configuration::gateway()->webhookNotification()->verify($challenge); } public static function factory($attributes) { $instance = new self(); $instance->_initialize($attributes); return $instance; } protected function _initialize($attributes) { $this->_attributes = $attributes; if (!isset($attributes['sourceMerchantId'])) { $this->_set('sourceMerchantId', null); } if (isset($attributes['subject']['apiErrorResponse'])) { $wrapperNode = $attributes['subject']['apiErrorResponse']; } else { $wrapperNode = $attributes['subject']; } if (isset($wrapperNode['subscription'])) { $this->_set('subscription', Subscription::factory($attributes['subject']['subscription'])); } if (isset($wrapperNode['merchantAccount'])) { $this->_set('merchantAccount', MerchantAccount::factory($wrapperNode['merchantAccount'])); } if (isset($wrapperNode['transaction'])) { $this->_set('transaction', Transaction::factory($wrapperNode['transaction'])); } if (isset($wrapperNode['disbursement'])) { $this->_set('disbursement', Disbursement::factory($wrapperNode['disbursement'])); } if (isset($wrapperNode['partnerMerchant'])) { $this->_set('partnerMerchant', PartnerMerchant::factory($wrapperNode['partnerMerchant'])); } if (isset($wrapperNode['oauthApplicationRevocation'])) { $this->_set('oauthAccessRevocation', OAuthAccessRevocation::factory($wrapperNode['oauthApplicationRevocation'])); } if (isset($wrapperNode['connectedMerchantStatusTransitioned'])) { $this->_set('connectedMerchantStatusTransitioned', ConnectedMerchantStatusTransitioned::factory($wrapperNode['connectedMerchantStatusTransitioned'])); } if (isset($wrapperNode['connectedMerchantPaypalStatusChanged'])) { $this->_set('connectedMerchantPayPalStatusChanged', ConnectedMerchantPayPalStatusChanged::factory($wrapperNode['connectedMerchantPaypalStatusChanged'])); } if (isset($wrapperNode['dispute'])) { $this->_set('dispute', Dispute::factory($wrapperNode['dispute'])); } if (isset($wrapperNode['accountUpdaterDailyReport'])) { $this->_set('accountUpdaterDailyReport', AccountUpdaterDailyReport::factory($wrapperNode['accountUpdaterDailyReport'])); } if (isset($wrapperNode['idealPayment'])) { $this->_set('idealPayment', IdealPayment::factory($wrapperNode['idealPayment'])); } if (isset($wrapperNode['grantedPaymentInstrumentUpdate'])) { $this->_set('grantedPaymentInstrumentUpdate', GrantedPaymentInstrumentUpdate::factory($wrapperNode['grantedPaymentInstrumentUpdate'])); } if (isset($wrapperNode['errors'])) { $this->_set('errors', new Error\ValidationErrorCollection($wrapperNode['errors'])); $this->_set('message', $wrapperNode['message']); } } } class_alias('Braintree\WebhookNotification', 'Braintree_WebhookNotification');