Class: ShoppingCart::CheckoutPayment
- Inherits:
-
Object
- Object
- ShoppingCart::CheckoutPayment
- Defined in:
- app/services/shopping_cart/checkout_payment.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params) ⇒ CheckoutPayment
constructor
A new instance of CheckoutPayment.
Constructor Details
#initialize(params) ⇒ CheckoutPayment
Returns a new instance of CheckoutPayment.
3 4 5 |
# File 'app/services/shopping_cart/checkout_payment.rb', line 3 def initialize(params) @params = params end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 |
# File 'app/services/shopping_cart/checkout_payment.rb', line 7 def call credit_card = CreditCard.find_by(order_id: credit_card_params[:order_id]) || CreditCard.new credit_card.attributes = credit_card_params credit_card.number = credit_card_params[:number][-4, 4] credit_card end |