omise 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/code-coverage.yml +27 -0
- data/CHANGELOG.md +4 -0
- data/lib/omise/charge.rb +1 -1
- data/lib/omise/version.rb +1 -1
- data/omise.gemspec +1 -0
- data/sonar-project.properties +3 -0
- data/test/fixtures/api.omise.co/charges/chrg_test_5x8glktwl62j63dr3me-get.json +99 -0
- data/test/omise/test_charge.rb +25 -0
- data/test/omise/test_http_logger.rb +1 -1
- data/test/support.rb +7 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff6023854587a10ee706952df91b1fbb5fb71a0ba31548735c1bd2f8400bf65e
|
4
|
+
data.tar.gz: 48e83f9d73465c8bb53545e86a0d6f0b32ee6162c143d72cc34cbaa2774bf120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f85290d51701920bb0e43cdc6c0a80f550bf6e2c579f8ed862b410ac00d24e3ad69c3a88ae79d7089cf704a8dc8734d6a8665578f79ce45ed85cc0c79b41d5d8
|
7
|
+
data.tar.gz: 352db370629f9fbe0221783c8ec64e278096d7e633919ebff92a2859fc359cdf022dacc22f813f0fb372ac66cf64aac2d4a8bc10dfdfed9c164432e83d661f50
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Push Test Coverage to SonarCloud
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v3
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: "3.2"
|
14
|
+
bundler-cache: true
|
15
|
+
- name: Build and test with Rake
|
16
|
+
run: |
|
17
|
+
gem install bundler
|
18
|
+
bundle install --jobs 4 --retry 3
|
19
|
+
bundle exec rake test
|
20
|
+
- run: |
|
21
|
+
rm -rf vendor
|
22
|
+
- name: Fix Code Coverage Paths
|
23
|
+
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage/coverage.json
|
24
|
+
- name: SonarCloud Scan
|
25
|
+
uses: SonarSource/sonarcloud-github-action@master
|
26
|
+
env:
|
27
|
+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
An [unreleased] version is not available on rubygems and is subject to changes and must not be considered final. Elements of unreleased list may be edited or removed at any time.
|
4
4
|
|
5
|
+
## [0.11.0] 2023-10-03
|
6
|
+
|
7
|
+
- [Added] Support partial capture of charges (https://github.com/omise/omise-ruby/pull/55)
|
8
|
+
|
5
9
|
## [0.10.1] 2023-04-20
|
6
10
|
|
7
11
|
- [Updated] Updated test case for ruby >= 3.0 (https://github.com/omise/omise-ruby/pull/48)
|
data/lib/omise/charge.rb
CHANGED
data/lib/omise/version.rb
CHANGED
data/omise.gemspec
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
{
|
2
|
+
"object": "charge",
|
3
|
+
"id": "chrg_test_5x8glktwl62j63dr3me",
|
4
|
+
"location": "/charges/chrg_test_5x8glktwl62j63dr3me",
|
5
|
+
"amount": 100000,
|
6
|
+
"authorization_type": "pre_auth",
|
7
|
+
"authorized_amount": 100000,
|
8
|
+
"captured_amount": 3000,
|
9
|
+
"net": 2882,
|
10
|
+
"fee": 110,
|
11
|
+
"fee_vat": 8,
|
12
|
+
"interest": 0,
|
13
|
+
"interest_vat": 0,
|
14
|
+
"funding_amount": 3000,
|
15
|
+
"refunded_amount": 0,
|
16
|
+
"transaction_fees": {
|
17
|
+
"fee_flat": "0.0",
|
18
|
+
"fee_rate": "3.65",
|
19
|
+
"vat_rate": "7.0"
|
20
|
+
},
|
21
|
+
"platform_fee": {
|
22
|
+
"fixed": null,
|
23
|
+
"amount": null,
|
24
|
+
"percentage": null
|
25
|
+
},
|
26
|
+
"currency": "THB",
|
27
|
+
"funding_currency": "THB",
|
28
|
+
"ip": null,
|
29
|
+
"refunds": {
|
30
|
+
"object": "list",
|
31
|
+
"data": [],
|
32
|
+
"limit": 20,
|
33
|
+
"offset": 0,
|
34
|
+
"total": 0,
|
35
|
+
"location": "/charges/chrg_test_5x8glktwl62j63dr3me/refunds",
|
36
|
+
"order": "chronological",
|
37
|
+
"from": "1970-01-01T00:00:00Z",
|
38
|
+
"to": "2023-09-26T06:15:31Z"
|
39
|
+
},
|
40
|
+
"link": null,
|
41
|
+
"description": null,
|
42
|
+
"metadata": {},
|
43
|
+
"card": {
|
44
|
+
"object": "card",
|
45
|
+
"id": "card_test_5x17kjqylbrla8t3elw",
|
46
|
+
"livemode": false,
|
47
|
+
"location": "/customers/cust_test_5x17kjuemequnrjiy3y/cards/card_test_5x17kjqylbrla8t3elw",
|
48
|
+
"deleted": false,
|
49
|
+
"street1": null,
|
50
|
+
"street2": null,
|
51
|
+
"city": "Bangkok",
|
52
|
+
"state": null,
|
53
|
+
"phone_number": null,
|
54
|
+
"postal_code": "10320",
|
55
|
+
"country": "us",
|
56
|
+
"financing": "credit",
|
57
|
+
"bank": "JPMORGAN CHASE BANK N.A.",
|
58
|
+
"brand": "Visa",
|
59
|
+
"fingerprint": "ZmYHTfxzcB4xH5GTzXaPWRRpScr5nGNEDaPJ2XYJQfw=",
|
60
|
+
"first_digits": null,
|
61
|
+
"last_digits": "4242",
|
62
|
+
"name": "JOHN DOE",
|
63
|
+
"expiration_month": 2,
|
64
|
+
"expiration_year": 2024,
|
65
|
+
"security_code_check": true,
|
66
|
+
"tokenization_method": null,
|
67
|
+
"created_at": "2023-09-07T17:20:36Z"
|
68
|
+
},
|
69
|
+
"source": null,
|
70
|
+
"schedule": null,
|
71
|
+
"customer": "cust_test_5x17kjuemequnrjiy3y",
|
72
|
+
"dispute": null,
|
73
|
+
"transaction": "trxn_test_5x8gll1ic0gxf8y4wfd",
|
74
|
+
"failure_code": null,
|
75
|
+
"failure_message": null,
|
76
|
+
"status": "successful",
|
77
|
+
"authorize_uri": null,
|
78
|
+
"return_uri": null,
|
79
|
+
"created_at": "2023-09-26T06:15:17Z",
|
80
|
+
"paid_at": "2023-09-26T06:15:17Z",
|
81
|
+
"expires_at": "2023-10-03T06:15:16Z",
|
82
|
+
"expired_at": null,
|
83
|
+
"reversed_at": null,
|
84
|
+
"zero_interest_installments": false,
|
85
|
+
"branch": null,
|
86
|
+
"terminal": null,
|
87
|
+
"device": null,
|
88
|
+
"authorized": true,
|
89
|
+
"capturable": false,
|
90
|
+
"capture": false,
|
91
|
+
"disputable": true,
|
92
|
+
"livemode": false,
|
93
|
+
"refundable": true,
|
94
|
+
"reversed": false,
|
95
|
+
"reversible": false,
|
96
|
+
"voided": false,
|
97
|
+
"paid": true,
|
98
|
+
"expired": false
|
99
|
+
}
|
data/test/omise/test_charge.rb
CHANGED
@@ -12,6 +12,15 @@ class TestCharge < Omise::Test
|
|
12
12
|
assert_equal "chrg_test_4yq7duw15p9hdrjp8oq", charge.id
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_that_we_can_create_a_partial_charge
|
16
|
+
@partial_charge_create = Omise::Charge.new(JSON.load('{ "capture": false,"authorization_type":"pre_auth","captured_amount": 0 }'))
|
17
|
+
|
18
|
+
assert_instance_of Omise::Charge, @partial_charge_create
|
19
|
+
assert_equal false, @partial_charge_create['capture']
|
20
|
+
assert_equal "pre_auth", @partial_charge_create.authorization_type
|
21
|
+
assert_equal 0, @partial_charge_create.captured_amount
|
22
|
+
end
|
23
|
+
|
15
24
|
def test_that_we_can_create_a_charge_even_if_api_key_is_nil
|
16
25
|
without_keys do
|
17
26
|
charge = Omise::Charge.create(key: "skey_test_4yq6tct0lblmed2yp5t")
|
@@ -44,6 +53,18 @@ class TestCharge < Omise::Test
|
|
44
53
|
assert_instance_of Omise::RefundList, @charge.refunds
|
45
54
|
end
|
46
55
|
|
56
|
+
def test_that_we_can_retrieve_a_partial_charge
|
57
|
+
@partialCharge = Omise::Charge.retrieve("chrg_test_5x8glktwl62j63dr3me")
|
58
|
+
|
59
|
+
assert_instance_of Omise::Charge, @partialCharge
|
60
|
+
assert_equal "chrg_test_5x8glktwl62j63dr3me", @partialCharge.id
|
61
|
+
assert_equal "pre_auth", @partialCharge.authorization_type
|
62
|
+
assert_equal 100000, @partialCharge.authorized_amount
|
63
|
+
assert_equal 3000, @partialCharge.captured_amount
|
64
|
+
assert_equal false, @partialCharge['capture']
|
65
|
+
|
66
|
+
end
|
67
|
+
|
47
68
|
def test_that_we_can_list_all_charge
|
48
69
|
charges = Omise::Charge.list
|
49
70
|
|
@@ -107,6 +128,10 @@ class TestCharge < Omise::Test
|
|
107
128
|
assert @charge.capture
|
108
129
|
end
|
109
130
|
|
131
|
+
def test_that_we_can_send_a_capture_request_with_parameters
|
132
|
+
assert @charge.capture({capture_amount:3000})
|
133
|
+
end
|
134
|
+
|
110
135
|
def test_that_we_can_send_a_reverse_request
|
111
136
|
assert @charge.reverse
|
112
137
|
end
|
data/test/support.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Clart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '5.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description:
|
98
112
|
email:
|
99
113
|
- robin@omise.co
|
@@ -101,6 +115,7 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- ".github/workflows/code-coverage.yml"
|
104
119
|
- ".github/workflows/publish.yml"
|
105
120
|
- ".github/workflows/ruby.yml"
|
106
121
|
- ".gitignore"
|
@@ -157,6 +172,7 @@ files:
|
|
157
172
|
- lib/omise/vault.rb
|
158
173
|
- lib/omise/version.rb
|
159
174
|
- omise.gemspec
|
175
|
+
- sonar-project.properties
|
160
176
|
- test/fixtures/api.omise.co/account-get.json
|
161
177
|
- test/fixtures/api.omise.co/account-patch.json
|
162
178
|
- test/fixtures/api.omise.co/balance-get.json
|
@@ -180,6 +196,7 @@ files:
|
|
180
196
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/404-get.json
|
181
197
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json
|
182
198
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/reverse-post.json
|
199
|
+
- test/fixtures/api.omise.co/charges/chrg_test_5x8glktwl62j63dr3me-get.json
|
183
200
|
- test/fixtures/api.omise.co/customers-get.json
|
184
201
|
- test/fixtures/api.omise.co/customers-post.json
|
185
202
|
- test/fixtures/api.omise.co/customers/404-get.json
|
@@ -317,6 +334,7 @@ test_files:
|
|
317
334
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/404-get.json
|
318
335
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/refunds/rfnd_test_4yqmv79ahghsiz23y3c-get.json
|
319
336
|
- test/fixtures/api.omise.co/charges/chrg_test_4yq7duw15p9hdrjp8oq/reverse-post.json
|
337
|
+
- test/fixtures/api.omise.co/charges/chrg_test_5x8glktwl62j63dr3me-get.json
|
320
338
|
- test/fixtures/api.omise.co/customers-get.json
|
321
339
|
- test/fixtures/api.omise.co/customers-post.json
|
322
340
|
- test/fixtures/api.omise.co/customers/404-get.json
|