Class: Workarea::Zipco::Setup
- Inherits:
-
Object
- Object
- Workarea::Zipco::Setup
- Defined in:
- app/services/workarea/zipco/setup.rb
Instance Attribute Summary collapse
-
#checkout ⇒ Object
readonly
Returns the value of attribute checkout.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #create_order_response ⇒ Object
-
#initialize(checkout) ⇒ Setup
constructor
A new instance of Setup.
- #redirect_uri ⇒ Object
- #set_checkout_data ⇒ Object
Constructor Details
#initialize(checkout) ⇒ Setup
Returns a new instance of Setup.
7 8 9 10 |
# File 'app/services/workarea/zipco/setup.rb', line 7 def initialize(checkout) @checkout = checkout @order = checkout.order end |
Instance Attribute Details
#checkout ⇒ Object (readonly)
Returns the value of attribute checkout.
4 5 6 |
# File 'app/services/workarea/zipco/setup.rb', line 4 def checkout @checkout end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'app/services/workarea/zipco/setup.rb', line 4 def order @order end |
Instance Method Details
#create_order_response ⇒ Object
12 13 14 |
# File 'app/services/workarea/zipco/setup.rb', line 12 def create_order_response @create_order_response ||= Zipco.gateway.create_order(order_details) end |
#redirect_uri ⇒ Object
26 27 28 |
# File 'app/services/workarea/zipco/setup.rb', line 26 def redirect_uri create_order_response.redirect_uri end |
#set_checkout_data ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/services/workarea/zipco/setup.rb', line 16 def set_checkout_data payment = Workarea::Payment.find(order.id) payment.clear_credit_card payment.set_zipco(token: create_order_response.zipco_order_id) order.update_attributes!(zipco_order_id: create_order_response.zipco_order_id) end |