k2-connect-ruby 3.1.0 → 4.0.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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +31 -0
  3. data/.gitignore +2 -0
  4. data/.ruby-version +1 -1
  5. data/Gemfile.lock +58 -22
  6. data/README.md +499 -198
  7. data/k2-connect-ruby.gemspec +39 -35
  8. data/lib/k2-connect-ruby/entity.rb +39 -9
  9. data/lib/k2-connect-ruby/http_client.rb +43 -0
  10. data/lib/k2-connect-ruby/k2_entity/k2_entity.rb +12 -11
  11. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/destination_request.rb +27 -0
  12. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/external_bank_account.rb +32 -0
  13. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/external_mpesa_wallet.rb +38 -0
  14. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/external_paybill.rb +31 -0
  15. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/external_till.rb +30 -0
  16. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/merchant_bank_account.rb +27 -0
  17. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/destination/merchant_mpesa_wallet.rb +27 -0
  18. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient/bank_account.rb +17 -0
  19. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient/mobile_wallet.rb +24 -0
  20. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient/paybill.rb +17 -0
  21. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient/recipient_request.rb +32 -0
  22. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient/till.rb +17 -0
  23. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/external_recipient.rb +54 -0
  24. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/k2_stk.rb +14 -31
  25. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/payment_link.rb +53 -0
  26. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/payment_links/payment_link_request.rb +43 -0
  27. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/reversal.rb +39 -0
  28. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/reversals/reversal_request.rb +39 -0
  29. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/send_money/send_money_request.rb +53 -0
  30. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/send_money.rb +73 -0
  31. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/stk_push/stk_push_request.rb +51 -0
  32. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/transfer_account/merchant_bank_account.rb +35 -0
  33. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/transfer_account/merchant_mpesa_wallet.rb +38 -0
  34. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/transfer_account/transfer_account_request.rb +25 -0
  35. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/transfer_account.rb +49 -0
  36. data/lib/k2-connect-ruby/k2_entity/k2_polling.rb +16 -13
  37. data/lib/k2-connect-ruby/k2_entity/k2_subscribe.rb +16 -14
  38. data/lib/k2-connect-ruby/k2_entity/k2_token.rb +14 -39
  39. data/lib/k2-connect-ruby/k2_entity/polling/polling_request.rb +48 -0
  40. data/lib/k2-connect-ruby/k2_entity/webhook/webhook_subscription_request.rb +66 -0
  41. data/lib/k2-connect-ruby/k2_errors.rb +15 -71
  42. data/lib/k2-connect-ruby/k2_services/base_service.rb +25 -0
  43. data/lib/k2-connect-ruby/k2_services/k2_client.rb +7 -6
  44. data/lib/k2-connect-ruby/k2_services/payloads/daraja_webhooks.rb +43 -0
  45. data/lib/k2-connect-ruby/k2_services/payloads/k2_transaction.rb +20 -18
  46. data/lib/k2-connect-ruby/k2_services/payloads/k2_webhooks.rb +36 -32
  47. data/lib/k2-connect-ruby/k2_services/payloads/transactions/incoming_payment.rb +31 -29
  48. data/lib/k2-connect-ruby/k2_services/payloads/transactions/outgoing_payment.rb +3 -1
  49. data/lib/k2-connect-ruby/k2_services/payloads/transactions/payment_link.rb +38 -0
  50. data/lib/k2-connect-ruby/k2_services/payloads/transactions/reversal.rb +35 -0
  51. data/lib/k2-connect-ruby/k2_services/payloads/transactions/send_money_payment.rb +25 -0
  52. data/lib/k2-connect-ruby/k2_services/payloads/transactions/transfer.rb +2 -0
  53. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/b2b_transaction_received.rb +9 -3
  54. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/b2b_transaction_reversed.rb +22 -0
  55. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/buygoods_transaction_received.rb +6 -0
  56. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/buygoods_transaction_reversed.rb +4 -0
  57. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/card_transaction_received.rb +18 -0
  58. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/card_transaction_reversed.rb +17 -0
  59. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/card_transaction_voided.rb +17 -0
  60. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/customer_created.rb +11 -7
  61. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/transfer_webhook.rb +50 -0
  62. data/lib/k2-connect-ruby/k2_services/send_introspect_token_request_service.rb +56 -0
  63. data/lib/k2-connect-ruby/k2_services/send_k2_connect_get_request_service.rb +42 -0
  64. data/lib/k2-connect-ruby/k2_services/send_k2_connect_post_request_service.rb +44 -0
  65. data/lib/k2-connect-ruby/k2_services/send_request_token_request_service.rb +55 -0
  66. data/lib/k2-connect-ruby/k2_services/send_revoke_token_request_service.rb +56 -0
  67. data/lib/k2-connect-ruby/k2_services/send_token_info_request_service.rb +44 -0
  68. data/lib/k2-connect-ruby/k2_services.rb +29 -0
  69. data/lib/k2-connect-ruby/k2_utilities/config/k2_config.rb +18 -26
  70. data/lib/k2-connect-ruby/k2_utilities/config/k2_config.yml +9 -10
  71. data/lib/k2-connect-ruby/k2_utilities/k2_authenticator.rb +12 -5
  72. data/lib/k2-connect-ruby/k2_utilities/k2_connection.rb +0 -49
  73. data/lib/k2-connect-ruby/k2_utilities/k2_connection_helper.rb +21 -0
  74. data/lib/k2-connect-ruby/k2_utilities/k2_process_result.rb +16 -15
  75. data/lib/k2-connect-ruby/k2_utilities/k2_process_webhook.rb +34 -21
  76. data/lib/k2-connect-ruby/k2_utilities/k2_url_parse.rb +3 -1
  77. data/lib/k2-connect-ruby/k2_utilities/phone_number_validator.rb +15 -0
  78. data/lib/k2-connect-ruby/k2_utilities.rb +9 -20
  79. data/lib/k2-connect-ruby/version.rb +3 -1
  80. data/lib/k2-connect-ruby.rb +14 -13
  81. metadata +97 -47
  82. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/k2_pay.rb +0 -98
  83. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/k2_settlement.rb +0 -48
  84. data/lib/k2-connect-ruby/k2_entity/k2_financial_entities/k2_transfer.rb +0 -44
  85. data/lib/k2-connect-ruby/k2_entity/k2_notification.rb +0 -40
  86. data/lib/k2-connect-ruby/k2_services/payload_process.rb +0 -19
  87. data/lib/k2-connect-ruby/k2_services/payloads/webhooks/settlement_webhook.rb +0 -44
  88. data/lib/k2-connect-ruby/k2_utilities/k2_validation.rb +0 -128
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5d5a8576589dfce78986a4841292a7f506e46a6e1910ccfdc903e4f79642260
4
- data.tar.gz: 90a30a81702d3313aa2343ae64e99a1cc4b854980957b80e309e1ae541ef430c
3
+ metadata.gz: a9a20aa777e2c0aa12146a20ff81eca613eb576a3576a679b119f630b6430be7
4
+ data.tar.gz: 697e4bb213990904ba66233181b7dd0786998da8905972bdfbccfe9279cf14ca
5
5
  SHA512:
6
- metadata.gz: 0bce7f0ecbc5fe71ff18371dd445938060ff971c802e603b12d732fb450b32cdbfdfd73338c044e82d561b1706af5cba7d28c14e2fb875e5ee9d213d61d70cf3
7
- data.tar.gz: b5f804d9dec6874c8477e16e1e1bacde420e760f48c63a97eaf6573aa5826351e9ef8dfe10bd223e5986d7c3f37a7232af9973c9af5a20758423009aef4e828e
6
+ metadata.gz: 7dfa292ea17c6c44a23665f5098993f006cc19538d6851b3ba2e34e591a78b1f1401c6ad17659329bd18912b7e2dd7cd75904fe563b605f35e044f1b6e945f1a
7
+ data.tar.gz: ec5844992559a8993682d5103704f9599be3ee5a0da54eee37d394a823449acbadaa526abeed14bf21458cf3233b0473509a4d50a86e3ff7e9656655bbcfc1af
@@ -0,0 +1,31 @@
1
+ ## Background of changes
2
+
3
+ _Please include a summary of the changes being introduced by this PR._
4
+
5
+
6
+ ## Type of change
7
+
8
+ _Please tick off the options that apply._
9
+
10
+ - [ ] New feature (non-breaking change which adds functionality)
11
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12
+ - [ ] Bug fix (non-breaking change which fixes an issue)
13
+ - [ ] This change requires a documentation update
14
+ - [ ] This change requires Postman collection update
15
+ - [ ] This change requires updating the DEPLOYMENT_CHECKLIST
16
+
17
+ ## Checklist
18
+
19
+ _Please tick off the options that apply._
20
+
21
+ - [ ] My changes work as expected
22
+ - [ ] I have performed a self-review of my code
23
+ - [ ] I have updated the DEPLOYMENT_CHECKLIST
24
+ - [ ] I have made corresponding changes to the documentation
25
+ - [ ] I have made corresponding changes to Postman collection
26
+ - [ ] I have added automated tests that prove my fix is effective or that my feature works as expected
27
+
28
+ ## How has this been tested?
29
+
30
+ _Please outline the scenarios that were tested (Add screenshots if necessary)_
31
+
data/.gitignore CHANGED
@@ -63,6 +63,8 @@ build-iPhoneSimulator/
63
63
  # rubocop
64
64
  rubocop.html
65
65
  tmp
66
+ .rubocop.yml
67
+ .rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml
66
68
 
67
69
  # rubocop
68
70
  rubocop.html
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.5
1
+ 3.4.13
data/Gemfile.lock CHANGED
@@ -1,43 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- k2-connect-ruby (3.1.0)
5
- activemodel (>= 7.2.2, < 8.1.1)
6
- activesupport (>= 7.2.2, < 8.1.1)
4
+ k2-connect-ruby (4.0.3)
5
+ activemodel (>= 7.2.2)
6
+ activesupport (>= 7.2.2)
7
7
  json (~> 2.8.2)
8
8
  rest-client (~> 2.1.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (7.2.2)
14
- activesupport (= 7.2.2)
15
- activesupport (7.2.2)
13
+ activemodel (8.1.4.1)
14
+ activesupport (= 8.1.4.1)
15
+ activesupport (8.1.4.1)
16
16
  base64
17
- benchmark (>= 0.3)
18
17
  bigdecimal
19
18
  concurrent-ruby (~> 1.0, >= 1.3.1)
20
19
  connection_pool (>= 2.2.5)
21
20
  drb
22
21
  i18n (>= 1.6, < 2)
22
+ json
23
23
  logger (>= 1.4.2)
24
24
  minitest (>= 5.1)
25
25
  securerandom (>= 0.3)
26
26
  tzinfo (~> 2.0, >= 2.0.5)
27
- addressable (2.8.7)
28
- public_suffix (>= 2.0.2, < 7.0)
29
- base64 (0.2.0)
30
- benchmark (0.4.0)
31
- bigdecimal (3.1.8)
27
+ uri (>= 0.13.1)
28
+ addressable (2.9.2)
29
+ public_suffix (>= 2.0.2, < 8.0)
30
+ ast (2.4.3)
31
+ base64 (0.3.0)
32
+ bigdecimal (4.1.3)
32
33
  coderay (1.1.3)
33
- concurrent-ruby (1.3.4)
34
- connection_pool (2.4.1)
34
+ concurrent-ruby (1.3.8)
35
+ connection_pool (3.0.2)
35
36
  crack (1.0.0)
36
37
  bigdecimal
37
38
  rexml
38
39
  diff-lcs (1.5.1)
39
40
  domain_name (0.6.20240107)
40
- drb (2.2.1)
41
+ drb (2.2.3)
41
42
  faker (3.5.1)
42
43
  i18n (>= 1.8.11, < 2)
43
44
  ffi (1.17.0)
@@ -60,39 +61,51 @@ GEM
60
61
  http-accept (1.7.0)
61
62
  http-cookie (1.0.7)
62
63
  domain_name (~> 0.5)
63
- i18n (1.14.6)
64
+ i18n (1.15.2)
64
65
  concurrent-ruby (~> 1.0)
65
66
  json (2.8.2)
67
+ language_server-protocol (3.17.0.5)
68
+ lint_roller (1.1.0)
66
69
  listen (3.9.0)
67
70
  rb-fsevent (~> 0.10, >= 0.10.3)
68
71
  rb-inotify (~> 0.9, >= 0.9.10)
69
- logger (1.6.1)
72
+ logger (1.7.0)
70
73
  lumberjack (1.2.10)
71
74
  method_source (1.1.0)
72
75
  mime-types (3.6.0)
73
76
  logger
74
77
  mime-types-data (~> 3.2015)
75
78
  mime-types-data (3.2024.1105)
76
- minitest (5.25.2)
79
+ minitest (6.0.6)
80
+ drb (~> 2.0)
81
+ prism (~> 1.5)
77
82
  nenv (0.3.0)
78
83
  netrc (0.11.0)
79
84
  notiffany (0.1.3)
80
85
  nenv (~> 0.1)
81
86
  shellany (~> 0.0)
87
+ parallel (1.27.0)
88
+ parser (3.3.9.0)
89
+ ast (~> 2.4.1)
90
+ racc
91
+ prism (1.9.0)
82
92
  pry (0.15.0)
83
93
  coderay (~> 1.1)
84
94
  method_source (~> 1.0)
85
95
  public_suffix (6.0.1)
96
+ racc (1.8.1)
97
+ rainbow (3.1.1)
86
98
  rake (13.2.1)
87
99
  rb-fsevent (0.11.2)
88
100
  rb-inotify (0.11.1)
89
101
  ffi (~> 1.0)
102
+ regexp_parser (2.11.2)
90
103
  rest-client (2.1.0)
91
104
  http-accept (>= 1.7.0, < 2.0)
92
105
  http-cookie (>= 1.0.2, < 2.0)
93
106
  mime-types (>= 1.16, < 4.0)
94
107
  netrc (~> 0.8)
95
- rexml (3.3.9)
108
+ rexml (3.4.2)
96
109
  rspec (3.13.0)
97
110
  rspec-core (~> 3.13.0)
98
111
  rspec-expectations (~> 3.13.0)
@@ -109,12 +122,33 @@ GEM
109
122
  rspec (>= 3)
110
123
  terminal-notifier (>= 1.4)
111
124
  rspec-support (3.13.1)
112
- securerandom (0.3.2)
125
+ rubocop (1.80.1)
126
+ json (~> 2.3)
127
+ language_server-protocol (~> 3.17.0.2)
128
+ lint_roller (~> 1.1.0)
129
+ parallel (~> 1.10)
130
+ parser (>= 3.3.0.2)
131
+ rainbow (>= 2.2.2, < 4.0)
132
+ regexp_parser (>= 2.9.3, < 3.0)
133
+ rubocop-ast (>= 1.46.0, < 2.0)
134
+ ruby-progressbar (~> 1.7)
135
+ unicode-display_width (>= 2.4.0, < 4.0)
136
+ rubocop-ast (1.46.0)
137
+ parser (>= 3.3.7.2)
138
+ prism (~> 1.4)
139
+ rubocop-shopify (2.17.1)
140
+ rubocop (~> 1.62)
141
+ ruby-progressbar (1.13.0)
142
+ securerandom (0.4.1)
113
143
  shellany (0.0.1)
114
144
  terminal-notifier (2.0.0)
115
145
  thor (1.3.2)
116
146
  tzinfo (2.0.6)
117
147
  concurrent-ruby (~> 1.0)
148
+ unicode-display_width (3.1.5)
149
+ unicode-emoji (~> 4.0, >= 4.0.4)
150
+ unicode-emoji (4.0.4)
151
+ uri (1.1.2)
118
152
  vcr (6.3.1)
119
153
  base64
120
154
  webmock (3.24.0)
@@ -126,7 +160,7 @@ PLATFORMS
126
160
  ruby
127
161
 
128
162
  DEPENDENCIES
129
- bundler (~> 2.5.16)
163
+ bundler (~> 4.0.3)
130
164
  faker (~> 3.5.1)
131
165
  guard (~> 2.19)
132
166
  guard-rspec (~> 4.7.3)
@@ -134,8 +168,10 @@ DEPENDENCIES
134
168
  rake (~> 13.2.1)
135
169
  rspec (~> 3.13.0)
136
170
  rspec-nc (~> 0.3.0)
171
+ rubocop (~> 1.80.1)
172
+ rubocop-shopify (~> 2.17.1)
137
173
  vcr (~> 6.3.1)
138
174
  webmock (~> 3.24)
139
175
 
140
176
  BUNDLED WITH
141
- 2.5.16
177
+ 4.0.3