Class: StripeRefund
Instance Attribute Summary
#stripe_object
Class Method Summary
collapse
Instance Method Summary
collapse
check_object_is_stripe_class, #check_object_is_stripe_class, create_from_stripe!, create_on_stripe!, #destroy_on_stripe, #destroy_on_stripe!, #reload!, #reload_from_stripe!, #to_stripe, #update_on_stripe, #update_on_stripe!
Class Method Details
.stripe_class ⇒ Object
6
7
8
|
# File 'lib/stripe_model_callbacks/models/stripe_refund.rb', line 6
def self.stripe_class
Stripe::Refund
end
|
Instance Method Details
#assign_from_stripe(object) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/stripe_model_callbacks/models/stripe_refund.rb', line 10
def assign_from_stripe(object)
check_object_is_stripe_class(object)
assign_attributes(
amount: Money.new(object.amount, object.currency),
stripe_charge_id: object.charge,
created: Time.zone.at(object.created),
livemode: object.try(:livemode) == true,
metadata: JSON.generate(object.metadata)
)
StripeModelCallbacks::AttributesAssignerService.execute!(
model: self,
stripe_model: object,
attributes: %w[balance_transaction currency reason receipt_number status]
)
self.failure_reason = object.failure_reason if object.respond_to?(:failure_reason)
self.failure_balance_transaction = object.failure_balance_transaction if object.respond_to?(:failure_balance_transaction)
end
|