Class: Braintree::WebhookNotification

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/webhook_notification.rb

Defined Under Namespace

Modules: Kind

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(gateway, attributes) ⇒ WebhookNotification

Returns a new instance of WebhookNotification.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/braintree/webhook_notification.rb', line 98

def initialize(gateway, attributes)
  @gateway = gateway
  set_instance_variables_from_hash(attributes)
  @error_result = ErrorResult.new(gateway, @subject[:api_error_response]) if @subject.has_key?(:api_error_response)
  @merchant_account = MerchantAccount._new(gateway, @subject[:merchant_account]) if @subject.has_key?(:merchant_account)
  @partner_merchant = OpenStruct.new(@subject[:partner_merchant]) if @subject.has_key?(:partner_merchant)
  @oauth_access_revocation = OpenStruct.new(@subject[:oauth_application_revocation]) if @subject.has_key?(:oauth_application_revocation)
  @subscription = Subscription._new(gateway, @subject[:subscription]) if @subject.has_key?(:subscription)
  @transaction = Transaction._new(gateway, @subject[:transaction]) if @subject.has_key?(:transaction)
  @transaction_review = OpenStruct.new(@subject[:transaction_review]) if @subject.has_key?(:transaction_review)
  @disbursement = Disbursement._new(gateway, @subject[:disbursement]) if @subject.has_key?(:disbursement)
  @dispute = Dispute._new(@subject[:dispute]) if @subject.has_key?(:dispute)
  @account_updater_daily_report = AccountUpdaterDailyReport._new(@subject[:account_updater_daily_report]) if @subject.has_key?(:account_updater_daily_report)
  @connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned._new(@subject[:connected_merchant_status_transitioned]) if @subject.has_key?(:connected_merchant_status_transitioned)
  @connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged._new(@subject[:connected_merchant_paypal_status_changed]) if @subject.has_key?(:connected_merchant_paypal_status_changed)
  @granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
  @revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer, Kind::GrantedPaymentMethodRevoked].include?(@kind)
  @local_payment_completed = LocalPaymentCompleted._new(@subject[:local_payment]) if @subject.has_key?(:local_payment) && Kind::LocalPaymentCompleted == @kind
  @local_payment_expired = LocalPaymentExpired._new(@subject[:local_payment_expired]) if @subject.has_key?(:local_payment_expired) && Kind::LocalPaymentExpired == @kind
  @local_payment_funded = LocalPaymentFunded._new(@subject[:local_payment_funded]) if @subject.has_key?(:local_payment_funded) && Kind::LocalPaymentFunded == @kind
  @local_payment_reversed = LocalPaymentReversed._new(@subject[:local_payment_reversed]) if @subject.has_key?(:local_payment_reversed) && Kind::LocalPaymentReversed == @kind
  @payment_method_customer_data_updated_metadata = PaymentMethodCustomerDataUpdatedMetadata._new(gateway, @subject[:payment_method_customer_data_updated_metadata]) if @subject.has_key?(:payment_method_customer_data_updated_metadata) && Kind::PaymentMethodCustomerDataUpdated == @kind

end

Instance Attribute Details

#account_updater_daily_reportObject (readonly)

Returns the value of attribute account_updater_daily_report.



69
70
71
# File 'lib/braintree/webhook_notification.rb', line 69

def 
  @account_updater_daily_report
end

#connected_merchant_paypal_status_changedObject (readonly)

Returns the value of attribute connected_merchant_paypal_status_changed.



70
71
72
# File 'lib/braintree/webhook_notification.rb', line 70

def connected_merchant_paypal_status_changed
  @connected_merchant_paypal_status_changed
end

#connected_merchant_status_transitionedObject (readonly)

Returns the value of attribute connected_merchant_status_transitioned.



71
72
73
# File 'lib/braintree/webhook_notification.rb', line 71

def connected_merchant_status_transitioned
  @connected_merchant_status_transitioned
end

#disbursementObject (readonly)

Returns the value of attribute disbursement.



72
73
74
# File 'lib/braintree/webhook_notification.rb', line 72

def disbursement
  @disbursement
end

#disputeObject (readonly)

Returns the value of attribute dispute.



73
74
75
# File 'lib/braintree/webhook_notification.rb', line 73

def dispute
  @dispute
end

