veritrans 2.1.3 → 2.4.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.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +10 -1
  3. data/.idea/.gitignore +8 -0
  4. data/.rubocop.yml +35 -0
  5. data/.travis.yml +10 -5
  6. data/CHANGELOG.md +45 -0
  7. data/Gemfile +4 -7
  8. data/Gemfile.lock +24 -163
  9. data/Maintaining.md +17 -0
  10. data/README.md +350 -219
  11. data/api_reference.md +534 -143
  12. data/example/coreapi/core_api_credit_card_example.rb +66 -0
  13. data/example/coreapi/readme.md +4 -0
  14. data/example/sinatra/Gemfile +7 -0
  15. data/example/sinatra/README.md +6 -0
  16. data/example/sinatra/index.erb +202 -0
  17. data/example/sinatra/response.erb +1 -0
  18. data/example/sinatra/snap.erb +33 -0
  19. data/example/sinatra/snap_redirect.erb +10 -0
  20. data/example/sinatra/webapp.rb +113 -0
  21. data/example/snap/readme.md +4 -0
  22. data/example/snap/snap_example.rb +39 -0
  23. data/example/subscription/credit_card_subscription_example.rb +138 -0
  24. data/example/subscription/gopay_subscription_example.rb +153 -0
  25. data/example/subscription/readme.md +4 -0
  26. data/example/tokenization/gopay_tokenization_example.rb +144 -0
  27. data/example/tokenization/readme.md +4 -0
  28. data/lib/test/all.rb +1 -0
  29. data/lib/test/api_test.rb +319 -0
  30. data/lib/test/config_test.rb +26 -0
  31. data/lib/test/gopay_tokenization_test.rb +80 -0
  32. data/lib/test/snap_test.rb +79 -0
  33. data/lib/test/subscription_test.rb +116 -0
  34. data/lib/test/transaction_test.rb +160 -0
  35. data/lib/veritrans/api.rb +144 -20
  36. data/lib/veritrans/client.rb +48 -12
  37. data/lib/veritrans/config.rb +31 -6
  38. data/lib/veritrans/events.rb +46 -35
  39. data/lib/veritrans/midtrans_error.rb +15 -0
  40. data/lib/veritrans/result.rb +63 -2
  41. data/lib/veritrans/version.rb +1 -1
  42. data/lib/veritrans.rb +121 -12
  43. data/veritrans.gemspec +2 -9
  44. metadata +35 -146
  45. data/.rspec +0 -2
  46. data/Procfile +0 -1
  47. data/Rakefile +0 -16
  48. data/bin/midtrans +0 -3
  49. data/bin/veritrans +0 -68
  50. data/example/README.md +0 -8
  51. data/example/config.ru +0 -6
  52. data/example/index.erb +0 -213
  53. data/example/localization.erb +0 -248
  54. data/example/points.erb +0 -187
  55. data/example/recurring.erb +0 -201
  56. data/example/response.erb +0 -37
  57. data/example/sinatra.rb +0 -188
  58. data/example/style.css +0 -126
  59. data/example/veritrans.yml +0 -11
  60. data/example/widget.erb +0 -51
  61. data/lib/generators/templates/assets/credit_card_form.js +0 -51
  62. data/lib/generators/templates/payments_controller.rb +0 -85
  63. data/lib/generators/templates/veritrans.rb +0 -46
  64. data/lib/generators/templates/veritrans.yml +0 -18
  65. data/lib/generators/templates/views/_credit_card_form.erb +0 -42
  66. data/lib/generators/templates/views/_veritrans_include.erb +0 -10
  67. data/lib/generators/templates/views/payments/create.erb +0 -15
  68. data/lib/generators/templates/views/payments/new.erb +0 -6
  69. data/lib/generators/veritrans/install_generator.rb +0 -32
  70. data/lib/generators/veritrans/payment_form_generator.rb +0 -45
  71. data/lib/veritrans/cli.rb +0 -155
  72. data/lib/veritrans/core_extensions.rb +0 -32
  73. data/spec/cli_spec.rb +0 -83
  74. data/spec/configs/real_key.yml +0 -4
  75. data/spec/configs/veritrans.yml +0 -7
  76. data/spec/configs/veritrans_flat.yml +0 -2
  77. data/spec/configs/veritrans_with_erb.yml +0 -2
  78. data/spec/fixtures/approve_failed.yml +0 -48
  79. data/spec/fixtures/cancel_failed.yml +0 -48
  80. data/spec/fixtures/cancel_success.yml +0 -106
  81. data/spec/fixtures/capture_failed.yml +0 -48
  82. data/spec/fixtures/charge.yml +0 -50
  83. data/spec/fixtures/charge_direct.yml +0 -56
  84. data/spec/fixtures/charge_vtweb.yml +0 -50
  85. data/spec/fixtures/cli_test_1111-not-exists.yml +0 -45
  86. data/spec/fixtures/cli_test_not_exists.yml +0 -45
  87. data/spec/fixtures/cli_test_real_txn.yml +0 -55
  88. data/spec/fixtures/cli_test_unauthorized.yml +0 -47
  89. data/spec/fixtures/events_test_real_txn.yml +0 -55
  90. data/spec/fixtures/expire_failed.yml +0 -50
  91. data/spec/fixtures/expire_success.yml +0 -56
  92. data/spec/fixtures/midtrans_status.yml +0 -117
  93. data/spec/fixtures/status_fail.yml +0 -46
  94. data/spec/fixtures/status_success.yml +0 -109
  95. data/spec/midtrans_rename_spec.rb +0 -27
  96. data/spec/rails_plugin_spec.rb +0 -281
  97. data/spec/spec_helper.rb +0 -61
  98. data/spec/veritrans_client_spec.rb +0 -184
  99. data/spec/veritrans_config_spec.rb +0 -70
  100. data/spec/veritrans_events_spec.rb +0 -72
  101. data/spec/veritrans_logger_spec.rb +0 -46
  102. data/spec/veritrans_snap_spec.rb +0 -39
  103. data/testing_webhooks.md +0 -78
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c610e190c04bc6be296adf2fe3d4b5ad00009872
4
- data.tar.gz: 19375928d04af1fef395e20df335910f621ec9a9
2
+ SHA256:
3
+ metadata.gz: b8f40c46b892c2f87d0803387f08aeb565e7b5ecea9e26d4962fb5e852d5cbbb
4
+ data.tar.gz: 79ce221c6297fbc3558e60881704a0b6c72bce9353ce85c500f7145d1928a30d
5
5
  SHA512:
6
- metadata.gz: 9e83f571dc75053a9cd0d254202cbef175c045ad9477af7ea94480e77c31f317631cf377b512ac9a4e2d9f88d15270958fb24294f7195c8265899a3536a68d67
7
- data.tar.gz: 8593be4707141266a9d55dbd8599242d5e8153b04d8ad7b985a71aa7358a620cb61c04c63c32b8765513eb86c1aad2e2f9208af5cfc23c1db713d743475ca831
6
+ metadata.gz: 6ec9419b6388b39665415dcfccb10acde81266d4ac338259bed4e033cca4c6240f4e6e7f7cf631f541ed831cefd033bb11b49b4eafda0781468a84f381924cfb
7
+ data.tar.gz: 8906403f8cc21a0963697b1e6b3283f8f8c8f30cc22305348cc7e96fadccd9817594b5d330dfea4b5001904fee71295b3b60c6751f81da771bf9fb20f7310482
data/.gitignore CHANGED
@@ -3,4 +3,13 @@ rails_example*
3
3
  .DS_Store
4
4
  tmp
5
5
  doc/
6
- veritrans_credentials
6
+ example/rails/cable/log
7
+ example/rails/cable/tmp
8
+ example/rails/simplepay/log
9
+ example/rails/simplepay/tmp
10
+ veritrans_credentials
11
+ .ruby-version
12
+ .idea/veritrans-ruby.iml
13
+ .idea/vcs.xml
14
+ .idea/modules.xml
15
+ .idea/misc.xml
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ Rails:
2
+ Enabled: true
3
+
4
+ Metrics/MethodLength:
5
+ Max: 100
6
+
7
+ Metrics/AbcSize:
8
+ Max: 40
9
+
10
+ Metrics/CyclomaticComplexity:
11
+ Max: 10
12
+
13
+ Metrics/PerceivedComplexity:
14
+ Max: 10
15
+
16
+ Metrics/ClassLength:
17
+ Enabled: false
18
+
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+
22
+ Metrics/LineLength:
23
+ Max: 120
24
+
25
+ Metrics/ModuleLength:
26
+ Enabled: false
27
+
28
+ Rails/CreateTableWithTimestamps:
29
+ Enabled: false
30
+
31
+ Style/FrozenStringLiteralComment:
32
+ Enabled: false
33
+
34
+ Style/Documentation:
35
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,13 +1,18 @@
1
1
  language: ruby
