Class: MockChargebee::Models::PaymentSource
- Inherits:
-
Base
- Object
- Base
- MockChargebee::Models::PaymentSource
show all
- Defined in:
- lib/mock_chargebee/models/payment_source.rb
Constant Summary
collapse
- RESOURCE_ID_PREFIX =
'payment_source'
Class Method Summary
collapse
Methods inherited from Base
already_exists!, load_fixtures, repositories, unique_id
Class Method Details
.already_exists?(ref_id) ⇒ Boolean
24
25
26
27
28
|
# File 'lib/mock_chargebee/models/payment_source.rb', line 24
def self.already_exists?(ref_id)
return false if ref_id.nil?
repositories.payment_sources.values.include?(ref_id)
end
|
.create(params) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/mock_chargebee/models/payment_source.rb', line 14
def self.create(params)
already_exists!(params['reference_id']) if already_exists?(params['reference_id'])
params['id'] = unique_id
source = payment_source_fixture.merge(params)
repositories.payment_sources.store(source['id'], source)
source
end
|
.find(id) ⇒ Object
10
11
12
|
# File 'lib/mock_chargebee/models/payment_source.rb', line 10
def self.find(id)
repositories.payment_sources.fetch(id)
end
|