caboose-cms 0.8.2 → 0.8.3
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/controllers/caboose/checkout_controller.rb +7 -6
- data/app/models/caboose/invoice.rb +20 -13
- data/app/models/caboose/invoice_pdf.rb +16 -1
- data/app/models/caboose/invoice_transaction.rb +7 -3
- data/app/models/caboose/schema.rb +1 -0
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d5cc03f095f6a467229dda391c16f4962178e2
|
4
|
+
data.tar.gz: d64140a217254a3448a187fcfb45f65b4cf88901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5621d9560cbdb4e1c3afdcc9d5bb54f4b2b67008f63df9588ad0cafffde2eee6e9615610a72f17615c254722a396c80c4752ae4427ac8d0347ec066e31551795
|
7
|
+
data.tar.gz: 2cfde0d9ec65389b5d93fb9e85d19a5f5f6fe5a93771890eec23ed9d46bb1d97119599636aa639d4feb0cd0c04b6b0bf4ef5ff5194a99b4df22e41e46e97296b
|
@@ -203,12 +203,13 @@ module Caboose
|
|
203
203
|
return
|
204
204
|
end
|
205
205
|
ot = Caboose::InvoiceTransaction.create(
|
206
|
-
:invoice_id
|
207
|
-
:transaction_id
|
208
|
-
:transaction_type
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
206
|
+
:invoice_id => @invoice.id,
|
207
|
+
:transaction_id => c.id,
|
208
|
+
:transaction_type => c.captured ? Caboose::InvoiceTransaction::TYPE_AUTHCAP : Caboose::InvoiceTransaction::TYPE_AUTHORIZE,
|
209
|
+
:payment_processor => sc.pp_name,
|
210
|
+
:amount => c.amount/100.0,
|
211
|
+
:date_processed => DateTime.now.utc,
|
212
|
+
:success => c.status == 'succeeded'
|
212
213
|
)
|
213
214
|
end
|
214
215
|
|
@@ -306,14 +306,15 @@ module Caboose
|
|
306
306
|
# response = transaction.prior_auth_capture(t.transaction_id, self.total)
|
307
307
|
#
|
308
308
|
# ot = Caboose::InvoiceTransaction.create(
|
309
|
-
# :invoice_id
|
310
|
-
# :date_processed
|
311
|
-
# :transaction_type
|
312
|
-
# :
|
313
|
-
# :
|
314
|
-
# :
|
315
|
-
# :
|
316
|
-
# :
|
309
|
+
# :invoice_id => self.id,
|
310
|
+
# :date_processed => DateTime.now.utc,
|
311
|
+
# :transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
312
|
+
# :payment_processor => sc.pp_name,
|
313
|
+
# :amount => self.total,
|
314
|
+
# :success => response.response_code && response.response_code == '1',
|
315
|
+
# :transaction_id => response.transaction_id,
|
316
|
+
# :auth_code => response.authorization_code,
|
317
|
+
# :response_code => response.response_code
|
317
318
|
# )
|
318
319
|
# if ot.success
|
319
320
|
# self.date_captured = DateTime.now.utc
|
@@ -343,7 +344,8 @@ module Caboose
|
|
343
344
|
InvoiceTransaction.create(
|
344
345
|
:invoice_id => self.id,
|
345
346
|
:transaction_id => bt.id,
|
346
|
-
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
347
|
+
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
348
|
+
:payment_processor => sc.pp_name,
|
347
349
|
:amount => bt.amount / 100,
|
348
350
|
:date_processed => DateTime.strptime(bt.created.to_s, '%s'),
|
349
351
|
:success => bt.status == 'succeeded' || bt.status == 'pending'
|
@@ -380,6 +382,7 @@ module Caboose
|
|
380
382
|
:invoice_id => self.id,
|
381
383
|
:date_processed => DateTime.now.utc,
|
382
384
|
:transaction_type => InvoiceTransaction::TYPE_VOID,
|
385
|
+
:payment_processor => sc.pp_name,
|
383
386
|
:amount => self.total
|
384
387
|
)
|
385
388
|
|
@@ -458,7 +461,8 @@ module Caboose
|
|
458
461
|
InvoiceTransaction.create(
|
459
462
|
:invoice_id => self.id,
|
460
463
|
:transaction_id => bt.id,
|
461
|
-
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
464
|
+
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
465
|
+
:payment_processor => sc.pp_name,
|
462
466
|
:amount => bt.amount / 100,
|
463
467
|
:date_processed => DateTime.strptime(bt.created.to_s, '%s'),
|
464
468
|
:success => bt.status == 'succeeded' || bt.status == 'pending'
|
@@ -656,7 +660,8 @@ module Caboose
|
|
656
660
|
auth_trans = InvoiceTransaction.create(
|
657
661
|
:invoice_id => self.id,
|
658
662
|
:transaction_id => c.id,
|
659
|
-
:transaction_type => c.captured ? InvoiceTransaction::TYPE_AUTHCAP : InvoiceTransaction::TYPE_AUTHORIZE,
|
663
|
+
:transaction_type => c.captured ? InvoiceTransaction::TYPE_AUTHCAP : InvoiceTransaction::TYPE_AUTHORIZE,
|
664
|
+
:payment_processor => sc.pp_name,
|
660
665
|
:amount => c.amount / 100.0,
|
661
666
|
:amount_refunded => c.amount_refunded,
|
662
667
|
:date_processed => DateTime.strptime(c.created.to_s, '%s'),
|
@@ -670,7 +675,8 @@ module Caboose
|
|
670
675
|
:invoice_id => self.id,
|
671
676
|
:parent_id => auth_trans.id,
|
672
677
|
:transaction_id => bt.id,
|
673
|
-
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
678
|
+
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
679
|
+
:payment_processor => sc.pp_name,
|
674
680
|
:amount => bt.amount / 100.0,
|
675
681
|
:date_processed => DateTime.strptime(bt.created.to_s, '%s'),
|
676
682
|
:success => bt.status == 'succeeded' || bt.status == 'pending'
|
@@ -684,7 +690,8 @@ module Caboose
|
|
684
690
|
:invoice_id => self.id,
|
685
691
|
:parent_id => auth_trans.id,
|
686
692
|
:transaction_id => r.id,
|
687
|
-
:transaction_type => InvoiceTransaction::TYPE_REFUND,
|
693
|
+
:transaction_type => InvoiceTransaction::TYPE_REFUND,
|
694
|
+
:payment_processor => sc.pp_name,
|
688
695
|
:amount => r.amount / 100.0,
|
689
696
|
:date_processed => DateTime.strptime(r.created.to_s, '%s'),
|
690
697
|
:success => r.status == 'succeeded' || r.status == 'pending'
|
@@ -38,7 +38,17 @@ module Caboose
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_card_details
|
41
|
-
|
41
|
+
|
42
|
+
#puts "--------------------------------------------------------------------"
|
43
|
+
#puts self.invoice.customer.card_brand
|
44
|
+
#puts "--------------------------------------------------------------------"
|
45
|
+
|
46
|
+
if self.invoice.customer.card_brand
|
47
|
+
self.card_type = self.invoice.customer.card_brand
|
48
|
+
self.card_number = self.invoice.customer.card_last4
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
42
52
|
sc = self.invoice.site.store_config
|
43
53
|
ot = self.invoice.invoice_transactions.where(:transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first
|
44
54
|
|
@@ -57,6 +67,11 @@ module Caboose
|
|
57
67
|
self.card_type = ""
|
58
68
|
self.card_number = ""
|
59
69
|
end
|
70
|
+
|
71
|
+
when 'stripe'
|
72
|
+
|
73
|
+
self.card_type = self.invoice.customer.card_brand
|
74
|
+
self.card_number = self.invoice.customer.card_last4
|
60
75
|
|
61
76
|
end
|
62
77
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
module Caboose
|
2
3
|
class InvoiceTransaction < ActiveRecord::Base
|
3
4
|
self.table_name = 'store_invoice_transactions'
|
@@ -7,9 +8,10 @@ module Caboose
|
|
7
8
|
belongs_to :parent, :class_name => 'Caboose::InvoiceTransaction', :foreign_key => :parent_id
|
8
9
|
attr_accessible :id,
|
9
10
|
:invoice_id,
|
10
|
-
:parent_id,
|
11
|
+
:parent_id,
|
11
12
|
:transaction_id,
|
12
13
|
:transaction_type,
|
14
|
+
:payment_processor,
|
13
15
|
:amount,
|
14
16
|
:amount_refunded,
|
15
17
|
:auth_code,
|
@@ -74,7 +76,8 @@ module Caboose
|
|
74
76
|
:invoice_id => self.invoice_id,
|
75
77
|
:parent_id => self.id,
|
76
78
|
:transaction_id => bt.id,
|
77
|
-
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
79
|
+
:transaction_type => InvoiceTransaction::TYPE_CAPTURE,
|
80
|
+
:payment_processor => sc.pp_name,
|
78
81
|
:amount => bt.amount / 100.0,
|
79
82
|
:date_processed => DateTime.strptime(bt.created.to_s, '%s'),
|
80
83
|
:success => bt.status == 'succeeded' || bt.status == 'pending'
|
@@ -126,7 +129,8 @@ module Caboose
|
|
126
129
|
:invoice_id => self.invoice_id,
|
127
130
|
:parent_id => self.id,
|
128
131
|
:transaction_id => r.id,
|
129
|
-
:transaction_type => InvoiceTransaction::TYPE_REFUND,
|
132
|
+
:transaction_type => InvoiceTransaction::TYPE_REFUND,
|
133
|
+
:payment_processor => sc.pp_name,
|
130
134
|
:amount => r.amount / 100.0,
|
131
135
|
:date_processed => DateTime.strptime(r.created.to_s, '%s'),
|
132
136
|
:success => r.status == 'succeeded' || r.status == 'pending'
|
@@ -392,6 +392,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
392
392
|
[ :parent_id , :integer ],
|
393
393
|
[ :date_processed , :datetime ],
|
394
394
|
[ :transaction_type , :string ],
|
395
|
+
[ :payment_processor , :string ],
|
395
396
|
[ :amount , :decimal , { :precision => 8, :scale => 2 }],
|
396
397
|
[ :amount_refunded , :decimal , { :precision => 8, :scale => 2 }],
|
397
398
|
[ :transaction_id , :string ],
|
data/lib/caboose/version.rb
CHANGED
data/lib/tasks/caboose.rake
CHANGED
@@ -108,7 +108,8 @@ namespace :caboose do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
desc "Compare routes in controllers with routes in the routes file"
|
111
|
-
task :compare_routes, [:arg1, :arg2] => :environment do |t, args|
|
111
|
+
task :compare_routes, [:arg1, :arg2] => :environment do |t, args|
|
112
|
+
# controller, route_file
|
112
113
|
Caboose::CommentRoutes.compare_routes(args[:arg1], args[:arg2])
|
113
114
|
end
|
114
115
|
|