xendit-client 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -2
- data/lib/xendit/api_client.rb +8 -8
- data/lib/xendit/json_serializer.rb +1 -1
- data/lib/xendit/resources/e_wallet.rb +33 -0
- data/lib/xendit/resources/invoice.rb +10 -10
- data/lib/xendit/resources/payout.rb +18 -2
- data/lib/xendit/resources/refund.rb +19 -0
- data/lib/xendit/resources.rb +2 -0
- data/lib/xendit/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85d38404db7e7fd54741410bcb7462c1ff25fd3f63a1f7a446e6bab7829936b4
|
4
|
+
data.tar.gz: cbedfe113514988cc5b9eb6d2f3b0bfda351219577af6f26d503d3de6e2224bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bf4ce9102dcbfaefb62ca0a1af3bcf8cc203c6e4f6a88207cc501f7b3b9c279c3ab8661b2ce5bfa8010b65724f52fd2eb3228f587aee297f27aa9f0a7241d32
|
7
|
+
data.tar.gz: e4ec99cd7eeb999d48669f9c8fd6c49b314434143ed94a2836a97f91276eea74371cae22aa12b71114378b996117c310d8f6e9b0ff75c6163a4f206dd181a927
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xendit-client (0.2
|
4
|
+
xendit-client (0.5.2)
|
5
5
|
faraday (~> 2.7.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
10
|
+
base64 (0.2.0)
|
11
|
+
faraday (2.7.12)
|
12
|
+
base64
|
11
13
|
faraday-net_http (>= 2.0, < 3.1)
|
12
14
|
ruby2_keywords (>= 0.0.4)
|
13
15
|
faraday-net_http (3.0.2)
|
data/lib/xendit/api_client.rb
CHANGED
@@ -6,23 +6,23 @@ require_relative 'errors'
|
|
6
6
|
module Xendit
|
7
7
|
class ApiClient
|
8
8
|
class << self
|
9
|
-
def get(url, params
|
10
|
-
conn = create_connection()
|
9
|
+
def get(url, headers: {}, params: nil)
|
10
|
+
conn = create_connection(headers)
|
11
11
|
response = conn.get(url, params)
|
12
12
|
handle_response(response)
|
13
13
|
end
|
14
14
|
|
15
|
-
def post(url, body
|
16
|
-
conn = create_connection()
|
15
|
+
def post(url, headers: {}, body: {})
|
16
|
+
conn = create_connection(headers)
|
17
17
|
response = conn.post(url, JSONSerializer.encode(body))
|
18
18
|
handle_response(response)
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
|
-
|
22
|
+
|
23
23
|
def create_connection(additional_headers = {})
|
24
24
|
if Xendit.api_key.nil? || Xendit.api_key == ""
|
25
|
-
raise "Please configure your API key"
|
25
|
+
raise "Please configure your API key"
|
26
26
|
end
|
27
27
|
|
28
28
|
default_headers = {
|
@@ -32,7 +32,7 @@ module Xendit
|
|
32
32
|
}
|
33
33
|
|
34
34
|
default_headers = default_headers.merge!(additional_headers) if additional_headers != {}
|
35
|
-
|
35
|
+
|
36
36
|
Faraday.new(
|
37
37
|
url: Xendit.base_url,
|
38
38
|
headers: default_headers
|
@@ -53,4 +53,4 @@ module Xendit
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
end
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative '../api_client'
|
2
|
+
|
3
|
+
module Xendit
|
4
|
+
class EWallet
|
5
|
+
PATH = "ewallets/charges".freeze
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def get_charge_status(charge_id, **opts)
|
9
|
+
ApiClient.get "#{PATH}/#{charge_id}", opts
|
10
|
+
end
|
11
|
+
|
12
|
+
def charge(**opts)
|
13
|
+
ApiClient.post PATH, opts
|
14
|
+
end
|
15
|
+
|
16
|
+
def void_charge(charge_id, **opts)
|
17
|
+
ApiClient.post "#{PATH}/#{charge_id}/void", opts
|
18
|
+
end
|
19
|
+
|
20
|
+
def refund(charge_id, **opts)
|
21
|
+
ApiClient.post "#{PATH}/#{charge_id}/refunds", opts
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_refund(charge_id, refund_id, **opts)
|
25
|
+
ApiClient.get "#{PATH}/#{charge_id}/refunds/#{refund_id}", opts
|
26
|
+
end
|
27
|
+
|
28
|
+
def list_refunds(**opts)
|
29
|
+
ApiClient.get "#{PATH}/#{charge_id}/refunds", opts
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
require_relative '../api_client'
|
2
2
|
|
3
3
|
module Xendit
|
4
|
-
class Invoice
|
4
|
+
class Invoice
|
5
5
|
class << self
|
6
|
-
def get(invoice_id)
|
7
|
-
ApiClient.get "v2/invoices/#{invoice_id}"
|
6
|
+
def get(invoice_id, **opts)
|
7
|
+
ApiClient.get "v2/invoices/#{invoice_id}", opts
|
8
8
|
end
|
9
9
|
|
10
|
-
def create(
|
11
|
-
ApiClient.post "v2/invoices/",
|
10
|
+
def create(**opts)
|
11
|
+
ApiClient.post "v2/invoices/", opts
|
12
12
|
end
|
13
13
|
|
14
|
-
def expire(invoice_id)
|
15
|
-
ApiClient.post "invoices/#{invoice_id}/expire!"
|
14
|
+
def expire(invoice_id, **opts)
|
15
|
+
ApiClient.post "invoices/#{invoice_id}/expire!", opts
|
16
16
|
end
|
17
17
|
|
18
|
-
def get_all
|
19
|
-
ApiClient.get "v2/invoices"
|
18
|
+
def get_all(**opts)
|
19
|
+
ApiClient.get "v2/invoices", opts
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
23
|
+
end
|
@@ -3,8 +3,24 @@ require_relative '../api_client'
|
|
3
3
|
module Xendit
|
4
4
|
class Payout
|
5
5
|
class << self
|
6
|
-
def channels(**
|
7
|
-
ApiClient.get "payouts_channels",
|
6
|
+
def channels(**opts)
|
7
|
+
ApiClient.get "payouts_channels", opts
|
8
|
+
end
|
9
|
+
|
10
|
+
def create(**opts)
|
11
|
+
ApiClient.post "v2/payouts", opts
|
12
|
+
end
|
13
|
+
|
14
|
+
def cancel(id, **opts)
|
15
|
+
ApiClient.post "v2/payouts/#{id}/cancel", opts
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_by_id(id, **opts)
|
19
|
+
ApiClient.get "v2/payouts/#{id}", opts
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_by_reference_id(reference_id, **opts)
|
23
|
+
ApiClient.get "v2/payouts", {reference_id: reference_id}, opts
|
8
24
|
end
|
9
25
|
end
|
10
26
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative '../api_client'
|
2
|
+
|
3
|
+
module Xendit
|
4
|
+
class Refund
|
5
|
+
class << self
|
6
|
+
def create(**opts)
|
7
|
+
ApiClient.post "refunds", opts
|
8
|
+
end
|
9
|
+
|
10
|
+
def list(**opts)
|
11
|
+
ApiClient.get "refunds", opts
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_by_id(id, **opts)
|
15
|
+
ApiClient.get "refunds/#{id}", opts
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/xendit/resources.rb
CHANGED
data/lib/xendit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xendit-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nasrul Gunawan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '13.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- search.nasrul@gmail.com
|
44
44
|
executables: []
|
@@ -56,8 +56,10 @@ files:
|
|
56
56
|
- lib/xendit/errors.rb
|
57
57
|
- lib/xendit/json_serializer.rb
|
58
58
|
- lib/xendit/resources.rb
|
59
|
+
- lib/xendit/resources/e_wallet.rb
|
59
60
|
- lib/xendit/resources/invoice.rb
|
60
61
|
- lib/xendit/resources/payout.rb
|
62
|
+
- lib/xendit/resources/refund.rb
|
61
63
|
- lib/xendit/response.rb
|
62
64
|
- lib/xendit/version.rb
|
63
65
|
- lib/xendit/webhook.rb
|
@@ -67,7 +69,7 @@ licenses: []
|
|
67
69
|
metadata:
|
68
70
|
homepage_uri: https://github.com/nasrulgunawan/xendit-client
|
69
71
|
source_code_uri: https://github.com/nasrulgunawan/xendit-client
|
70
|
-
post_install_message:
|
72
|
+
post_install_message:
|
71
73
|
rdoc_options: []
|
72
74
|
require_paths:
|
73
75
|
- lib
|
@@ -82,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
84
|
- !ruby/object:Gem::Version
|
83
85
|
version: '0'
|
84
86
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
86
|
-
signing_key:
|
87
|
+
rubygems_version: 3.1.6
|
88
|
+
signing_key:
|
87
89
|
specification_version: 4
|
88
90
|
summary: Xendit Ruby Client Library
|
89
91
|
test_files: []
|