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

:nodoc:


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/braintree/webhook_notification.rb', line 93

def initialize(gateway, attributes) # :nodoc:
  @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.


64
65
66
# File 'lib/braintree/webhook_notification.rb', line 64

def 
  @account_updater_daily_report
end

#connected_merchant_paypal_status_changedObject (readonly)

Returns the value of attribute connected_merchant_paypal_status_changed.


65
66
67
# File 'lib/braintree/webhook_notification.rb', line 65

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.


66
67
68
# File 'lib/braintree/webhook_notification.rb', line 66

def connected_merchant_status_transitioned
  @connected_merchant_status_transitioned
end

#disbursementObject (readonly)

Returns the value of attribute disbursement.


67
68
69
# File 'lib/braintree/webhook_notification.rb', line 67

def disbursement
  @disbursement
end

#disputeObject (readonly)

Returns the value of attribute dispute.


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

def dispute
  @dispute
end

#granted_payment_instrument_updateObject (readonly)

Returns the value of attribute granted_payment_instrument_update.


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

def granted_payment_instrument_update
  @granted_payment_instrument_update
end

#kindObject (readonly)

Returns the value of attribute kind.


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

def kind
  @kind
end

#local_payment_completedObject (readonly)

Returns the value of attribute local_payment_completed.


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

def local_payment_completed
  @local_payment_completed
end

#local_payment_expiredObject (readonly)

Returns the value of attribute local_payment_expired.


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

def local_payment_expired
  @local_payment_expired
end

#local_payment_fundedObject (readonly)

Returns the value of attribute local_payment_funded.


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

def local_payment_funded
  @local_payment_funded
end

#local_payment_reversedObject (readonly)

Returns the value of attribute local_payment_reversed.


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

def local_payment_reversed
  @local_payment_reversed
end

#oauth_access_revocationObject (readonly)

Returns the value of attribute oauth_access_revocation.


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

def oauth_access_revocation
  @oauth_access_revocation
end

#partner_merchantObject (readonly)

Returns the value of attribute partner_merchant.


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

def partner_merchant
  @partner_merchant
end

#payment_method_customer_data_updated_metadataObject (readonly)

Returns the value of attribute payment_method_customer_data_updated_metadata.


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

def 
  @payment_method_customer_data_updated_metadata
end

#revoked_payment_method_metadataObject (readonly)

Returns the value of attribute revoked_payment_method_metadata.


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

def 
  @revoked_payment_method_metadata
end

#source_merchant_idObject (readonly)

Returns the value of attribute source_merchant_id.


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

def source_merchant_id
  @source_merchant_id
end

#subscriptionObject (readonly)

Returns the value of attribute subscription.


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

def subscription
  @subscription
end

#timestampObject (readonly)

Returns the value of attribute timestamp.


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

def timestamp
  @timestamp
end

#transactionObject (readonly)

Returns the value of attribute transaction.


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

def transaction
  @transaction
end

#transaction_reviewObject (readonly)

Returns the value of attribute transaction_review.


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

def transaction_review
  @transaction_review
end

Class Method Details

._new(*args) ⇒ Object

:nodoc:


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

def _new(*args) # :nodoc:
  self.new(*args)
end

.parse(*args) ⇒ Object


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

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

.verify(*args) ⇒ Object


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

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

Instance Method Details

#check?Boolean

Returns:

  • (Boolean)

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

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

#errorsObject


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

def errors
  @error_result.errors if @error_result
end

#merchant_accountObject


118
119
120
# File 'lib/braintree/webhook_notification.rb', line 118

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

#messageObject


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

def message
  @error_result.message if @error_result
end