Class: Payment::DuplicateChargeGuard::Match

Inherits:
Data
  • Object
show all
Defined in:
app/services/payment/duplicate_charge_guard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#amount_centsObject (readonly)

Returns the value of attribute amount_cents

Returns:

  • (Object)

    the current value of amount_cents



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def amount_cents
  @amount_cents
end

#created_atObject (readonly)

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency

Returns:

  • (Object)

    the current value of currency



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def description
  @description
end

#payment_intent_idObject (readonly)

Returns the value of attribute payment_intent_id

Returns:

  • (Object)

    the current value of payment_intent_id



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def payment_intent_id
  @payment_intent_id
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



34
35
36
# File 'app/services/payment/duplicate_charge_guard.rb', line 34

def status
  @status
end

Instance Method Details

#created_in_wordsObject



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_urlObject



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