2
2
  cache: bundler
3
+
3
4
  env:
4
- - DEBUG=1
5
+ # - DEBUG=1
5
6
 
6
7
  before_install:
7
- - gem install bundler -v '~> 1.11'
8
+ - gem install bundler -v '1.17.3' --no-doc
8
9
 
9
- script: "bundle exec rspec"
10
+ script:
11
+ - bundle exec rspec
10
12
 
11
13
  rvm:
12
- - 2.2.4
13
- - 2.3.1
14
+ - 2.4.6
15
+ - 2.5.5
16
+ - 2.6.2
17
+ - 2.7.2
18
+ - 3.0.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,48 @@
1
+ ### Version 2.4.0 (date 22 October 2021)
2
+ * Update dependency, revamp implementation by removing non relevant features & adding new features
3
+ * Implement Gopay tokenization
4
+ * Implement API subscription
5
+ * Add function Idempotency Key, override notification, append Notification
6
+ * Make new unit test using minitest
7
+ * Create example core api and snap using Sinatra framework
8
+ * API client methods will now raise `MidtransError` when getting unexpected API response. You may need to update your error handling.
9
+
10
+ ### Version 2.3.1 (date 9 March 2021)
11
+
12
+ * Change URI.escape to ERB::Util.url_encode (support ruby 3.0)
13
+
14
+ ### Version 2.3.0 (date 1 April 2019)
15
+
16
+ * Add refund, deny, and test_token methods (Thank to @christianmkuss)
17
+ * Remove logging of server key
18
+
19
+ ### Version 2.2.1 (date 30 May 2018)
20
+
21
+ * Update assertion message value
22
+ * Add alias method create_snap_redirect_url
23
+ * add redirect_url accessor in SnapResult
24
+ * Improve some wordings and examples in README.md
25
+
26
+ ### Version 2.2.0 (date 08 May 2017)
27
+
28
+ * Change default endpoint to *.midtrans.com
29
+ * Fix broken links to documentation
30
+ * Add support for Rails 5.1
31
+ * Add Rails examples (Thanks to Adam Pahlevi)
32
+ * More complete rdoc commects
33
+ * Add items to vtweb example
34
+ * Update year in example app
35
+ * Log error message for failed requests
36
+ * Add Veritrans::Testing for testing API
37
+
38
+ ### Version 2.1.3 (date 19 Dec 2016)
39
+
40
+ * Update create snap token endpoint
41
+
42
+ ### Version 2.1.2 (date 20 Oct 2016)
43
+
44
+ * Create alias Midtrans = Veritrans
45
+
1
46
  ### Version 2.1.1 (date 15 Sep 2016)
2
47
 
3
48
  * Allow use ENV variables in config
data/Gemfile CHANGED
@@ -1,12 +1,9 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
4
- gem 'rspec'
5
-
6
- gem 'rails', '< 6'
7
-
8
- gem 'sinatra', git: 'https://github.com/sinatra/sinatra.git'
9
3
  gem 'puma'
4
+ gem 'sinatra'
10
5
  gem 'tilt'
6
+ gem 'sqlite3'
7
+ gem 'minitest', '~> 5.14', '>= 5.14.4'
11
8
 
12
9
  gemspec
data/Gemfile.lock CHANGED
@@ -1,181 +1,42 @@
1
- GIT
2
- remote: https://github.com/sinatra/sinatra.git
3
- revision: 1b0edc0aeaaf4839cadfcec1b21da86e6af1d4c0
4
- specs:
5
- rack-protection (2.0.0.beta2)
6
- rack
7
- sinatra (2.0.0.beta2)
8
- mustermann (= 1.0.0.beta2)
9
- rack (~> 2.0)
10
- rack-protection (= 2.0.0.beta2)
11
- tilt (~> 2.0)
12
-
13
1
  PATH
14
2
  remote: .
15
3
  specs:
16
- veritrans (2.1.2)
4
+ veritrans (2.4.1)
17
5
  excon (~> 0.20)
18
6
 
19
7
  GEM
20
8
  remote: https://rubygems.org/
21
9
  specs:
22
- actioncable (5.0.0.1)
23
- actionpack (= 5.0.0.1)
24
- nio4r (~> 1.2)
25
- websocket-driver (~> 0.6.1)
26
- actionmailer (5.0.0.1)
27
- actionpack (= 5.0.0.1)
28
- actionview (= 5.0.0.1)
29
- activejob (= 5.0.0.1)
30
- mail (~> 2.5, >= 2.5.4)
31
- rails-dom-testing (~> 2.0)
32
- actionpack (5.0.0.1)
33
- actionview (= 5.0.0.1)
34
- activesupport (= 5.0.0.1)
35
- rack (~> 2.0)
36
- rack-test (~> 0.6.3)
37
- rails-dom-testing (~> 2.0)
38
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
39
- actionview (5.0.0.1)
40
- activesupport (= 5.0.0.1)
41
- builder (~> 3.1)
42
- erubis (~> 2.7.0)
43
- rails-dom-testing (~> 2.0)
44
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
45
- activejob (5.0.0.1)
46
- activesupport (= 5.0.0.1)
47
- globalid (>= 0.3.6)
48
- activemodel (5.0.0.1)
49
- activesupport (= 5.0.0.1)
50
- activerecord (5.0.0.1)
51
- activemodel (= 5.0.0.1)
52
- activesupport (= 5.0.0.1)
53
- arel (~> 7.0)
54
- activesupport (5.0.0.1)
55
- concurrent-ruby (~> 1.0, >= 1.0.2)
56
- i18n (~> 0.7)
57
- minitest (~> 5.1)
58
- tzinfo (~> 1.1)
59
- addressable (2.4.0)
60
- arel (7.1.1)
61
- builder (3.2.2)
62
- capybara (2.7.1)
63
- addressable
64
- mime-types (>= 1.16)
65
- nokogiri (>= 1.3.3)
66
- rack (>= 1.0.0)
67
- rack-test (>= 0.5.4)
68
- xpath (~> 2.0)
69
- cliver (0.3.2)
70
- concurrent-ruby (1.0.2)
71
- crack (0.4.3)
72
- safe_yaml (~> 1.0.0)
73
- diff-lcs (1.2.5)
74
- erubis (2.7.0)
75
- excon (0.53.0)
76
- globalid (0.3.7)
77
- activesupport (>= 4.1.0)
78
- hashdiff (0.3.0)
79
- i18n (0.7.0)
80
- loofah (2.0.3)
81
- nokogiri (>= 1.5.9)
82
- mail (2.6.4)
83
- mime-types (>= 1.16, < 4)
84
- method_source (0.8.2)
85
- mime-types (3.1)
86
- mime-types-data (~> 3.2015)
87
- mime-types-data (3.2016.0521)
88
- mini_portile2 (2.1.0)
89
- minitest (5.9.0)
90
- mustermann (1.0.0.beta2)
91
- nio4r (1.2.1)
92
- nokogiri (1.6.8)
93
- mini_portile2 (~> 2.1.0)
94
- pkg-config (~> 1.1.7)
95
- pkg-config (1.1.7)
96
- poltergeist (1.10.0)
97
- capybara (~> 2.1)
98
- cliver (~> 0.3.1)
99
- websocket-driver (>= 0.2.0)
100
- puma (3.6.0)
101
- rack (2.0.1)
102
- rack-test (0.6.3)
103
- rack (>= 1.0)
104
- rails (5.0.0.1)
105
- actioncable (= 5.0.0.1)
106
- actionmailer (= 5.0.0.1)
107
- actionpack (= 5.0.0.1)
108
- actionview (= 5.0.0.1)
109
- activejob (= 5.0.0.1)
110
- activemodel (= 5.0.0.1)
111
- activerecord (= 5.0.0.1)
112
- activesupport (= 5.0.0.1)
113
- bundler (>= 1.3.0, < 2.0)
114
- railties (= 5.0.0.1)
115
- sprockets-rails (>= 2.0.0)
116
- rails-dom-testing (2.0.1)
117
- activesupport (>= 4.2.0, < 6.0)
118
- nokogiri (~> 1.6.0)
119
- rails-html-sanitizer (1.0.3)
120
- loofah (~> 2.0)
121
- railties (5.0.0.1)
122
- actionpack (= 5.0.0.1)
123
- activesupport (= 5.0.0.1)
124
- method_source
125
- rake (>= 0.8.7)
126
- thor (>= 0.18.1, < 2.0)
127
- rake (11.2.2)
128
- rspec (3.5.0)
129
- rspec-core (~> 3.5.0)
130
- rspec-expectations (~> 3.5.0)
131
- rspec-mocks (~> 3.5.0)
132
- rspec-core (3.5.2)
133
- rspec-support (~> 3.5.0)
134
- rspec-expectations (3.5.0)
135
- diff-lcs (>= 1.2.0, < 2.0)
136
- rspec-support (~> 3.5.0)
137
- rspec-mocks (3.5.0)
138
- diff-lcs (>= 1.2.0, < 2.0)
139
- rspec-support (~> 3.5.0)
140
- rspec-support (3.5.0)
141
- safe_yaml (1.0.4)
142
- sprockets (3.7.0)
143
- concurrent-ruby (~> 1.0)
144
- rack (> 1, < 3)
145
- sprockets-rails (3.1.1)
146
- actionpack (>= 4.0)
147
- activesupport (>= 4.0)
148
- sprockets (>= 3.0.0)
149
- thor (0.19.1)
150
- thread_safe (0.3.5)
151
- tilt (2.0.5)
152
- tzinfo (1.2.2)
153
- thread_safe (~> 0.1)
154
- vcr (3.0.3)
155
- webmock (2.1.0)
156
- addressable (>= 2.3.6)
157
- crack (>= 0.3.2)
158
- hashdiff
159
- websocket-driver (0.6.4)
160
- websocket-extensions (>= 0.1.0)
161
- websocket-extensions (0.1.2)
162
- xpath (2.0.0)
163
- nokogiri (~> 1.3)
10
+ excon (0.88.0)
11
+ minitest (5.14.4)
12
+ mustermann (1.1.1)
13
+ ruby2_keywords (~> 0.0.1)
14
+ nio4r (2.5.8)
15
+ puma (5.5.0)
16
+ nio4r (~> 2.0)
17
+ rack (2.2.3)
18
+ rack-protection (2.1.0)
19
+ rack
20
+ ruby2_keywords (0.0.5)
21
+ sinatra (2.1.0)
22
+ mustermann (~> 1.0)
23
+ rack (~> 2.2)
24
+ rack-protection (= 2.1.0)
25
+ tilt (~> 2.0)
26
+ sqlite3 (1.4.2)
27
+ tilt (2.0.10)
164
28
 
