orchard-api-client-anm 0.1.7 → 0.1.10

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: b01c27aee4d035e7d80aa0883f904191f0ebddef0d2a4ef71edfa75f7be4337d
4
- data.tar.gz: 484ebb1cc3299a5b5b0ff3ea588a556d33a0512f36073d72eee1632002d6c301
3
+ metadata.gz: b863d46441447a38bd375939be58694361aa9d2693accd46257300cd437a077d
4
+ data.tar.gz: c0325ea8724cffd613ab59ad8701aee496b9b457c41e5f6962929e6e3faf52b9
5
5
  SHA512:
6
- metadata.gz: b4e882cc52602b0896650512bdb1b3d77a8dd3f4126b4006e866ced6a38356cc6a584499140d566e230922235aafd5ee2f489fd6a6b64f63724fd0d898505423
7
- data.tar.gz: 9080ddb4ad66e64a7f3d4382556dc9fa3387f4370c40e339dbc87ae29b3d31f534b2498cf3c2499aa4938e2be14460c07a7d575e752200d4cdefd900085002e2
6
+ metadata.gz: 9fdff9fd96e0c69cf541be12685d189a92186dc6f613aefe454e13c9d5ad137ada45efd0a8ee1e383fa3f7614c349438157670e1a62715287572089b1a577b6e
7
+ data.tar.gz: 5d821dde0aabdbbbeb0b6bb712bc1a5b7c367cde320cc1c4c943173a8aff4d1bedc4e3546d6ee29928e6d8d66c1b7db11d4049348ac84956e7417513d8977000
@@ -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 CheckWalletBalance < Orchard::API::Base
6
+ def call
7
+ @endpoint = Orchard::API::Constants::CHECK_WALLET_BALANCE
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 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
@@ -25,6 +25,22 @@ module Orchard
25
25
  Orchard::API::CheckTransactionStatus.call(payload_with_client_data(payload), request_configurations)
26
26
  end
27
27
 
28
+ def check_wallet_balance(payload, request_configurations = {})
29
+ Orchard::API::CheckWalletBalance.call(payload_with_client_data(payload), request_configurations)
30
+ end
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
+
28
44
  private
29
45
 
30
46
  def create_connection
@@ -7,6 +7,10 @@ module Orchard
7
7
  SEND_SMS_ENDPOINT = "/sendSms"
8
8
  SERVICE_LOOKUP_REQUEST_ENDPOINT = "/get_service_lookup_req"
9
9
  CHECK_TRANSACTION_STATUS_ENDPOINT = "/checkTransaction"
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"
10
14
  end
11
15
  end
12
16
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Orchard
4
- VERSION = "0.1.7"
5
- end
4
+ VERSION = "0.1.10"
5
+ end
data/lib/orchard.rb CHANGED
@@ -9,5 +9,9 @@ require_relative "orchard/api/send_payment_request"
9
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
+ 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"
12
16
 
13
17
  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.7
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sydney Dapilah
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-26 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -85,6 +85,10 @@ files:
85
85
  - lib/orchard.rb
86
86
  - lib/orchard/api/base.rb
87
87
  - lib/orchard/api/check_transaction_status.rb
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
88
92
  - lib/orchard/api/send_payment_request.rb
89
93
  - lib/orchard/api/send_sms.rb
90
94
  - lib/orchard/api/service_lookup_request.rb