Class: Payment::DuplicateChargeGuard::Match
- Inherits:
-
Data
- Object
- Data
- Payment::DuplicateChargeGuard::Match
- Defined in:
- app/services/payment/duplicate_charge_guard.rb
Instance Attribute Summary collapse
-
#amount_cents ⇒ Object
readonly
Returns the value of attribute amount_cents.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#payment_intent_id ⇒ Object
readonly
Returns the value of attribute payment_intent_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
Instance Attribute Details
#amount_cents ⇒ Object (readonly)
Returns the value of attribute amount_cents
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def amount_cents @amount_cents end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def description @description end |
#payment_intent_id ⇒ Object (readonly)
Returns the value of attribute payment_intent_id
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def payment_intent_id @payment_intent_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status
34 35 36 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 34 def status @status end |
Instance Method Details
#created_in_words ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 39 def created_in_words return nil unless created_at time_ago = (Time.current - created_at).to_i if time_ago < 60 "#{time_ago} seconds ago" elsif time_ago < 3600 "#{(time_ago / 60).to_i} minutes ago" elsif time_ago < 86_400 "#{(time_ago / 3600.0).round(1)} hours ago" else "#{(time_ago / 86_400.0).round(1)} days ago" end end |
#stripe_dashboard_url ⇒ Object
35 36 37 |
# File 'app/services/payment/duplicate_charge_guard.rb', line 35 def stripe_dashboard_url "https://dashboard.stripe.com/payments/#{payment_intent_id}" end |