effective_orders 5.1.11 → 5.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4ceb232058ad48722e375f9ada63ee99219ca2c6e4171ebc4be851dc5218518
4
- data.tar.gz: a7ec1aabca5e20e22d834a6d9bca6a3efc277f2b2aabc03f888d274145fbaa80
3
+ metadata.gz: 889ffac4a7ea9e9402e87b841af4d28b6720e23f512dde7ba4f51978b3ebb045
4
+ data.tar.gz: 23a247aeb17a3dc13416ac428e9fdaf00bf4d58384b20f3f45d55e705924028c
5
5
  SHA512:
6
- metadata.gz: d04a7b6902627945ecfae1c56b2133a3dba96b586a6f8eea8b61327de03c84c6e6cddbd374eff1b21d0030625014c5ab0471fb96ea7a37058373853d5be189c4
7
- data.tar.gz: 95d763d0f61864d12fc6fde4a27f884af573ac218ea0f4947f7c00e8410308c6fd42d996519eb4b5872d19d79c67ca6ce68c5be1316468be451cf96a5f721213
6
+ metadata.gz: cc23bc2d1e8dd91ea835e18a2e8bb2a0af4d9401b8d4dcdd178a62bf8a36f233a30287c848d97aaceb39875986f00616533d24c610dcdc328548883908e2b68e
7
+ data.tar.gz: 1d9c8baf3fb9f140123d7829225f4180e2d202a911f5fc695f9f39289e89af585ae60b569900b7c551ddc3e2eee40c78c4d8579975b702a41c9987c706ae24a2
@@ -17,8 +17,10 @@ class Admin::EffectiveOrdersDatatable < Effective::Datatable
17
17
  unless attributes[:skip_filters]
18
18
  scope :all
19
19
  scope :purchased
20
- scope :deferred
21
- scope :refunds
20
+
21
+ scope :deferred if EffectiveOrders.deferred_providers.present?
22
+ scope :refunds if EffectiveOrders.refund
23
+
22
24
  scope :not_purchased
23
25
  end
24
26
  end
@@ -4,8 +4,11 @@ class EffectiveOrdersDatatable < Effective::Datatable
4
4
  filters do
5
5
  unless attributes[:not_purchased]
6
6
  scope :purchased, default: true
7
- scope :deferred
8
- scope :refunds
7
+
8
+ scope :deferred if EffectiveOrders.deferred_providers.present?
9
+ scope :refunds if EffectiveOrders.refund
10
+
11
+ scope :all
9
12
  end
10
13
  end
11
14
 
@@ -43,7 +43,7 @@ module Effective
43
43
  @order = (order_param.kind_of?(Effective::Order) ? order_param : Effective::Order.find(order_param))
44
44
  @user = @order.user
45
45
 
46
- @subject = subject_for(@order, :payment_request_to_buyer, "Request for Payment: Invoice ##{@order.to_param}")
46
+ @subject = subject_for(@order, :payment_request_to_buyer, "Payment request - Order ##{@order.to_param}")
47
47
 
48
48
  mail({to: @order.email, cc: @order.cc, subject: @subject}.compact)
49
49
  end
@@ -265,14 +265,30 @@ module Effective
265
265
  end
266
266
 
267
267
  def label
268
- if refund?
269
- "Refund"
268
+ if refund? && purchased?
269
+ 'Refund'
270
270
  elsif purchased?
271
- "Receipt"
272
- elsif pending?
273
- "Pending Order"
271
+ 'Receipt'
272
+ elsif refund? && (pending? || confirmed?)
273
+ 'Pending Refund'
274
+ elsif (pending? || confirmed?)
275
+ 'Pending Order'
274
276
  else
275
- "Order"
277
+ 'Order'
278
+ end
279
+ end
280
+
281
+ def total_label
282
+ if refund? && purchased?
283
+ 'Total Paid'
284
+ elsif purchased?
285
+ 'Total Paid'
286
+ elsif refund? && (pending? || confirmed?)
287
+ 'Total Due'
288
+ elsif (pending? || confirmed?)
289
+ 'Total Due'
290
+ else
291
+ 'Total'
276
292
  end
277
293
  end
278
294
 
@@ -372,15 +388,20 @@ module Effective
372
388
  end
373
389
 
374
390
  def send_order_receipt_to_admin?
375
- EffectiveOrders.mailer[:send_order_receipt_to_admin] && !free?
391
+ return false if free? && !EffectiveOrders.mailer[:send_order_receipts_when_free]
392
+ EffectiveOrders.mailer[:send_order_receipt_to_admin]
376
393
  end
377
394
 
378
395
  def send_order_receipt_to_buyer?
379
- EffectiveOrders.mailer[:send_order_receipt_to_buyer] && !free?
396
+ return false if free? && !EffectiveOrders.mailer[:send_order_receipts_when_free]
397
+ EffectiveOrders.mailer[:send_order_receipt_to_buyer]
380
398
  end
381
399
 
382
400
  def send_payment_request_to_buyer?
383
- EffectiveResources.truthy?(send_payment_request_to_buyer) && !free? && !refund?
401
+ return false if free? && !EffectiveOrders.mailer[:send_order_receipts_when_free]
402
+ return false if refund?
403
+
404
+ EffectiveResources.truthy?(send_payment_request_to_buyer)
384
405
  end
385
406
 
386
407
  def send_mark_as_paid_email_to_buyer?
@@ -62,11 +62,6 @@
62
62
  %th.download
63
63
 
64
64
  %th.total
65
- - if order.pending?
66
- Amount Due
67
- - elsif order.purchased?
68
- Amount Paid
69
- - else
70
- Total
65
+ = order.total_label
71
66
 
72
67
  %td.price.total-price= price_to_currency(order.total)
@@ -5,10 +5,7 @@
5
5
  = order.refund? ? 'Complete Refund' : 'Mark as Paid'
6
6
 
7
7
  = effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
8
- - if order.refund?
9
- = f.hidden_field :purchased_at, value: Time.zone.now
10
- - else
11
- = f.date_field :purchased_at, required: true
8
+ = f.hidden_field :purchased_at, value: Time.zone.now
12
9
 
13
10
  = f.select :payment_provider, EffectiveOrders.payment_providers, required: true
14
11
 
@@ -95,6 +95,7 @@ EffectiveOrders.setup do |config|
95
95
  send_payment_request_to_buyer: true,
96
96
  send_pending_order_invoice_to_buyer: true,
97
97
  send_order_receipts_when_mark_as_paid: false,
98
+ send_order_receipts_when_free: false,
98
99
 
99
100
  send_subscription_event_to_admin: true,
100
101
  send_subscription_created: true,
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '5.1.11'.freeze
2
+ VERSION = '5.1.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.11
4
+ version: 5.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails