orchard-api-client-anm 0.1.8 → 0.1.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 686070796aa97295ea62df419a9f3e3f4a40b845e077fadcc9f85e6509ba283e
4
- data.tar.gz: 7c8021f6dd5d46fc64b088688fdddf0ac1dcaa4db7abbe748c80bc74a435d118
3
+ metadata.gz: 5de005f678a0cb16e186f6190abc82538de134eb7b2574789a1b29b34237e52a
4
+ data.tar.gz: '058b93525314505e2a69d7ae336ea224e3ffe409cd0357669308572e7e9022f0'
5
5
  SHA512:
6
- metadata.gz: 77e46d159082cb8e283582e322212ce55187601f9e40362feeaaa5fb4ea16e584dc9146a479cb97a8eaead4242b3b6fb0403dee341c71aedeced354f5291391a
7
- data.tar.gz: 9d3fe5871bf92b87fc69362317bf0b676d1f2f6b84f59dcdb2c5e216cd240d1001c1fda6bf4aed6bb5104ac16065545cc66aeeb8ba1e3167d8416ddaf728a82f
6
+ metadata.gz: 511d5464e39d037db0c8e75b3c5fc0420c577d7bdf3076a66e412fd7f7aeed95cc398fabb8a2fa1e5d9364a9a1078b0772b013f4df021a60698fc303111706e5
7
+ data.tar.gz: 21412934cde75503d21f3c88f499df6716d686d8bccd0ec20eeaeb102d31ddff747206f994128fbaaa5ee952852b13e5eb7d8393a7615737735cc616ee1a770e
data/README.md CHANGED
@@ -15,16 +15,16 @@ If bundler is not being used to manage dependencies, install the gem by executin
15
15
  ```ruby
16
16
  #load the gem class
17
17
  require 'orchard'
18
-
18
+
19
19
  #Create a client object with the secret token, client token, and the url
20
20
  params = {
21
21
  secret_token: ENV['SECRET_TOKEN'],
22
22
  client_token: ENV['CLIENT_TOKEN'],
23
23
  url: ENV['ORCHARD_URL']
24
24
  }
25
-
25
+
26
26
  client = Orchard::ApiClient.new(params)
27
-
27
+
28
28
  #Use client object for various api functions
29
29
 
30
30
  #optional configuration configurations
@@ -33,13 +33,13 @@ If bundler is not being used to manage dependencies, install the gem by executin
33
33
  }
34
34
 
35
35
  #Send payment request
36
-
36
+
37
37
  randval_one = rand(999).to_s.center(3, rand(9).to_s)
38
38
  strtm = Time.new.strftime("%d%H%M%L")
39
39
  processing_id = strtm + randval_one
40
40
  trans_type = allowed_parameters['CTM(client to merchant)' / 'MTC(merchant to client)']
41
41
  nw = allowed_parameters['MTN','VOD','AIR']
42
-
42
+
43
43
  payment_request_payload = {
44
44
  customer_number: '0550000000',
45
45
  reference: 'AppsNmobile Pay',
@@ -52,7 +52,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
52
52
  client_id: ENV['SERVICE_ID'],
53
53
  voucher_code: ''
54
54
  }
55
-
55
+
56
56
  response = client.send_payment_request(payment_request_payload, request_configurations)
57
57
 
58
58
  #Send Sms
@@ -64,5 +64,5 @@ If bundler is not being used to manage dependencies, install the gem by executin
64
64
  service_id: ENV['SERVICE_ID']
65
65
  }
66
66
 
67
- response = client.send_sms(sms_payload)
67
+ response = client.send_sms(sms_payload, request_configurations)
68
68
  ```
@@ -21,14 +21,18 @@ module Orchard
21
21
  end
22
22
 
23
23
  def make_request(method)
24
- response = @connection.send(method) do |request|
24
+ @response = @connection.send(method) do |request|
25
25
  request.url @endpoint
26
26
  request.options.timeout = @timeout
27
- request.body = @payload.to_json
28
27
  request["Authorization"] = "#{@client_token}:#{compute_signature}"
28
+ if method.eql?(:get)
29
+ request.params = @payload
30
+ else
31
+ request.body = @payload.to_json
32
+ end
29
33
  end
30
34
 
31
- JSON.parse(response.body)
35
+ JSON.parse(@response.body)
32
36
  rescue StandardError => e
33
37
  error_response(e)
34
38
  end
@@ -36,7 +40,9 @@ module Orchard
36
40
  def error_response(error)
37
41
  {
38
42
  "res_code" => "999",
39
- "res_desc" => error.message
43
+ "res_desc" => @response&.reason_phrase,
44
+ "error_message" => error.message,
45
+ "error_class" => error.class
40
46
  }
41
47
  end
