Class: Spree::PayoutProfile
- Inherits:
-
Base
- Object
- Base
- Spree::PayoutProfile
show all
- Defined in:
- app/models/spree/payout_profile.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.default ⇒ Object
32
33
34
35
36
|
# File 'app/models/spree/payout_profile.rb', line 32
def self.default
Rails.cache.fetch("default_payout_account/#{name.underscore}") do
find_by(type: name, default: true)
end
end
|
Instance Method Details
#allow_to_verify_with_bank? ⇒ Boolean
67
68
69
|
# File 'app/models/spree/payout_profile.rb', line 67
def allow_to_verify_with_bank?
true
end
|
#bank_name ⇒ Object
42
43
44
|
# File 'app/models/spree/payout_profile.rb', line 42
def bank_name
'None'
end
|
#can_be_deleted? ⇒ Boolean
84
85
86
|
# File 'app/models/spree/payout_profile.rb', line 84
def can_be_deleted?
self.class.where.not(id: id, type: type).any?
end
|
#clear_default_cache ⇒ Object
38
39
40
|
# File 'app/models/spree/payout_profile.rb', line 38
def clear_default_cache
Rails.cache.delete("default_payout_account/#{self.class.name.underscore}")
end
|
#display_name ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'app/models/spree/payout_profile.rb', line 46
def display_name
display_name = name
bank_info = [bank_name, bank_account_number].compact.join(' - ')
display_name += " (#{bank_info})" unless bank_info.empty?
display_name
end
|
#receivable? ⇒ Boolean
59
60
61
|
# File 'app/models/spree/payout_profile.rb', line 59
def receivable?
verified? && active?
end
|
#registered_in_bank? ⇒ Boolean
63
64
65
|
# File 'app/models/spree/payout_profile.rb', line 63
def registered_in_bank?
true
end
|
#reset_verification! ⇒ Object
78
79
80
81
82
|
# File 'app/models/spree/payout_profile.rb', line 78
def reset_verification!
update_columns(
verified_at: nil
)
end
|
#verified? ⇒ Boolean
55
56
57
|
# File 'app/models/spree/payout_profile.rb', line 55
def verified?
verified_at.present?
end
|
#verify!(response_data) ⇒ Object
71
72
73
74
75
76
|
# File 'app/models/spree/payout_profile.rb', line 71
def verify!(response_data)
update_columns(
verified_at: DateTime.current,
response_data: response_data
)
end
|