k2-connect-ruby 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f16b31dad92f44afc4fecd11658daedb06dd25dc248dc91aac55108e231c567
4
- data.tar.gz: f92ca5e74163589b853eaad34856cc9477b0ea0be2794a207070f4a6e02e5906
3
+ metadata.gz: 31eba87b4eac68ac9e84013a18c31fbd9947329ed46b2baa0635634612fad44d
4
+ data.tar.gz: d00eecefb30ff3c58bb6487913b0fdde209f1b2452dfcf742722be7e5a7a189e
5
5
  SHA512:
6
- metadata.gz: 2c3e9fb52c6d643c0aa19bc7295db3f03a6b2831b6bff0fd804f49505895242e86ee551c37f0da6b417a86728c0ae4f330d612e82f961d6f9ec55da44c972881
7
- data.tar.gz: 2098c75cdc7f5f86a65dcfe0bdc42138bba2a87eb05e0c244bf5c0e7accd3d5977b0d6ae22840ad423b2b0157980998cbcf8aa2ba791f5f3f41ea86d64701204
6
+ metadata.gz: da32a40989d406aaac05646153edf4dfe18ec2c21eaf97a61c3ef1dc94a9571a57a7fa658fa822716d0c4c413ff04305a2c51deafab4fb8771aaab501453872b
7
+ data.tar.gz: fff96cacf6ec1888f3ab2dd2aca2683a1d042f9fbae335f19a71919f4250fac534594f5c6960b6f6a6e6c9d30b83009f3f0aa9c764796591f8cda9009e441133
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- k2-connect-ruby (0.0.4)
4
+ k2-connect-ruby (1.0.0)
5
5
  activemodel (~> 6.1.3.1)
6
6
  activesupport (~> 6.1.3.1)
7
7
  rest-client (~> 2.1.0)
@@ -10,18 +10,18 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (6.1.3.1)
14
- activesupport (= 6.1.3.1)
15
- activesupport (6.1.3.1)
13
+ activemodel (6.1.3.2)
14
+ activesupport (= 6.1.3.2)
15
+ activesupport (6.1.3.2)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
20
  zeitwerk (~> 2.3)
21
- addressable (2.7.0)
21
+ addressable (2.8.0)
22
22
  public_suffix (>= 2.0.2, < 5.0)
23
23
  coderay (1.1.3)
24
- concurrent-ruby (1.1.8)
24
+ concurrent-ruby (1.1.9)
25
25
  crack (0.4.5)
26
26
  rexml
27
27
  diff-lcs (1.4.4)
@@ -45,19 +45,19 @@ GEM
45
45
  rspec (>= 2.99.0, < 4.0)
46
46
  hashdiff (1.0.1)
47
47
  http-accept (1.7.0)
48
- http-cookie (1.0.3)
48
+ http-cookie (1.0.4)
49
49
  domain_name (~> 0.5)
50
- i18n (1.8.10)
50
+ i18n (1.10.0)
51
51
  concurrent-ruby (~> 1.0)
52
52
  listen (3.5.1)
53
53
  rb-fsevent (~> 0.10, >= 0.10.3)
54
54
  rb-inotify (~> 0.9, >= 0.9.10)
55
55
  lumberjack (1.2.8)
56
56
  method_source (1.0.0)
57
- mime-types (3.3.1)
57
+ mime-types (3.4.1)
58
58
  mime-types-data (~> 3.2015)
59
- mime-types-data (3.2021.0225)
60
- minitest (5.14.4)
59
+ mime-types-data (3.2022.0105)
60
+ minitest (5.15.0)
61
61
  nenv (0.3.0)
62
62
  netrc (0.11.0)
63
63
  notiffany (0.1.3)
@@ -100,14 +100,14 @@ GEM
100
100
  concurrent-ruby (~> 1.0)
101
101
  unf (0.1.4)
102
102
  unf_ext
103
- unf_ext (0.0.7.7)
103
+ unf_ext (0.0.8)
104
104
  vcr (6.0.0)
105
105
  webmock (3.12.2)
106
106
  addressable (>= 2.3.6)
107
107
  crack (>= 0.3.2)
108
108
  hashdiff (>= 0.4.0, < 2.0.0)
109
109
  yajl-ruby (1.4.1)
110
- zeitwerk (2.4.2)
110
+ zeitwerk (2.5.4)
111
111
 
112
112
  PLATFORMS
113
113
  ruby
@@ -124,4 +124,4 @@ DEPENDENCIES
124
124
  webmock (~> 3.12.2)
125
125
 
126
126
  BUNDLED WITH
127
- 2.2.11
127
+ 2.2.21
data/README.md CHANGED
@@ -202,6 +202,17 @@ Add a PAY Recipient, with the following arguments:
202
202
  - bank_branch_ref `REQUIRED`
203
203
  - settlement_method: 'EFT' or 'RTS' `REQUIRED`
204
204
 
205
+ **Paybill** PAY Recipient
206
+ - type: 'paybill' `REQUIRED`
207
+ - paybill_name `REQUIRED`
208
+ - paybill_number `REQUIRED`
209
+ - paybill_account_number `REQUIRED`
210
+
211
+ **Till** PAY Recipient
212
+ - type: 'till' `REQUIRED`
213
+ - till_name `REQUIRED`
214
+ - till_number `REQUIRED`
215
+
205
216
 
