Class: Workarea::Affirm::Update
- Inherits:
-
Object
- Object
- Workarea::Affirm::Update
- Defined in:
- app/services/workarea/affirm/update.rb
Instance Attribute Summary collapse
-
#checkout ⇒ Object
readonly
Returns the value of attribute checkout.
-
#checkout_token ⇒ Object
readonly
Returns the value of attribute checkout_token.
Instance Method Summary collapse
- #apply ⇒ Object
- #details ⇒ Object
-
#initialize(checkout, checkout_token) ⇒ Update
constructor
A new instance of Update.
Constructor Details
#initialize(checkout, checkout_token) ⇒ Update
Returns a new instance of Update.
6 7 8 9 |
# File 'app/services/workarea/affirm/update.rb', line 6 def initialize(checkout, checkout_token) @checkout = checkout @checkout_token = checkout_token end |
Instance Attribute Details
#checkout ⇒ Object (readonly)
Returns the value of attribute checkout
4 5 6 |
# File 'app/services/workarea/affirm/update.rb', line 4 def checkout @checkout end |
#checkout_token ⇒ Object (readonly)
Returns the value of attribute checkout_token
4 5 6 |
# File 'app/services/workarea/affirm/update.rb', line 4 def checkout_token @checkout_token end |
Instance Method Details
#apply ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/workarea/affirm/update.rb', line 15 def apply payment = checkout.payment order = checkout.order payment.set_affirm( checkout_token: checkout_token, details: details.body ) payment.adjust_tender_amounts(order.total_price) order.save && payment.save end |