165
29
  PLATFORMS
166
30
  ruby
31
+ x86_64-darwin-19
167
32
 
168
33
  DEPENDENCIES
169
- poltergeist (~> 1.8)
34
+ minitest (~> 5.14, >= 5.14.4)
170
35
  puma
171
- rails (< 6)
172
- rake
173
- rspec
174
- sinatra!
36
+ sinatra
37
+ sqlite3
175
38
  tilt
176
- vcr (~> 3.0)
177
39
  veritrans!
178
- webmock (>= 1.20)
179
40
 
180
41
  BUNDLED WITH
181
- 1.13.1
42
+ 2.2.26
data/Maintaining.md ADDED
@@ -0,0 +1,17 @@
1
+ > Warning: This note is for developer/maintainer of this package only
2
+
3
+ ## Updating Package
4
+
5
+ - Make your changes
6
+ - Update `version` value on `version.rb` file
7
+ - To install the package from local codes, you should build a gem `gem build veritrans.gemspec` after that `gem install veritrans-x.y.z.gem` (replace `x.y.z` with the version number e.g. `gem install veritrans-2.4.0.gem`)
8
+ - Note: In case you want to test another new code changes, you will need to re-build & re-install, so that your latest code will be used by the locally installed gem
9
+ - To run all test `cd /lib/test` and after that `ruby -Itest all.rb`
10
+ - To run specific test `ruby snap_test.rb`
11
+ - If you are using Rubymine, you can right click folder test and choose `run all tests in test`
12
+
13
+ ## Update Rubygems.org
14
+ - Run this command `gem build veritrans.gemspec`
15
+ - Run this command `gem push veritrans-x.y.z.gem` (replace `x.y.z` with the version number e.g. `gem push veritrans-2.4.0.gem`), after that you are required to enter email and password account in Rubygems.org
16
+ - You can get account Rubygems.org in `Account Access & Resources`
17
+ - If you are using Rubymine, you can use `Tools -> Gem -> Build Gem` and `Push Gem`