spree_mollie_gateway 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6b5e166026cbe5e73895dd1806d2f2a9de535116ce51b7f2b233c7d91c7b84b
4
- data.tar.gz: f6462d90a2ed5aff5b237e98292e79f7281f5a29e3d95af028c02063a353743c
3
+ metadata.gz: 04dffc4397c0906e9ac9469d19a34383a761b5b5b7c855e106ef96e6c3cf61dd
4
+ data.tar.gz: ff2d1989f4ffdd3691460b7bba9e86b39b64bdd921f312b2b1efe87cdff94c55
5
5
  SHA512:
6
- metadata.gz: a8e0f55fbfa671c855d140d63a5ba240cc1f23006611a0c7834b9be0ef44093c8b6216f199e6a2dd98a337a313c7301ae7632b7a3ab4ed24f390c8fa4a9dd217
7
- data.tar.gz: 85d95df79e975054152b6b31a20b781738d9cf04b02201d37d95098c3e5c77caa4c1e6d15b5768e9051324dc074a5c3b0e108e3780aa5476917f88d6028fe767
6
+ metadata.gz: 5e7e00a2a4d75e2421a0fd32fbfb9c516368117ada4025be509bc7132383a3eaf16660f29f8ece73994a6d9724fcd049f6578a8d2b4dd8da6d895dc2a3d85921
7
+ data.tar.gz: 345ac2e50241569f55e73f562c73c78e2ed848ed48bbc8caa56201290676f5a52a16317be51fe1bf41f0c6157aae8d98ff59909c44528297e0717bc808970d6d
@@ -14,18 +14,20 @@ module Spree
14
14
  case @mollie_order.status
15
15
  when 'paid', 'completed'
16
16
  transition_to_paid!
17
+ @spree_payment.source.update(status: @spree_payment.state)
17
18
  when 'canceled', 'expired'
18
19
  transition_to_failed!
20
+ @spree_payment.source.update(status: @spree_payment.state)
19
21
  when 'authorized'
20
22
  transition_to_authorized!
23
+ @spree_payment.source.update(status: @spree_payment.state)
21
24
  when 'shipping'
22
25
  transition_to_shipping!
26
+ @spree_payment.source.update(status: @spree_payment.state)
23
27
  else
24
28
  MollieLogger.debug("Unhandled Mollie payment state received: #{@mollie_order.status}. Therefore we did not update the payment state.")
25
29
  @spree_payment.order.update_attributes(state: 'payment', completed_at: nil)
26
30
  end
27
-
28
- @spree_payment.source.update(status: @spree_payment.state)
29
31
  end
30
32
 
31
33
  private
@@ -28,4 +28,12 @@ Spree::Payment.class_eval do
28
28
  false
29
29
  end
30
30
  end
31
+
32
+ def after_pay_method?
33
+ if source.is_a? Spree::MolliePaymentSource
34
+ return source.payment_method_name == ::Mollie::Method::KLARNAPAYLATER || source.payment_method_name == ::Mollie::Method::KLARNASLICEIT
35
+ else
36
+ false
37
+ end
38
+ end
31
39
  end