#granted_payment_instrument_updateObject (readonly)

Returns the value of attribute granted_payment_instrument_update.



74
75
76
# File 'lib/braintree/webhook_notification.rb', line 74

def granted_payment_instrument_update
  @granted_payment_instrument_update
end

#kindObject (readonly)

Returns the value of attribute kind.



76
77
78
# File 'lib/braintree/webhook_notification.rb', line 76

def kind
  @kind
end

#local_payment_completedObject (readonly)

Returns the value of attribute local_payment_completed.



77
78
79
# File 'lib/braintree/webhook_notification.rb', line 77

def local_payment_completed
  @local_payment_completed
end

#local_payment_expiredObject (readonly)

Returns the value of attribute local_payment_expired.



78
79
80
# File 'lib/braintree/webhook_notification.rb', line 78

def local_payment_expired
  @local_payment_expired
end

#local_payment_fundedObject (readonly)

Returns the value of attribute local_payment_funded.



79
80
81
# File 'lib/braintree/webhook_notification.rb', line 79

def local_payment_funded
  @local_payment_funded
end

#local_payment_reversedObject (readonly)

Returns the value of attribute local_payment_reversed.



80
81
82
# File 'lib/braintree/webhook_notification.rb', line 80

def local_payment_reversed
  @local_payment_reversed
end

#oauth_access_revocationObject (readonly)

Returns the value of attribute oauth_access_revocation.



81
82
83
# File 'lib/braintree/webhook_notification.rb', line 81

def oauth_access_revocation
  @oauth_access_revocation
end

#partner_merchantObject (readonly)

Returns the value of attribute partner_merchant.



82
83
84
# File 'lib/braintree/webhook_notification.rb', line 82

def partner_merchant
  @partner_merchant
end

#payment_method_customer_data_updated_metadataObject (readonly)

Returns the value of attribute payment_method_customer_data_updated_metadata.



83
84
85
# File 'lib/braintree/webhook_notification.rb', line 83

def 
  @payment_method_customer_data_updated_metadata
end

#revoked_payment_method_metadataObject (readonly)

Returns the value of attribute revoked_payment_method_metadata.



75
76
77
# File 'lib/braintree/webhook_notification.rb', line 75

def 
  @revoked_payment_method_metadata
end

#source_merchant_idObject (readonly)

Returns the value of attribute source_merchant_id.



84
85
86
# File 'lib/braintree/webhook_notification.rb', line 84

def source_merchant_id
  @source_merchant_id
end

#subscriptionObject (readonly)

Returns the value of attribute subscription.



85
86
87
# File 'lib/braintree/webhook_notification.rb', line 85

def subscription
  @subscription
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



86
87
88
# File 'lib/braintree/webhook_notification.rb', line 86

def timestamp
  @timestamp
end

#transactionObject (readonly)

Returns the value of attribute transaction.



87
88
89
# File 'lib/braintree/webhook_notification.rb', line 87

def transaction
  @transaction
end

#transaction_reviewObject (readonly)

Returns the value of attribute transaction_review.



88
89
90
# File 'lib/braintree/webhook_notification.rb', line 88

def transaction_review
  @transaction_review
end

Class Method Details

._new(*args) ⇒ Object



141
142
143
# File 'lib/braintree/webhook_notification.rb', line 141

def _new(*args)
  self.new(*args)
end

.parse(*args) ⇒ Object



90
91
92
# File 'lib/braintree/webhook_notification.rb', line 90

def self.parse(*args)
  Configuration.gateway.webhook_notification.parse(*args)
end

.verify(*args) ⇒ Object



94
95
96
# File 'lib/braintree/webhook_notification.rb', line 94

def self.verify(*args)
  Configuration.gateway.webhook_notification.verify(*args)
end

Instance Method Details

#check?Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/braintree/webhook_notification.rb', line 135

def check?
  !!@subject[:check]
end

#errorsObject



127
128
129
# File 'lib/braintree/webhook_notification.rb', line 127

def errors
  @error_result.errors if @error_result
end

#merchant_accountObject



123
124
125
# File 'lib/braintree/webhook_notification.rb', line 123

def 
  @error_result.nil? ? @merchant_account : @error_result.
end

#messageObject



131
132
133
# File 'lib/braintree/webhook_notification.rb', line 131

def message
  @error_result.message if @error_result
end