lolita-first-data 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{LICENSE.txt → MIT-LICENSE} +1 -1
- data/README.md +8 -89
- data/Rakefile +22 -45
- data/app/controllers/lolita_first_data/application_controller.rb +23 -0
- data/app/controllers/lolita_first_data/test_controller.rb +73 -0
- data/app/controllers/lolita_first_data/transactions_controller.rb +63 -0
- data/app/models/lolita_first_data/transaction.rb +45 -0
- data/config/locales/en.yml +109 -109
- data/config/locales/lv.yml +109 -109
- data/config/routes.rb +5 -5
- data/lib/generators/lolita_first_data/install_generator.rb +13 -14
- data/lib/generators/lolita_first_data/templates/migration.rb +21 -21
- data/lib/lolita-first-data.rb +25 -6
- data/lib/lolita_first_data/billing.rb +82 -0
- data/lib/lolita_first_data/custom_logger.rb +8 -0
- data/lib/lolita_first_data/engine.rb +5 -0
- data/lib/lolita_first_data/version.rb +3 -0
- data/lib/tasks/lolita_first_data_tasks.rake +4 -0
- metadata +100 -102
- data/.rspec +0 -2
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -140
- data/VERSION +0 -1
- data/app/controllers/lolita/first_data/common_controller.rb +0 -25
- data/app/controllers/lolita/first_data/test_controller.rb +0 -78
- data/app/controllers/lolita/first_data/transaction_controller.rb +0 -49
- data/app/models/lolita/first_data/transaction.rb +0 -55
- data/lib/lolita-first-data/billing.rb +0 -37
- data/lib/lolita-first-data/custom_logger.rb +0 -10
- data/lib/lolita-first-data/gateway.rb +0 -160
- data/lib/lolita-first-data/rails.rb +0 -6
- data/lib/tasks/first_data_tasks.rake +0 -78
- data/lolita-first-data.gemspec +0 -95
- data/spec/cert.pem +0 -63
- data/spec/fabricators/reservation_fabricator.rb +0 -4
- data/spec/fabricators/transaction_fabricator.rb +0 -7
- data/spec/first_data_spec.rb +0 -67
- data/spec/spec_helper.rb +0 -101
- data/spec/support/rails.rb +0 -16
data/config/locales/lv.yml
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
-
lv:
|
2
|
-
fd:
|
3
|
-
unknown_error: nezināma kļūda
|
4
|
-
no_trans_id: Nav transakcijas ID
|
5
|
-
wrong_request: Nepareizs pieprasījums
|
6
|
-
purchase_failed: "Neizdevās izveidot maksājumu, lūdzu mēģiniet vēlreiz."
|
7
|
-
response:
|
8
|
-
code_914: "Atteikts, nevar atgriezties pie\n oriģinālās transakcijas"
|
9
|
-
code_003: "Apstirināts VIP"
|
10
|
-
code_102: "Atteikts, aizdomas par krāpniecību"
|
11
|
-
code_201: "Atņemt, beidzies kartes derīguma termiņš"
|
12
|
-
code_300: "Status message: file action successful"
|
13
|
-
code_123: "Atteikts, pārsniegts naudas\n izdošanas biežuma limits"
|
14
|
-
code_XXX: "Code to be replaced by card status code or stoplist insertion reason code"
|
15
|
-
code_915: "Atteikts, rekonsilācijas pārslēgšana\n vai kontrolpunkta kļūda"
|
16
|
-
code_004: "Apstiprināts, koriģēts 3 celiņš"
|
17
|
-
code_103: "Atteikts, kartes pieņēmējam\n jāsazinās ar pieņēmējbanku"
|
18
|
-
code_202: "Atņemt, aizdomas par krāpšanu"
|
19
|
-
code_301: "Status message: file action not supported by receiver"
|
20
|
-
code_400: "Apstiprināts (Reversēšanai)"
|
21
|
-
code_124: "Atteikts, likuma pārkāpums"
|
22
|
-
code_916: "Atteikts, nepareizs MAC"
|
23
|
-
code_005: "Apstiprināts, konta tipu norāda\n kartes izdevējs"
|
24
|
-
code_104: "Atteiks, karte ar ierobežojumu"
|
25
|
-
code_203: "Atņemt, kartes pieņēmējam jāsazinās\n ar pieņēmējbanku"
|
26
|
-
code_302: "Status message: unable to locate record on file"
|
27
|
-
code_500: "Status message: reconciled, in balance"
|
28
|
-
code_125: "Atteikts, karte nav derīga"
|
29
|
-
code_917: "Atteikts, MAC atslēgu\n sinhronizācijas kļūda"
|
30
|
-
code_600: "Apstiprināts (Administratīvais info)"
|
31
|
-
code_126: "Atteikts, nepareizs PIN bloks"
|
32
|
-
code_006: "Apstiprināts par daļēju summu, konta\n tipu norāda kartes izdevējs"
|
33
|
-
code_105: "Atteikts, kartes pieņēmējam jāzvana\n izdevējbankas drošības departamentam"
|
34
|
-
code_204: "Atņemt, karte ar ierobežojumiem"
|
35
|
-
code_303: "Status message: duplicate record, old record replaced"
|
36
|
-
code_501: "Status message: reconciled, out of balance"
|
37
|
-
code_700: "Apstiprināts (komisiju savākšana)"
|
38
|
-
code_601: "Status message: impossible to trace back original transaction"
|
39
|
-
code_007: "Apstiprināts, koriģēts ICC"
|
40
|
-
code_106: "Atteikts, pieļaujamais PIN\n ievadīšanas skaits izsmelts"
|
41
|
-
code_205: "Atņemt, kartes pieņēmējam jāzvana\n izdevējbankas drošības departamentam"
|
42
|
-
code_304: "Status message: file record field edit error"
|
43
|
-
code_502: "Status message: amount not reconciled, totals provided"
|
44
|
-
code_127: "Atteikts, PIN garuma kļūda"
|
45
|
-
code_920: "Atteikts, drošības programmatūras\n kļūda, mēģiniet atkārtoti"
|
46
|
-
code_918: "Atteikts, nav\n lietojamu transporta atslēgu "
|
47
|
-
code_800: "Apstiprināts (Tīkla vadībai)"
|
48
|
-
code_602: "Status message: invalid transaction reference number"
|
49
|
-
code_107: "Atteikts, griezties pie kartes\n izdevējbankas"
|
50
|
-
code_206: "Atņemt, pārsniegts atļauto PIN\n ievažu skaits"
|
51
|
-
code_305: "Status message: file locked out"
|
52
|
-
code_503: "Status message: totals for reconciliation not available"
|
53
|
-
code_128: "Atteikts, PIN atslēgu sinhronizācijas kļūda"
|
54
|
-
code_921: "Atteikts, drošības programmatūras kļūda"
|
55
|
-
code_919: "Atteikts, kriptēšanas atslēgu\n sinhronizācijas kļūda"
|
56
|
-
code_900: "Paziņojums atzīts, pieņemt bez\n finansiālas atbildības"
|
57
|
-
code_603: "Status message: reference number/PAN incompatible"
|
58
|
-
code_108: "Atteikts, griezties pie kartes\n izdevējbankas, īpaši nosacījumi"
|
59
|
-
code_207: "Atņemt, īpaši nosacījumi"
|
60
|
-
code_306: "Status message: file action not successful"
|
61
|
-
code_504: "Status message: not reconciled, totals provided"
|
62
|
-
code_129: "Atteikts, aizdomas par kartes viltojumu"
|
63
|
-
code_922: "Atteikts, ziņojuma numurs neatbilst\n secībai"
|
64
|
-
code_901: "Paziņojums atzīts, pieņemt ar\n finansiālu atbildību"
|
65
|
-
code_604: "Status message: POS photograph is not available"
|
66
|
-
code_110: "Atteikts, nepareiza summa"
|
67
|
-
code_109: "Atteikts, nepareizs tirgotājs"
|
68
|
-
code_208: "Atņemt, pazaudēta karte"
|
69
|
-
code_307: "Status message: file data format error"
|
70
|
-
code_923: "Pieprasījums tiek apstrādāts"
|
71
|
-
code_902: "Atteikts, nepareiza transakcija"
|
72
|
-
code_605: "Status message: requested item supplied"
|
73
|
-
code_111: "Atteikts, nepareizs kartes numurs"
|
74
|
-
code_210: "Atņemt, aizdomas par kartes viltojumu"
|
75
|
-
code_209: "Atņemt, zagta karte"
|
76
|
-
code_308: "Status message: duplicate record, new record rejected"
|
77
|
-
code_903: "Vēlreiz ievadi transakciju"
|
78
|
-
code_606: "Status message: request cannot be\n fulfilled - required documentation is not available"
|
79
|
-
code_112: "Atteikts, PIN dati nepieciešami"
|
80
|
-
code_309: "Status message: unknown file"
|
81
|
-
code_197: "Atteikts, zvaniet AMEX"
|
82
|
-
code_904: "Atteikts, formāta kļūda"
|
83
|
-
code_113: "Atteikts, nepieņemama komisija"
|
84
|
-
code_198: "Atteikts, zvaniet Karšu apstrādes centram"
|
85
|
-
code_905: "Atteikts, pieņēmējbankai nav pieslēguma"
|
86
|
-
code_114: "Atteikts, nav pieprasīts konta tips"
|
87
|
-
code_906: "Atteikts, notiek pārslēgšana"
|
88
|
-
code_115: "Atteikts, pieprasītā funkcija netiek\n atbalstīta"
|
89
|
-
code_950: "Atteikts, biznesa vienošanās pārkāpums"
|
90
|
-
code_116: "Atteikts, nepietiek līdzekļu"
|
91
|
-
code_907: "Atteikts, nedarbojas izdevējbanka\n vai pieslēgums"
|
92
|
-
code_117: "Atteikts, nepareizs PIN kods"
|
93
|
-
code_910: "Atteikts, kartes izdevējbankas izslēgta"
|
94
|
-
code_908: "Atteikts, nevar atrast\n transakcijas adresātu"
|
95
|
-
code_118: "Atteikts, nav kartes ieraksta"
|
96
|
-
code_911: "Atteikts, kartes izdevējbanka\n laicīgi nesniedz atbildi"
|
97
|
-
code_909: "Atteikts, sistēmas nepareiza darbība"
|
98
|
-
code_000: "Apstiprināts"
|
99
|
-
code_120: "Atteikts, transakcija nav atļauta\n terminālam"
|
100
|
-
code_119: "Atteikts, transakcija nav atļauta\n kartes lietotājam"
|
101
|
-
code_912: "Atteikts, kartes izdevējbankas nav\n sasniedzama"
|
102
|
-
code_001: "Apstiprināts, ja var apliecināt identitāti"
|
103
|
-
code_100: "Atteikts (Vispārīgs, bez komentāriem)"
|
104
|
-
code_121: "Atteikts, pārsniegts naudas\n izdošanas limits"
|
105
|
-
code_913: "Atteikts, dubulta pārraide"
|
106
|
-
code_002: "Apstiprināts par daļēju summu"
|
107
|
-
code_101: "Atteikts, beidzies kartes derīguma termiņš"
|
108
|
-
code_200: "Atņemt karti (Vispārīgs, bez komnetāriem)"
|
109
|
-
code_122: "Atteikts, drošības pārkāpums"
|
1
|
+
lv:
|
2
|
+
fd:
|
3
|
+
unknown_error: nezināma kļūda
|
4
|
+
no_trans_id: Nav transakcijas ID
|
5
|
+
wrong_request: Nepareizs pieprasījums
|
6
|
+
purchase_failed: "Neizdevās izveidot maksājumu, lūdzu mēģiniet vēlreiz."
|
7
|
+
response:
|
8
|
+
code_914: "Atteikts, nevar atgriezties pie\n oriģinālās transakcijas"
|
9
|
+
code_003: "Apstirināts VIP"
|
10
|
+
code_102: "Atteikts, aizdomas par krāpniecību"
|
11
|
+
code_201: "Atņemt, beidzies kartes derīguma termiņš"
|
12
|
+
code_300: "Status message: file action successful"
|
13
|
+
code_123: "Atteikts, pārsniegts naudas\n izdošanas biežuma limits"
|
14
|
+
code_XXX: "Code to be replaced by card status code or stoplist insertion reason code"
|
15
|
+
code_915: "Atteikts, rekonsilācijas pārslēgšana\n vai kontrolpunkta kļūda"
|
16
|
+
code_004: "Apstiprināts, koriģēts 3 celiņš"
|
17
|
+
code_103: "Atteikts, kartes pieņēmējam\n jāsazinās ar pieņēmējbanku"
|
18
|
+
code_202: "Atņemt, aizdomas par krāpšanu"
|
19
|
+
code_301: "Status message: file action not supported by receiver"
|
20
|
+
code_400: "Apstiprināts (Reversēšanai)"
|
21
|
+
code_124: "Atteikts, likuma pārkāpums"
|
22
|
+
code_916: "Atteikts, nepareizs MAC"
|
23
|
+
code_005: "Apstiprināts, konta tipu norāda\n kartes izdevējs"
|
24
|
+
code_104: "Atteiks, karte ar ierobežojumu"
|
25
|
+
code_203: "Atņemt, kartes pieņēmējam jāsazinās\n ar pieņēmējbanku"
|
26
|
+
code_302: "Status message: unable to locate record on file"
|
27
|
+
code_500: "Status message: reconciled, in balance"
|
28
|
+
code_125: "Atteikts, karte nav derīga"
|
29
|
+
code_917: "Atteikts, MAC atslēgu\n sinhronizācijas kļūda"
|
30
|
+
code_600: "Apstiprināts (Administratīvais info)"
|
31
|
+
code_126: "Atteikts, nepareizs PIN bloks"
|
32
|
+
code_006: "Apstiprināts par daļēju summu, konta\n tipu norāda kartes izdevējs"
|
33
|
+
code_105: "Atteikts, kartes pieņēmējam jāzvana\n izdevējbankas drošības departamentam"
|
34
|
+
code_204: "Atņemt, karte ar ierobežojumiem"
|
35
|
+
code_303: "Status message: duplicate record, old record replaced"
|
36
|
+
code_501: "Status message: reconciled, out of balance"
|
37
|
+
code_700: "Apstiprināts (komisiju savākšana)"
|
38
|
+
code_601: "Status message: impossible to trace back original transaction"
|
39
|
+
code_007: "Apstiprināts, koriģēts ICC"
|
40
|
+
code_106: "Atteikts, pieļaujamais PIN\n ievadīšanas skaits izsmelts"
|
41
|
+
code_205: "Atņemt, kartes pieņēmējam jāzvana\n izdevējbankas drošības departamentam"
|
42
|
+
code_304: "Status message: file record field edit error"
|
43
|
+
code_502: "Status message: amount not reconciled, totals provided"
|
44
|
+
code_127: "Atteikts, PIN garuma kļūda"
|
45
|
+
code_920: "Atteikts, drošības programmatūras\n kļūda, mēģiniet atkārtoti"
|
46
|
+
code_918: "Atteikts, nav\n lietojamu transporta atslēgu "
|
47
|
+
code_800: "Apstiprināts (Tīkla vadībai)"
|
48
|
+
code_602: "Status message: invalid transaction reference number"
|
49
|
+
code_107: "Atteikts, griezties pie kartes\n izdevējbankas"
|
50
|
+
code_206: "Atņemt, pārsniegts atļauto PIN\n ievažu skaits"
|
51
|
+
code_305: "Status message: file locked out"
|
52
|
+
code_503: "Status message: totals for reconciliation not available"
|
53
|
+
code_128: "Atteikts, PIN atslēgu sinhronizācijas kļūda"
|
54
|
+
code_921: "Atteikts, drošības programmatūras kļūda"
|
55
|
+
code_919: "Atteikts, kriptēšanas atslēgu\n sinhronizācijas kļūda"
|
56
|
+
code_900: "Paziņojums atzīts, pieņemt bez\n finansiālas atbildības"
|
57
|
+
code_603: "Status message: reference number/PAN incompatible"
|
58
|
+
code_108: "Atteikts, griezties pie kartes\n izdevējbankas, īpaši nosacījumi"
|
59
|
+
code_207: "Atņemt, īpaši nosacījumi"
|
60
|
+
code_306: "Status message: file action not successful"
|
61
|
+
code_504: "Status message: not reconciled, totals provided"
|
62
|
+
code_129: "Atteikts, aizdomas par kartes viltojumu"
|
63
|
+
code_922: "Atteikts, ziņojuma numurs neatbilst\n secībai"
|
64
|
+
code_901: "Paziņojums atzīts, pieņemt ar\n finansiālu atbildību"
|
65
|
+
code_604: "Status message: POS photograph is not available"
|
66
|
+
code_110: "Atteikts, nepareiza summa"
|
67
|
+
code_109: "Atteikts, nepareizs tirgotājs"
|
68
|
+
code_208: "Atņemt, pazaudēta karte"
|
69
|
+
code_307: "Status message: file data format error"
|
70
|
+
code_923: "Pieprasījums tiek apstrādāts"
|
71
|
+
code_902: "Atteikts, nepareiza transakcija"
|
72
|
+
code_605: "Status message: requested item supplied"
|
73
|
+
code_111: "Atteikts, nepareizs kartes numurs"
|
74
|
+
code_210: "Atņemt, aizdomas par kartes viltojumu"
|
75
|
+
code_209: "Atņemt, zagta karte"
|
76
|
+
code_308: "Status message: duplicate record, new record rejected"
|
77
|
+
code_903: "Vēlreiz ievadi transakciju"
|
78
|
+
code_606: "Status message: request cannot be\n fulfilled - required documentation is not available"
|
79
|
+
code_112: "Atteikts, PIN dati nepieciešami"
|
80
|
+
code_309: "Status message: unknown file"
|
81
|
+
code_197: "Atteikts, zvaniet AMEX"
|
82
|
+
code_904: "Atteikts, formāta kļūda"
|
83
|
+
code_113: "Atteikts, nepieņemama komisija"
|
84
|
+
code_198: "Atteikts, zvaniet Karšu apstrādes centram"
|
85
|
+
code_905: "Atteikts, pieņēmējbankai nav pieslēguma"
|
86
|
+
code_114: "Atteikts, nav pieprasīts konta tips"
|
87
|
+
code_906: "Atteikts, notiek pārslēgšana"
|
88
|
+
code_115: "Atteikts, pieprasītā funkcija netiek\n atbalstīta"
|
89
|
+
code_950: "Atteikts, biznesa vienošanās pārkāpums"
|
90
|
+
code_116: "Atteikts, nepietiek līdzekļu"
|
91
|
+
code_907: "Atteikts, nedarbojas izdevējbanka\n vai pieslēgums"
|
92
|
+
code_117: "Atteikts, nepareizs PIN kods"
|
93
|
+
code_910: "Atteikts, kartes izdevējbankas izslēgta"
|
94
|
+
code_908: "Atteikts, nevar atrast\n transakcijas adresātu"
|
95
|
+
code_118: "Atteikts, nav kartes ieraksta"
|
96
|
+
code_911: "Atteikts, kartes izdevējbanka\n laicīgi nesniedz atbildi"
|
97
|
+
code_909: "Atteikts, sistēmas nepareiza darbība"
|
98
|
+
code_000: "Apstiprināts"
|
99
|
+
code_120: "Atteikts, transakcija nav atļauta\n terminālam"
|
100
|
+
code_119: "Atteikts, transakcija nav atļauta\n kartes lietotājam"
|
101
|
+
code_912: "Atteikts, kartes izdevējbankas nav\n sasniedzama"
|
102
|
+
code_001: "Apstiprināts, ja var apliecināt identitāti"
|
103
|
+
code_100: "Atteikts (Vispārīgs, bez komentāriem)"
|
104
|
+
code_121: "Atteikts, pārsniegts naudas\n izdošanas limits"
|
105
|
+
code_913: "Atteikts, dubulta pārraide"
|
106
|
+
code_002: "Apstiprināts par daļēju summu"
|
107
|
+
code_101: "Atteikts, beidzies kartes derīguma termiņš"
|
108
|
+
code_200: "Atņemt karti (Vispārīgs, bez komnetāriem)"
|
109
|
+
code_122: "Atteikts, drošības pārkāpums"
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
get '/first_data/checkout' => 'lolita_first_data/transactions#checkout', as: 'checkout_first_data'
|
3
|
+
post '/first_data/answer' => 'lolita_first_data/transactions#answer', as: 'answer_first_data'
|
4
|
+
get '/first_data/test' => 'lolita_first_data/test#test'
|
5
|
+
end
|
@@ -1,14 +1,13 @@
|
|
1
|
-
module LolitaFirstData
|
2
|
-
module Generators
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
1
|
+
module LolitaFirstData
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
desc "Create migrations. "
|
6
|
+
|
7
|
+
def copy_migration
|
8
|
+
copy_file "migration.rb", "db/migrate/#{Time.now.strftime("%Y%m%d%H%M%S")}_create_lolita_first_data_transaction.rb"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
class CreateLolitaFirstDataTransaction < ActiveRecord::Migration
|
2
|
-
class << self
|
3
|
-
def up
|
4
|
-
create_table :first_data_transactions do |t|
|
5
|
-
t.string :transaction_id, :
|
6
|
-
t.string :transaction_code, :
|
7
|
-
t.string :status, :
|
8
|
-
t.references :paymentable, :
|
9
|
-
t.string :ip, :
|
10
|
-
|
11
|
-
t.timestamps
|
12
|
-
end
|
13
|
-
|
14
|
-
add_index :first_data_transactions, [:paymentable_type,:paymentable_id], :
|
15
|
-
end
|
16
|
-
|
17
|
-
def down
|
18
|
-
drop_table :first_data_transactions
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
class CreateLolitaFirstDataTransaction < ActiveRecord::Migration
|
2
|
+
class << self
|
3
|
+
def up
|
4
|
+
create_table :first_data_transactions do |t|
|
5
|
+
t.string :transaction_id, length: 28
|
6
|
+
t.string :transaction_code, length: 3
|
7
|
+
t.string :status, default: "processing"
|
8
|
+
t.references :paymentable, polymorphic: true
|
9
|
+
t.string :ip, length: 10
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :first_data_transactions, [:paymentable_type,:paymentable_id], name: "fd_trx_paymentable_type_paymentable_id"
|
15
|
+
end
|
16
|
+
|
17
|
+
def down
|
18
|
+
drop_table :first_data_transactions
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/lolita-first-data.rb
CHANGED
@@ -1,6 +1,25 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
require "ipaddr"
|
2
|
+
require "active_merchant_first_data"
|
3
|
+
require "lolita_first_data/engine"
|
4
|
+
require "lolita_first_data/version"
|
5
|
+
require "lolita_first_data/custom_logger"
|
6
|
+
require "lolita_first_data/billing"
|
7
|
+
|
8
|
+
module LolitaFirstData
|
9
|
+
mattr_accessor :custom_logger
|
10
|
+
|
11
|
+
def self.logger
|
12
|
+
unless @logger
|
13
|
+
@logger = custom_logger ? custom_logger : default_logger
|
14
|
+
end
|
15
|
+
@logger
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def self.default_logger
|
21
|
+
logger = Logger.new(Rails.root.join('log', 'lolita_first_data.log'))
|
22
|
+
logger.formatter = LolitaFirstData::LogFormatter.new
|
23
|
+
logger
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module LolitaFirstData
|
2
|
+
module Billing
|
3
|
+
def self.included(base)
|
4
|
+
base.has_many :first_data_transactions, as: :paymentable, class_name: 'LolitaFirstData::Transaction', dependent: :destroy
|
5
|
+
base.extend ClassMethods
|
6
|
+
base.class_eval do
|
7
|
+
|
8
|
+
# Payment description
|
9
|
+
def description
|
10
|
+
raise 'Redefine this method in your billing model.'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Price of payment in cents
|
14
|
+
def price
|
15
|
+
raise 'Redefine this method in your billing model.'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Currency as 3 letter code as in ISO 4217
|
19
|
+
def currency
|
20
|
+
raise 'Redefine this method in your billing model.'
|
21
|
+
end
|
22
|
+
|
23
|
+
def first_data_trx_saved trx
|
24
|
+
raise 'This should be inplemented on your paymentable class'
|
25
|
+
end
|
26
|
+
|
27
|
+
def first_data_return_path
|
28
|
+
raise 'This should be inplemented on your paymentable class'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Add this to your paid? method along with other payment methods
|
32
|
+
# Example:
|
33
|
+
# def paid?
|
34
|
+
# paypal_paid? || first_data_paid?
|
35
|
+
# end
|
36
|
+
def first_data_paid?
|
37
|
+
self.first_data_transactions.where(status: 'completed', transaction_code: '000').count >= 1
|
38
|
+
end
|
39
|
+
|
40
|
+
def first_data_error_message
|
41
|
+
if trx = first_data_transactions.last and trx.transaction_code != '000'
|
42
|
+
I18n.t("fd.response.code_#{trx.transaction_code}", default: I18n.t('fd.unknown_error'))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# web interface will open in this language
|
47
|
+
def first_data_language
|
48
|
+
I18n.locale.to_s.sub('-','_').downcase
|
49
|
+
end
|
50
|
+
|
51
|
+
# Reverses last completed transaction and updates status to reversed
|
52
|
+
def first_data_reverse
|
53
|
+
raise('This is already reversed') if self.status.to_s == 'reversed'
|
54
|
+
if trx = self.first_data_transactions.where(status: 'completed').first
|
55
|
+
response = self.class.gateway.refund(self.price, trx.transaction_id)
|
56
|
+
if response[:result] == 'OK'
|
57
|
+
trx.status = 'reversed'
|
58
|
+
trx.transaction_code = response[:result_code]
|
59
|
+
return trx.save!
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
module ClassMethods
|
67
|
+
# Closes business day
|
68
|
+
# should be executed every day ~midnight
|
69
|
+
# Like 'ruby script/runner <YourBillingModel>.first_data_close_business_day'
|
70
|
+
def first_data_close_business_day
|
71
|
+
gateway.close_day
|
72
|
+
end
|
73
|
+
|
74
|
+
def gateway
|
75
|
+
@gateway ||= ActiveMerchant::Billing::FirstDataGateway.new(
|
76
|
+
pem: File.open(ENV['FIRST_DATA_PEM']).read,
|
77
|
+
pem_password: ENV['FIRST_DATA_PASS']
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module LolitaFirstData
|
2
|
+
# custom log formatter for FirstData gateway
|
3
|
+
class LogFormatter < Logger::Formatter
|
4
|
+
def call(severity, time, program_name, message)
|
5
|
+
"%5s [%s] (%s) %s :: %s\n" % [severity, time.strftime('%Y-%m-%d %H:%M:%S'), $$, program_name, message]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
metadata
CHANGED
@@ -1,189 +1,187 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolita-first-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- Gatis Tomsons, ITHouse
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
19
|
+
version: 3.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
none: false
|
28
|
+
name: active_merchant_first_data
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
33
|
+
version: 1.1.0
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: sqlite3
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- - ~>
|
45
|
+
- - "~>"
|
42
46
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.3
|
47
|
+
version: '1.3'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
49
|
-
requirement:
|
50
|
-
none: false
|
56
|
+
name: rspec-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- - ~>
|
59
|
+
- - "~>"
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
61
|
+
version: 2.14.0
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.0
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: webmock
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
|
-
- - ~>
|
73
|
+
- - "~>"
|
64
74
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1
|
75
|
+
version: '1'
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ruby-debug19
|
71
|
-
requirement: &77848880 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
79
|
requirements:
|
74
|
-
- - ~>
|
80
|
+
- - "~>"
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: *77848880
|
82
|
+
version: '1'
|
80
83
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
82
|
-
requirement:
|
83
|
-
none: false
|
84
|
+
name: fabrication
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
84
86
|
requirements:
|
85
|
-
- - ~>
|
87
|
+
- - "~>"
|
86
88
|
- !ruby/object:Gem::Version
|
87
|
-
version: 1
|
89
|
+
version: '2.1'
|
88
90
|
type: :development
|
89
91
|
prerelease: false
|
90
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
91
97
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
93
|
-
requirement:
|
94
|
-
none: false
|
98
|
+
name: database_cleaner
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
95
100
|
requirements:
|
96
|
-
- - ~>
|
101
|
+
- - "~>"
|
97
102
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.
|
103
|
+
version: 1.2.0
|
99
104
|
type: :development
|
100
105
|
prerelease: false
|
101
|
-
version_requirements:
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.2.0
|
102
111
|
- !ruby/object:Gem::Dependency
|
103
|
-
name:
|
104
|
-
requirement:
|
105
|
-
none: false
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
106
114
|
requirements:
|
107
|
-
- -
|
115
|
+
- - "~>"
|
108
116
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
117
|
+
version: 0.8.2
|
110
118
|
type: :development
|
111
119
|
prerelease: false
|
112
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.8.2
|
113
125
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
115
|
-
requirement:
|
116
|
-
none: false
|
126
|
+
name: pry-byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
117
128
|
requirements:
|
118
|
-
- - ~>
|
129
|
+
- - "~>"
|
119
130
|
- !ruby/object:Gem::Version
|
120
|
-
version: 1.1
|
131
|
+
version: 1.3.1
|
121
132
|
type: :development
|
122
133
|
prerelease: false
|
123
|
-
version_requirements:
|
124
|
-
|
125
|
-
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.3.1
|
139
|
+
description: FirstData payment plugin using ActiveMerchant for use with Lolita CMS
|
140
|
+
email:
|
141
|
+
- gatis@ithouse.lv, info@ithouse.lv
|
126
142
|
executables: []
|
127
143
|
extensions: []
|
128
|
-
extra_rdoc_files:
|
129
|
-
- LICENSE.txt
|
130
|
-
- README.md
|
144
|
+
extra_rdoc_files: []
|
131
145
|
files:
|
132
|
-
-
|
133
|
-
- Gemfile
|
134
|
-
- Gemfile.lock
|
135
|
-
- LICENSE.txt
|
146
|
+
- MIT-LICENSE
|
136
147
|
- README.md
|
137
148
|
- Rakefile
|
138
|
-
-
|
139
|
-
- app/controllers/
|
140
|
-
- app/controllers/
|
141
|
-
- app/
|
142
|
-
- app/models/lolita/first_data/transaction.rb
|
149
|
+
- app/controllers/lolita_first_data/application_controller.rb
|
150
|
+
- app/controllers/lolita_first_data/test_controller.rb
|
151
|
+
- app/controllers/lolita_first_data/transactions_controller.rb
|
152
|
+
- app/models/lolita_first_data/transaction.rb
|
143
153
|
- config/locales/en.yml
|
144
154
|
- config/locales/lv.yml
|
145
155
|
- config/routes.rb
|
146
156
|
- lib/generators/lolita_first_data/install_generator.rb
|
147
157
|
- lib/generators/lolita_first_data/templates/migration.rb
|
148
158
|
- lib/lolita-first-data.rb
|
149
|
-
- lib/
|
150
|
-
- lib/
|
151
|
-
- lib/
|
152
|
-
- lib/
|
153
|
-
- lib/tasks/
|
154
|
-
- lolita-first-data.gemspec
|
155
|
-
- spec/cert.pem
|
156
|
-
- spec/fabricators/reservation_fabricator.rb
|
157
|
-
- spec/fabricators/transaction_fabricator.rb
|
158
|
-
- spec/first_data_spec.rb
|
159
|
-
- spec/spec_helper.rb
|
160
|
-
- spec/support/rails.rb
|
159
|
+
- lib/lolita_first_data/billing.rb
|
160
|
+
- lib/lolita_first_data/custom_logger.rb
|
161
|
+
- lib/lolita_first_data/engine.rb
|
162
|
+
- lib/lolita_first_data/version.rb
|
163
|
+
- lib/tasks/lolita_first_data_tasks.rake
|
161
164
|
homepage: http://github.com/ithouse/lolita-first-data
|
162
|
-
licenses:
|
163
|
-
|
165
|
+
licenses: []
|
166
|
+
metadata: {}
|
164
167
|
post_install_message:
|
165
168
|
rdoc_options: []
|
166
169
|
require_paths:
|
167
170
|
- lib
|
168
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
172
|
requirements:
|
171
|
-
- -
|
173
|
+
- - ">="
|
172
174
|
- !ruby/object:Gem::Version
|
173
175
|
version: '0'
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
hash: 790109101
|
177
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
-
none: false
|
179
177
|
requirements:
|
180
|
-
- -
|
178
|
+
- - ">="
|
181
179
|
- !ruby/object:Gem::Version
|
182
180
|
version: '0'
|
183
181
|
requirements: []
|
184
182
|
rubyforge_project:
|
185
|
-
rubygems_version:
|
183
|
+
rubygems_version: 2.2.0
|
186
184
|
signing_key:
|
187
|
-
specification_version:
|
188
|
-
summary: FirstData
|
185
|
+
specification_version: 4
|
186
|
+
summary: FirstData payment plugin for Lolita
|
189
187
|
test_files: []
|