orchard-api-client-anm 0.1.8 → 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: 686070796aa97295ea62df419a9f3e3f4a40b845e077fadcc9f85e6509ba283e
4
- data.tar.gz: 7c8021f6dd5d46fc64b088688fdddf0ac1dcaa4db7abbe748c80bc74a435d118
3
+ metadata.gz: b863d46441447a38bd375939be58694361aa9d2693accd46257300cd437a077d
4
+ data.tar.gz: c0325ea8724cffd613ab59ad8701aee496b9b457c41e5f6962929e6e3faf52b9
5
5
  SHA512:
6
- metadata.gz: 77e46d159082cb8e283582e322212ce55187601f9e40362feeaaa5fb4ea16e584dc9146a479cb97a8eaead4242b3b6fb0403dee341c71aedeced354f5291391a
7
- data.tar.gz: 9d3fe5871bf92b87fc69362317bf0b676d1f2f6b84f59dcdb2c5e216cd240d1001c1fda6bf4aed6bb5104ac16065545cc66aeeb8ba1e3167d8416ddaf728a82f
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 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
@@ -29,6 +29,18 @@ 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
+
32
44
  private
33
45
 
34
46
  def create_connection
@@ -8,6 +8,9 @@ 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"
11
14
  end
12
15
  end
13
16
  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.10"
5
5
  end
data/lib/orchard.rb CHANGED
@@ -10,5 +10,8 @@ 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"
13
16
 
14
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.8
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-12-15 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
@@ -86,6 +86,9 @@ 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
91
94
  - lib/orchard/api/service_lookup_request.rb