futhr/spree-klarna — pull request #1 by zerothabhishek (2013-07-24 13:38:13+00:00)
Title: [wip] Spree::Klarna::Order

### Usage

Somewhere in a CheckoutController:

```ruby
unless session[:klarna_order_id]
klarna_order = Klarna::Order.new
klarna_order.spree_order = current_order
klarna_order.create # create the order on Klarna (by Api request)
klarna_order.fetch # fetch the order details (by Api request)
session[:klarna_order_id] = klarna_order.id # set it in the session
else
klarna_order = Klarna::Order.new(session[:klarna_order_id])
klarna_order.spree_order = current_order
klarna_order.update # update the order on Klarna (by Api request)
klarna_order.fetch # fetch the order details (by Api request)
end
```
### Note:
This is a work in progress. Much of the code does't work, and a lot of it is untested.
The pull request is intended to demonstrate and discuss the implementation strategy

### Commit Details
. Spree::Klarna::Order represents Klarna's checkout order on our end
. Manages the properties that are needed to make api-requests
. Manages the properties that Klarna sets and we should maintain
. Keeps a reference to Spree:Order, and fetches cart related properties from it
. Keeps a reference to Spree::Klarna::CheckoutHandler object manages the api request/responses