effective_orders 5.4.4 → 5.5.0
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 +4 -4
- data/app/models/effective/order.rb +22 -6
- data/lib/effective_orders/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c608a4f1f72b5f82b0afe786bcc71ba8b951ff22e121ae2e2492afa08410966
|
4
|
+
data.tar.gz: fd836b344d52cb4cc9047aecc243dc2bf43d2b7b69bc0524331449e005e49789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7a575224a3cfbcbc271dcbce0f6e4b8d4943995696a3a57372356747faea7b454df6a2202d6c0b9a1ec55b8296ae78511665111841117066f4d2f4366881a4
|
7
|
+
data.tar.gz: d84ada9221fb3c57d2d92254e9925641a53a5bf772b143373616e239f22c4d52b88d131d9983d94a2d57e81cbdccf761a33e0e99d5da0941c7f462eff78307a1
|
@@ -335,6 +335,18 @@ module Effective
|
|
335
335
|
else payment_card.to_s
|
336
336
|
end
|
337
337
|
|
338
|
+
# Try again
|
339
|
+
if card == 'none' && payment['card_type'].present?
|
340
|
+
card = case payment['card_type'].to_s.downcase.gsub(' ', '').strip
|
341
|
+
when '' then nil
|
342
|
+
when 'v', 'visa' then 'Visa'
|
343
|
+
when 'm', 'mc', 'master', 'mastercard' then 'MasterCard'
|
344
|
+
when 'a', 'ax', 'american', 'americanexpress' then 'American Express'
|
345
|
+
when 'd', 'discover' then 'Discover'
|
346
|
+
else payment_card.to_s
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
338
350
|
last4 = if payment[:active_card] && payment[:active_card].include?('**** **** ****')
|
339
351
|
payment[:active_card][15,4]
|
340
352
|
end
|
@@ -486,14 +498,18 @@ module Effective
|
|
486
498
|
|
487
499
|
# Effective::Order.new(items: Product.first, user: User.first).purchase!(email: false)
|
488
500
|
def purchase!(payment: 'none', provider: 'none', card: 'none', email: true, skip_buyer_validations: false, skip_quickbooks: false)
|
501
|
+
return true if purchased?
|
502
|
+
|
489
503
|
# Assign attributes
|
490
|
-
|
491
|
-
|
504
|
+
assign_attributes(
|
505
|
+
state: EffectiveOrders::PURCHASED,
|
506
|
+
skip_buyer_validations: skip_buyer_validations,
|
492
507
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
508
|
+
payment_provider: provider,
|
509
|
+
payment_card: (card.presence || 'none'),
|
510
|
+
purchased_at: Time.zone.now,
|
511
|
+
payment: payment_to_h(payment)
|
512
|
+
)
|
497
513
|
|
498
514
|
begin
|
499
515
|
Effective::Order.transaction do
|