42
48
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orchard
4
+ module API
5
+ class CustomerDebitActivation < Orchard::API::Base
6
+ def call
7
+ @endpoint = Orchard::API::Constants::CUSTOMER_DEBIT_ACTIVATION_ENDPOINT
8
+ make_request(:post)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orchard
4
+ module API
5
+ class CustomerDebitDeactivation < Orchard::API::Base
6
+ def call
7
+ @endpoint = Orchard::API::Constants::CUSTOMER_DEBIT_DEACTIVATION_ENDPOINT
8
+ make_request(:post)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orchard
4
+ module API
5
+ class CustomerDebitInformation < Orchard::API::Base
6
+ def call
7
+ @endpoint = Orchard::API::Constants::CUSTOMER_DEBIT_INFORMATION_ENDPOINT
8
+ make_request(:get)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Orchard
4
+ module API
5
+ class SendThirdPartyRequest < Orchard::API::Base
6
+ def call
7
+ @endpoint = Orchard::API::Constants::THIRD_PARTY_REQUEST
8
+ make_request(:post)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -29,6 +29,22 @@ module Orchard
29
29
  Orchard::API::CheckWalletBalance.call(payload_with_client_data(payload), request_configurations)
30
30
  end
31
31
 
32
+ def customer_debit_information(payload, request_configurations = {})
33
+ Orchard::API::CustomerDebitInformation.call(payload_with_client_data(payload), request_configurations)
34
+ end
35
+
36
+ def customer_debit_activation(payload, request_configurations = {})
37
+ Orchard::API::CustomerDebitActivation.call(payload_with_client_data(payload), request_configurations)
38
+ end
39
+
40
+ def customer_debit_deactivation(payload, request_configurations = {})
41
+ Orchard::API::CustomerDebitDeactivation.call(payload_with_client_data(payload), request_configurations)
42
+ end
43
+
44
+ def send_third_party_request(payload, request_configurations = {})
45
+ Orchard::API::SendThirdPartyRequest.call(payload_with_client_data(payload), request_configurations)
46
+ end
47
+
32
48
  private
33
49
 
34
50
  def create_connection
@@ -8,6 +8,10 @@ module Orchard
8
8
  SERVICE_LOOKUP_REQUEST_ENDPOINT = "/get_service_lookup_req"
9
9
  CHECK_TRANSACTION_STATUS_ENDPOINT = "/checkTransaction"
10
10
  CHECK_WALLET_BALANCE = "/check_wallet_balance"
11
+ CUSTOMER_DEBIT_INFORMATION_ENDPOINT = "/get_cust_recur_debit_info"
12
+ CUSTOMER_DEBIT_ACTIVATION_ENDPOINT = "/cust_recur_debit_activation"
13
+ CUSTOMER_DEBIT_DEACTIVATION_ENDPOINT = "/cancel_cust_auto_debit_subscrip"
14
+ THIRD_PARTY_REQUEST = "/third_party_request"
11
15
  end
12
16
  end
13
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchard
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.11"
5
5
  end
data/lib/orchard.rb CHANGED
@@ -10,5 +10,9 @@ require_relative "orchard/api/send_sms"
10
10
  require_relative "orchard/api/service_lookup_request"
11
11
  require_relative "orchard/api/check_transaction_status"
12
12
  require_relative "orchard/api/check_wallet_balance"
13
+ require_relative "orchard/api/customer_debit_information"
14
+ require_relative "orchard/api/customer_debit_activation"
15
+ require_relative "orchard/api/customer_debit_deactivation"
16
+ require_relative "orchard/api/send_third_party_request"
13
17
 
14
18
  require_relative "orchard/api_client"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orchard-api-client-anm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sydney Dapilah
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -86,8 +86,12 @@ files:
86
86
  - lib/orchard/api/base.rb
87
87
  - lib/orchard/api/check_transaction_status.rb
88
88
  - lib/orchard/api/check_wallet_balance.rb
89
+ - lib/orchard/api/customer_debit_activation.rb
90
+ - lib/orchard/api/customer_debit_deactivation.rb
91
+ - lib/orchard/api/customer_debit_information.rb
89
92
  - lib/orchard/api/send_payment_request.rb
90
93
  - lib/orchard/api/send_sms.rb
94
+ - lib/orchard/api/send_third_party_request.rb
91
95
  - lib/orchard/api/service_lookup_request.rb
92
96
  - lib/orchard/api_client.rb
93
97
  - lib/orchard/constants.rb
@@ -101,7 +105,7 @@ metadata:
101
105
  allowed_push_host: https://rubygems.org
102
106
  homepage_uri: https://appsnmobilesolutions.com/services/orchard/
103
107
  source_code_uri: https://github.com/appsnmobile-solutions/orchard_api_client_gem
104
- post_install_message:
108
+ post_install_message:
105
109
  rdoc_options: []
106
110
  require_paths:
107
111
  - lib
@@ -116,8 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
120
  - !ruby/object:Gem::Version
117
121
  version: '0'
118
122
  requirements: []
119
- rubygems_version: 3.3.7
120
- signing_key:
123
+ rubygems_version: 3.0.9
124
+ signing_key:
121
125
  specification_version: 4
122
126
  summary: Orchard API client
123
127
  test_files: []