Class: Magnetik::CreateCreditCard
- Inherits:
-
Object
- Object
- Magnetik::CreateCreditCard
- Includes:
- UseCase
- Defined in:
- app/use_cases/magnetik/create_credit_card.rb
Instance Attribute Summary collapse
-
#local_card ⇒ Object
readonly
Returns the value of attribute local_card.
Instance Method Summary collapse
-
#initialize(actor, token, card_params = {}) ⇒ CreateCreditCard
constructor
A new instance of CreateCreditCard.
- #perform ⇒ Object
Methods included from UseCase
Constructor Details
#initialize(actor, token, card_params = {}) ⇒ CreateCreditCard
Returns a new instance of CreateCreditCard.
7 8 9 10 11 12 |
# File 'app/use_cases/magnetik/create_credit_card.rb', line 7 def initialize(actor, token, card_params = {}) @token = token @actor = actor @card_params = card_params @remote_customer = nil end |
Instance Attribute Details
#local_card ⇒ Object (readonly)
Returns the value of attribute local_card.
5 6 7 |
# File 'app/use_cases/magnetik/create_credit_card.rb', line 5 def local_card @local_card end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/use_cases/magnetik/create_credit_card.rb', line 14 def perform if @actor.has_stripe_customer? fetch_customer else create_remote_customer create_local_customer end if @remote_customer && create_remote_card create_local_card end end |