206
217
  k2_pay.add_recipients(your_input)
207
218
 
@@ -221,6 +232,9 @@ The following arguments should be passed within a hash:
221
232
  - destination_type `REQUIRED`
222
233
  - currency default is `KES`
223
234
  - value `REQUIRED`
235
+ - description `REQUIRED`
236
+ - category
237
+ - tags
224
238
  - callback_url `REQUIRED`
225
239
 
226
240
  A Successful Response is returned with the URL of the Payment resource in the HTTP Location Header.
@@ -249,7 +263,25 @@ Code example;
249
263
  k2_pay = K2Pay.new(your_access_token)
250
264
  k2_pay.add_recipient(your_recipient_input)
251
265
  k2_pay.query_resource(k2_pay.recipients_location_url)
252
- k2_pay.create_payment(your_payment_input)
266
+
267
+ your_request = {
268
+ destination_type: "mobile_wallet",
269
+ destination_reference: "example_reference",
270
+ amount: {
271
+ "currency": "KES",
272
+ "value": "500"
273
+ },
274
+ description: "k2-connect",
275
+ category: "general",
276
+ tags: ["tag_1", "tag_2"],
277
+ metadata: {
278
+ "something": "",
279
+ "something_else": "Something else"
280
+ },
281
+ _links: { "callback_url": "https://example.site/example" }
282
+ }
283
+
284
+ k2_pay.create_payment(your_request)
253
285
  k2_pay.query_resource(k2_pay.payments_location_url)
254
286
  ```
255
287
 
@@ -341,7 +373,7 @@ A HTTP Response will be returned in a JSON Payload, accessible with the k2_respo
341
373
 
342
374
  ### Polling
343
375
 
344
- Tallows you to poll transactions received on the Kopo Kopo system within a certain time range, and either a company or a specific till.
376
+ Allows you to poll transactions received on the Kopo Kopo system within a certain time range, and either a company or a specific till.
345
377
 
346
378
  First Create the K2Notification Object
347
379
 
@@ -501,21 +533,6 @@ k2_components = K2ProcessResult.process(k2_parse.hash_body)
501
533
  - `links_self`
502
534
  - `links_resource`
503
535
  - `sending_till`
504
-
505
- 6. Merchant to Merchant Transaction:
506
- - `id`
507
- - `resource_id`
508
- - `topic`
509
- - `created_at`
510
- - `event_type`
511
- - `reference`
512
- - `origination_time`
513
- - `amount`
514
- - `currency`
515
- - `status`
516
- - `links_self`
517
- - `links_resource`
518
- - `resource_sending_merchant`
519
536
 
520
537
  7. Process STK Push Payment Request Result
521
538
  - `id`
@@ -34,11 +34,12 @@ class K2Pay < K2Entity
34
34
  till_number: params[:till_number]
35
35
  }
36
36
  # In the case of bank pay recipient
37
- elsif params[:type].eql?('kopo_kopo_merchant')
38
- params = validate_input(params, @exception_array += %w[alias_name till_number])
37
+ elsif params[:type].eql?('paybill')
38
+ params = validate_input(params, @exception_array += %w[paybill_name paybill_number paybill_account_number])
39
39
  k2_request_pay_recipient = {
40
- alias_name: params[:alias_name],
41
- till_number: params[:till_number]
40
+ paybill_name: params[:paybill_name],
41
+ paybill_number: params[:paybill_number],
42
+ paybill_account_number: params[:paybill_account_number]
42
43
  }
43
44
  else
44
45
  raise ArgumentError, 'Undefined Payment Method.'
@@ -59,7 +60,7 @@ class K2Pay < K2Entity
59
60
  # Create an outgoing Payment to a third party.
60
61
  def create_payment(params)
61
62
  # Validation
62
- params = validate_input(params, @exception_array += %w[destination_reference destination_type currency value callback_url metadata])
63
+ params = validate_input(params, @exception_array += %w[destination_reference destination_type description category tags currency value callback_url metadata])
63
64
  # The Request Body Parameters
64
65
  k2_request_pay_amount = {
65
66
  currency: params[:currency],
@@ -72,6 +73,9 @@ class K2Pay < K2Entity
72
73
  create_payment_body = {
73
74
  destination_reference: params[:destination_reference],
74
75
  destination_type: params[:destination_type],
76
+ description: params[:description],
77
+ category: params[:category],
78
+ tags: params[:tags],
75
79
  amount: k2_request_pay_amount,
76
80
  meta_data: k2_request_pay_metadata,
77
81
  _links: k2_request_links
@@ -1,3 +1,3 @@
1
1
  module K2ConnectRuby
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k2-connect-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DavidKar1uk1
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  - !ruby/object:Gem::Version
262
262
  version: '0'
263
263
  requirements: []
264
- rubygems_version: 3.0.6
264
+ rubygems_version: 3.0.3
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Ruby SDK for the Kopo Kopo K2 Connect API.