@@ -0,0 +1,238 @@
1
+ <% content_for :page_title do %>
2
+ <%= plural_resource_name(Spree::Order) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <%= button_link_to Spree.t(:new_order), new_admin_order_url, class: "btn-success", icon: 'add', id: 'admin_new_order' %>
7
+ <% end if can? :create, Spree::Order %>
8
+
9
+ <% content_for :table_filter do %>
10
+ <div data-hook="admin_orders_index_search">
11
+
12
+ <%= search_form_for [:admin, @search] do |f| %>
13
+ <div class="row">
14
+ <div class="date-range-filter col-xs-12 col-md-8">
15
+ <div class="form-group">
16
+ <%= label_tag :q_created_at_gt, Spree.t(:date_range) %>
17
+ <div class="row no-padding-bottom">
18
+ <div class="col-xs-12 col-md-6">
19
+ <div class="input-group">
20
+ <%= f.text_field :created_at_gt, class: 'datepicker datepicker-from form-control', value: params[:q][:created_at_gt], placeholder: Spree.t(:start) %>
21
+ <span class="input-group-addon">
22
+ <i class="icon icon-calendar"></i>
23
+ </span>
24
+ </div>
25
+
26
+ </div>
27
+ <div class="col-xs-12 col-md-6">
28
+ <div class="input-group">
29
+ <%= f.text_field :created_at_lt, class: 'datepicker datepicker-to form-control', value: params[:q][:created_at_lt], placeholder: Spree.t(:stop) %>
30
+ <span class="input-group-addon">
31
+ <i class="icon icon-calendar"></i>
32
+ </span>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="col-xs-12 col-md-4">
40
+ <div class="form-group">
41
+ <%= label_tag :q_number_cont, Spree.t(:order_number, number: '') %>
42
+ <%= f.text_field :number_cont, class: 'form-control js-quick-search-target' %>
43
+ </div>
44
+ </div>
45
+
46
+ </div>
47
+
48
+ <div class="row">
49
+
50
+ <div class="col-xs-12 col-md-4">
51
+ <div class="form-group">
52
+ <%= label_tag :q_state_eq, Spree.t(:status) %>
53
+ <%= f.select :state_eq, Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]}, { include_blank: true }, class: 'select2 js-filterable' %>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="col-xs-12 col-md-4">
58
+ <div class="form-group">
59
+ <%= label_tag :q_payment_state_eq, Spree.t(:payment_state) %>
60
+ <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
61
+ </div>
62
+ </div>
63
+
64
+ <div class="col-xs-12 col-md-4">
65
+ <div class="form-group">
66
+ <%= label_tag :q_shipment_state_eq, Spree.t(:shipment_state) %>
67
+ <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
68
+ </div>
69
+ </div>
70
+
71
+ </div>
72
+
73
+ <div class="row">
74
+
75
+ <div class="col-xs-12 col-md-4">
76
+ <div class="form-group">
77
+ <%= label_tag :q_bill_address_firstname_start, Spree.t(:first_name_begins_with) %>
78
+ <%= f.text_field :bill_address_firstname_start, class: 'form-control' %>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="col-xs-12 col-md-4">
83
+ <div class="form-group">
84
+ <%= label_tag :q_bill_address_lastname_start, Spree.t(:last_name_begins_with) %>
85
+ <%= f.text_field :bill_address_lastname_start, class: 'form-control' %>
86
+ </div>
87
+ </div>
88
+
89
+ <div class="col-xs-12 col-md-4">
90
+ <div class="form-group">
91
+ <%= label_tag :q_email_cont, Spree.t(:email) %>
92
+ <%= f.text_field :email_cont, class: 'form-control js-filterable' %>
93
+ </div>
94
+ </div>
95
+
96
+ </div>
97
+
98
+ <div class="row">
99
+
100
+ <div class="col-xs-12 col-md-4">
101
+ <div class="form-group">
102
+ <%= label_tag :q_line_items_variant_sku_eq, Spree.t(:sku) %>
103
+ <%= f.text_field :line_items_variant_sku_eq, class: 'form-control' %>
104
+ </div>
105
+ </div>
106
+
107
+ <div class="col-xs-12 col-md-4">
108
+ <div class="form-group">
109
+ <%= label_tag :q_promotions_id_in, Spree.t(:promotion) %>
110
+ <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), { include_blank: true }, class: 'select2' %>
111
+ </div>
112
+ </div>
113
+
114
+ <div class="col-xs-12 col-md-4">
115
+ <div class="form-group">
116
+ <%= label_tag :q_store_id_in, Spree.t(:store) %>
117
+ <%= f.select :store_id_in, Spree::Store.order("#{Spree::Store.table_name}.name").pluck(:name, :id), { include_blank: true }, class: 'select2' %>
118
+ </div>
119
+ </div>
120
+
121
+ <div class="col-xs-12 col-md-4">
122
+
123
+ <div class="form-group">
124
+
125
+ <div class="checkbox">
126
+ <%= label_tag 'q_completed_at_not_null' do %>
127
+ <%= f.check_box :completed_at_not_null, {checked: @show_only_completed}, '1', '0' %>
128
+ <%= Spree.t(:show_only_complete_orders) %>
129
+ <% end %>
130
+ </div>
131
+
132
+ <div class="checkbox">
133
+ <%= label_tag 'q_considered_risky_eq' do %>
134
+ <%= f.check_box :considered_risky_eq, {checked: (params[:q][:considered_risky_eq] == '1')}, '1', '' %>
135
+ <%= Spree.t(:show_only_considered_risky) %>
136
+ <% end %>
137
+ </div>
138
+
139
+ </div>
140
+
141
+ </div>
142
+
143
+ </div>
144
+
145
+ <div data-hook="admin_orders_index_search_buttons" class="form-actions">
146
+ <%= button Spree.t(:filter_results), 'search' %>
147
+ </div>
148
+
149
+ <% end %>
150
+
151
+ </div>
152
+
153
+ <% end %>
154
+
155
+ <%= render 'spree/admin/shared/index_table_options', collection: @orders %>
156
+
157
+ <% if @orders.any? %>
158
+ <table class="table" id="listing_orders" data-hook>
159
+ <thead>
160
+ <tr data-hook="admin_orders_index_headers">
161
+ <% if @show_only_completed %>
162
+ <th><%= sort_link @search, :completed_at, I18n.t(:completed_at, scope: 'activerecord.attributes.spree/order') %></th>
163
+ <% else %>
164
+ <th><%= sort_link @search, :created_at, I18n.t(:created_at, scope: 'activerecord.attributes.spree/order') %></th>
165
+ <% end %>
166
+ <th><%= sort_link @search, :number, I18n.t(:number, scope: 'activerecord.attributes.spree/order') %></th>
167
+ <th><%= sort_link @search, :considered_risky, I18n.t(:considered_risky, scope: 'activerecord.attributes.spree/order') %></th>
168
+ <th><%= sort_link @search, :state, I18n.t(:state, scope: 'activerecord.attributes.spree/order') %></th>
169
+ <th><%= sort_link @search, :payment_state, I18n.t(:payment_state, scope: 'activerecord.attributes.spree/order') %></th>
170
+ <% if Spree::Order.checkout_step_names.include?(:delivery) %>
171
+ <th><%= sort_link @search, :shipment_state, I18n.t(:shipment_state, scope: 'activerecord.attributes.spree/order') %></th>
172
+ <% end %>
173
+ <th><%= sort_link @search, :email, I18n.t(:email, scope: 'activerecord.attributes.spree/order') %></th>
174
+ <th><%= sort_link @search, :total, I18n.t(:total, scope: 'activerecord.attributes.spree/order') %></th>
175
+ <th data-hook="admin_orders_index_header_actions" class="actions"></th>
176
+ </tr>
177
+ </thead>
178
+ <tbody>
179
+ <% @orders.each do |order| %>
180
+ <tr data-hook="admin_orders_index_rows" class="state-<%= order.state.downcase %> <%= cycle('odd', 'even') %>">
181
+ <td>
182
+ <%= order_time(@show_only_completed ? order.completed_at : order.created_at) %>
183
+ </td>
184
+ <td><%= link_to order.number, edit_admin_order_path(order) %></td>
185
+ <td>
186
+ <span class="label label-<%= order.considered_risky ? 'considered_risky' : 'considered_safe' %>">
187
+ <%= order.considered_risky ? Spree.t("risky") : Spree.t("safe") %>
188
+ </span>
189
+ </td>
190
+ <td>
191
+ <span class="label label-<%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></span>
192
+ <span class="icon icon-filter filterable js-add-filter" data-ransack-field="q_state_eq" data-ransack-value="<%= order.state %>"></span>
193
+ </td>
194
+ <td>
195
+ <% if order.payments.count > 0 && order.payments.last.source.present? %>
196
+ <% if order.payments.last.after_pay_method? && order.payments.last.authorized? %>
197
+ <span class="label label-authorized"><%= link_to 'authorized', admin_order_payments_path(order) %></span>
198
+ <% else %>
199
+ <span class="label label-<%= order.payments.last.source.status %>"><%= link_to order.payments.last.source.status, admin_order_payments_path(order) %></span>
200
+ <% end %>
201
+ <% end %>
202
+ </td>
203
+ <% if Spree::Order.checkout_step_names.include?(:delivery) %>
204
+ <td>
205
+ <% if order.shipment_state %>
206
+ <span class="label label-<%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") %></span>
207
+ <span class="icon icon-filter filterable js-add-filter" data-ransack-field="q_shipment_state_eq" data-ransack-value="<%= order.shipment_state %>"></span>
208
+ <% end %>
209
+ </td>
210
+ <% end %>
211
+ <td>
212
+ <% if order.user %>
213
+ <%= link_to order.email, edit_admin_user_path(order.user) %>
214
+ <% else %>
215
+ <%= mail_to order.email %>
216
+ <% end %>
217
+ <% if order.user || order.email %>
218
+ <span class="icon icon-filter filterable js-add-filter" data-ransack-field="q_email_cont" data-ransack-value="<%= order.email %>"></span>
219
+ <% end %>
220
+ </td>
221
+ <td><%= order.display_total.to_html %></td>
222
+ <td class='actions actions-1' data-hook="admin_orders_index_row_actions">
223
+ <%= link_to_edit_url edit_admin_order_path(order), title: "admin_edit_#{dom_id(order)}", no_text: true if can?(:edit, order) %>
224
+ </td>
225
+ </tr>
226
+ <% end %>
227
+ </tbody>
228
+ </table>
229
+ <% else %>
230
+ <div class="alert alert-info no-objects-found">
231
+ <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Order)) %>,
232
+ <%= link_to(Spree.t(:add_one), new_admin_order_url) if can? :create, Spree::Order %>!
233
+ </div>
234
+ <% end %>
235
+
236
+ <%= render 'spree/admin/shared/index_table_options', collection: @orders, simple: true %>
237
+
238
+ <%= render 'spree/admin/shared/styles' %>
@@ -0,0 +1,127 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ <h3 class="panel-title"><%= Spree.t(:summary) %></h3>
4
+ </div>
5
+
6
+ <table class="table table-condensed table-bordered" id="order_tab_summary" data-hook>
7
+ <tbody class="additional-info">
8
+ <tr>
9
+ <td id="order_status" width="35%" data-hook>
10
+ <strong><%= Spree.t(:status) %>:</strong>
11
+ </td>
12
+ <td>
13
+ <span class="state label label-<%= @order.state %>">
14
+ <%= Spree.t(@order.state, scope: :order_state) %>
15
+ </span>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <td data-hook='admin_order_tab_subtotal_title'>
20
+ <strong><%= Spree.t(:subtotal) %>:</strong>
21
+ </td>
22
+ <td id='item_total'>
23
+ <%= @order.display_item_total.to_html %>
24
+ </td>
25
+ </tr>
26
+
27
+ <% if @order.checkout_steps.include?("delivery") && @order.ship_total > 0 %>
28
+ <tr>
29
+ <td data-hook='admin_order_tab_ship_total_title'>
30
+ <strong><%= Spree.t(:ship_total) %>:</strong>
31
+ </td>
32
+ <td id='ship_total'>
33
+ <%= @order.display_ship_total.to_html %>
34
+ </td>
35
+ </tr>
36
+ <% end %>
37
+
38
+ <% if @order.included_tax_total != 0 %>
39
+ <tr>
40
+ <td data-hook='admin_order_tab_included_tax_title'>
41
+ <strong><%= Spree.t(:tax_included) %>:</strong>
42
+ </td>
43
+ <td id='included_tax_total'>
44
+ <%= @order.display_included_tax_total.to_html %>
45
+ </td>
46
+ </tr>
47
+ <% end %>
48
+
49
+ <% if @order.additional_tax_total != 0 %>
50
+ <tr>
51
+ <td data-hook='admin_order_tab_additional_tax_title'>
52
+ <strong><%= Spree.t(:tax) %>:</strong>
53
+ </td>
54
+ <td id='additional_tax_total'>
55
+ <%= @order.display_additional_tax_total.to_html %>
56
+ </td>
57
+ </tr>
58
+ <% end %>
59
+
60
+ <tr>
61
+ <td data-hook='admin_order_tab_total_title'>
62
+ <strong><%= Spree.t(:total) %>:</strong>
63
+ </td>
64
+ <td id='order_total'><%= @order.display_total.to_html %></td>
65
+ </tr>
66
+
67
+ <% if @order.completed? %>
68
+ <tr>
69
+ <td>
70
+ <strong><%= Spree.t(:shipment) %>:</strong>
71
+ </td>
72
+ <td id='shipment_status'>
73
+ <span class="state label label-<%= @order.shipment_state %>">
74
+ <%= Spree.t(@order.shipment_state, scope: :shipment_states, default: [:missing, "none"]) %>
75
+ </span>
76
+ </td>
77
+ </tr>
78
+ <tr>
79
+ <td>
80
+ <strong><%= Spree.t(:payment) %>:</strong>
81
+ </td>
82
+ <td id='payment_status'>
83
+ <% if @order.payments.count > 0 && @order.payments.last.source.present? %>
84
+ <% if @order.payments.last.after_pay_method? && @order.payments.last.authorized? %>
85
+ <span class="label label-authorized">authorized</span>
86
+ <% else %>
87
+ <span class="label label-<%= @order.payments.last.source.status %>"><%= @order.payments.last.source.status %></span>
88
+ <% end %>
89
+ <% end %>
90
+ </td>
91
+ </tr>
92
+ <tr>
93
+ <td data-hook='admin_order_tab_date_completed_title'>
94
+ <strong><%= Spree.t(:date_completed) %>:</strong>
95
+ </td>
96
+ <td id='date_complete'>
97
+ <%= pretty_time(@order.completed_at) %>
98
+ </td>
99
+ </tr>
100
+ <% end %>
101
+
102
+ <% if @order.approved? %>
103
+ <tr>
104
+ <td><strong><%= Spree.t(:approver) %></strong></td>
105
+ <td><%= @order.approver.try(:email) %></td>
106
+ </tr>
107
+ <tr>
108
+ <td><strong><%= Spree.t(:approved_at) %></strong></td>
109
+ <td><%= pretty_time(@order.approved_at) %></td>
110
+ </tr>
111
+ <% end %>
112
+
113
+ <% if @order.canceled? && @order.canceler && @order.canceled_at %>
114
+ <tr>
115
+ <td><strong><%= Spree.t(:canceler) %></strong></td>
116
+ <td><%= @order.canceler.email %></td>
117
+ </tr>
118
+ <tr>
119
+ <td><strong><%= Spree.t(:canceled_at) %></strong></td>
120
+ <td><%= pretty_time(@order.canceled_at) %></td>
121
+ </tr>
122
+ <% end %>
123
+ </tbody>
124
+ </table>
125
+ </div>
126
+
127
+ <%= render 'spree/admin/shared/styles' %>
@@ -0,0 +1,13 @@
1
+ <style type="text/css">
2
+ .label.label-authorized {
3
+ background: orange;
4
+ }
5
+
6
+ .label.label-created {
7
+ background: #dcd2dd;
8
+ }
9
+
10
+ .label.label-created a {
11
+ color: #2E2F30;
12
+ }
13
+ </style>
@@ -1,3 +1,3 @@
1
1
  module SpreeMollieGateway
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_mollie_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vernon de Goede
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_backend
@@ -327,8 +327,11 @@ files:
327
327
  - app/models/spree/payment_method_decorator.rb
328
328
  - app/models/spree/shipment_decorator.rb
329
329
  - app/models/spree/user_decorator.rb
330
+ - app/views/spree/admin/orders/index.html.erb
330
331
  - app/views/spree/admin/payments/source_forms/_molliegateway.html.erb
331
332
  - app/views/spree/admin/payments/source_views/_molliegateway.html.erb
333
+ - app/views/spree/admin/shared/_order_summary.html.erb
334
+ - app/views/spree/admin/shared/_styles.html.erb
332
335
  - app/views/spree/api/v1/orders/complete.v1.rabl
333
336
  - app/views/spree/api/v1/orders/payment.v1.rabl
334
337
  - app/views/spree/checkout/payment/_molliegateway.html.erb