forked from solidusio-contrib/solidus_klarna_payments
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hooks has been deprecated in favor of subscribing to order_recalculate
Please see PR #[3553](solidusio/solidus#3553) for more information concerning this change.
- Loading branch information
Showing
2 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/subscribers/solidus_klarna_payments/klarna_subscriber.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusKlarnaPayments | ||
module KlarnaSubscriber | ||
include ::Spree::Event::Subscriber | ||
|
||
event_action :update_klarna_shipments, event_name: :order_recalulated | ||
event_action :update_klarna_customer, event_name: :order_recalulated | ||
|
||
def update_klarna_shipments | ||
order = event.payload[:order] | ||
order.update_klarna_shipments | ||
end | ||
|
||
def update_klarna_customer | ||
order = event.payload[:order] | ||
order.update_klarna_customer | ||
end | ||
end | ||
end |