jamm 1.0.8 → 1.0.9
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 +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +9 -1
- data/Rakefile +5 -0
- data/lib/jamm/api/api/customer_api.rb +68 -10
- data/lib/jamm/api/api/healthcheck_api.rb +2 -2
- data/lib/jamm/api/api/payment_api.rb +145 -20
- data/lib/jamm/api/api/webhook_service_api.rb +82 -0
- data/lib/jamm/api/api_client.rb +2 -2
- data/lib/jamm/api/api_error.rb +2 -2
- data/lib/jamm/api/configuration.rb +2 -2
- data/lib/jamm/api/models/customer_service_update_customer_body.rb +9 -4
- data/lib/jamm/api/models/{rpc_status.rb → googlerpc_status.rb} +5 -5
- data/lib/jamm/api/models/protobuf_any.rb +2 -2
- data/lib/jamm/api/models/v1_add_charge_request.rb +2 -2
- data/lib/jamm/api/models/v1_add_charge_response.rb +2 -2
- data/lib/jamm/api/models/v1_buyer.rb +11 -3
- data/lib/jamm/api/models/v1_charge.rb +2 -2
- data/lib/jamm/api/models/v1_charge_message.rb +292 -0
- data/lib/jamm/api/models/v1_charge_message_status.rb +44 -0
- data/lib/jamm/api/models/v1_charge_result.rb +285 -0
- data/lib/jamm/api/models/v1_contract.rb +2 -2
- data/lib/jamm/api/models/v1_contract_status.rb +2 -2
- data/lib/jamm/api/models/v1_create_contract_with_charge_request.rb +2 -2
- data/lib/jamm/api/models/v1_create_contract_with_charge_response.rb +2 -2
- data/lib/jamm/api/models/v1_create_contract_without_charge_request.rb +2 -2
- data/lib/jamm/api/models/v1_create_contract_without_charge_response.rb +2 -2
- data/lib/jamm/api/models/v1_create_customer_request.rb +2 -2
- data/lib/jamm/api/models/v1_create_customer_response.rb +2 -2
- data/lib/jamm/api/models/v1_customer.rb +9 -4
- data/lib/jamm/api/models/v1_delete_customer_response.rb +2 -2
- data/lib/jamm/api/models/v1_event_type.rb +45 -0
- data/lib/jamm/api/models/v1_get_charge_response.rb +212 -0
- data/lib/jamm/api/models/v1_get_charges_response.rb +214 -0
- data/lib/jamm/api/models/v1_get_contract_response.rb +13 -13
- data/lib/jamm/api/models/v1_get_customer_response.rb +2 -2
- data/lib/jamm/api/models/v1_initial_charge.rb +2 -2
- data/lib/jamm/api/models/v1_merchant.rb +2 -2
- data/lib/jamm/api/models/v1_merchant_customer.rb +2 -2
- data/lib/jamm/api/models/v1_merchant_webhook_message.rb +259 -0
- data/lib/jamm/api/models/v1_message_response.rb +212 -0
- data/lib/jamm/api/models/v1_pagination.rb +212 -0
- data/lib/jamm/api/models/v1_payment_link.rb +2 -2
- data/lib/jamm/api/models/v1_ping_response.rb +2 -2
- data/lib/jamm/api/models/v1_update_customer_response.rb +2 -2
- data/lib/jamm/api/models/v1_url.rb +2 -2
- data/lib/jamm/api/models/v1_withdraw_request.rb +212 -0
- data/lib/jamm/api/models/v1_withdraw_response.rb +212 -0
- data/lib/jamm/api/version.rb +2 -2
- data/lib/jamm/api.rb +15 -3
- data/lib/jamm/api_patches.rb +14 -0
- data/lib/jamm/charge.rb +43 -0
- data/lib/jamm/client.rb +1 -1
- data/lib/jamm/contract.rb +35 -0
- data/lib/jamm/customer.rb +24 -9
- data/lib/jamm/healthcheck.rb +14 -0
- data/lib/jamm/openapi.rb +10 -0
- data/lib/jamm/version.rb +1 -1
- data/lib/jamm/webhook.rb +35 -0
- data/lib/jamm.rb +16 -14
- metadata +21 -4
- data/lib/jamm/payment.rb +0 -27
data/lib/jamm/openapi.rb
ADDED
data/lib/jamm/version.rb
CHANGED
data/lib/jamm/webhook.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
require 'base64'
|
6
|
+
require 'jamm/errors'
|
7
|
+
|
8
|
+
module Jamm
|
9
|
+
module Webhook
|
10
|
+
# Parse command is for parsing the received webhook message.
|
11
|
+
# It does not call anything remotely, instead returns the suitable object.
|
12
|
+
def self.parse(json)
|
13
|
+
out = {
|
14
|
+
id: json[:id],
|
15
|
+
signature: json[:signature],
|
16
|
+
merchant_id: json[:merchantId],
|
17
|
+
event_type: json[:eventType],
|
18
|
+
content: nil,
|
19
|
+
created_at: json[:createdAt]
|
20
|
+
}
|
21
|
+
|
22
|
+
case json[:eventType]
|
23
|
+
when Jamm::OpenAPI::EventType::CHARGE_CREATED
|
24
|
+
out[:content] = Jamm::OpenAPI::ChargeMessage.new(json[:content])
|
25
|
+
return out
|
26
|
+
|
27
|
+
when Jamm::OpenAPI::EventType::CHARGE_UPDATED
|
28
|
+
out[:content] = Jamm::OpenAPI::ChargeMessage.new(json[:content])
|
29
|
+
return out
|
30
|
+
end
|
31
|
+
|
32
|
+
raise Jamm::Error, 'Unknown event type'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/jamm.rb
CHANGED
@@ -4,15 +4,21 @@ require 'rest-client'
|
|
4
4
|
require 'openssl'
|
5
5
|
require 'json'
|
6
6
|
|
7
|
-
require 'jamm/api'
|
8
7
|
require 'jamm/client'
|
9
8
|
require 'jamm/errors'
|
10
9
|
require 'jamm/oauth'
|
10
|
+
require 'jamm/openapi'
|
11
11
|
require 'jamm/version'
|
12
12
|
|
13
13
|
# OpenAPI wrappers
|
14
|
+
require 'jamm/charge'
|
14
15
|
require 'jamm/customer'
|
15
|
-
require 'jamm/
|
16
|
+
require 'jamm/contract'
|
17
|
+
require 'jamm/healthcheck'
|
18
|
+
require 'jamm/webhook'
|
19
|
+
|
20
|
+
# Patches
|
21
|
+
require 'jamm/api_patches'
|
16
22
|
|
17
23
|
# Jamm Ruby SDK
|
18
24
|
module Jamm
|
@@ -23,10 +29,6 @@ module Jamm
|
|
23
29
|
@read_timeout = 90
|
24
30
|
@max_retry = 0
|
25
31
|
|
26
|
-
# Include OpenAPI generated module into root Jamm namespace.
|
27
|
-
# The OpenAPI sub-modules and methods can be accessed via Jamm::{foo}
|
28
|
-
include Api
|
29
|
-
|
30
32
|
class << self
|
31
33
|
attr_accessor :api, :client_id, :client_secret, :api_base, :env, :oauth_base, :api_version, :connect_base,
|
32
34
|
:openapi, :open_timeout, :read_timeout, :max_retry, :retry_initial_delay, :retry_max_delay
|
@@ -40,20 +42,20 @@ module Jamm
|
|
40
42
|
when 'prod'
|
41
43
|
self.oauth_base = 'https://merchant-identity.jamm-pay.jp'
|
42
44
|
|
43
|
-
self.openapi = Jamm::ApiClient.new
|
45
|
+
self.openapi = Jamm::OpenAPI::ApiClient.new
|
44
46
|
openapi.config.host = 'api.jamm-pay.jp'
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
# self.oauth_base = "https://merchant-identity.#{env}.jamm-pay.jp"
|
49
|
-
|
50
|
-
# self.openapi = Jamm::ApiClient.new
|
51
|
-
# openapi.config.host = 'api.jamm.test'
|
48
|
+
when 'local'
|
49
|
+
self.oauth_base = 'https://merchant-identity.develop.jamm-pay.jp'
|
52
50
|
|
51
|
+
self.openapi = Jamm::OpenAPI::ApiClient.new
|
52
|
+
openapi.config.host = 'api.jamm.test'
|
53
|
+
openapi.config.verify_ssl = false
|
54
|
+
openapi.config.verify_ssl_host = false
|
53
55
|
else
|
54
56
|
self.oauth_base = "https://merchant-identity.#{env}.jamm-pay.jp"
|
55
57
|
|
56
|
-
self.openapi = Jamm::ApiClient.new
|
58
|
+
self.openapi = Jamm::OpenAPI::ApiClient.new
|
57
59
|
openapi.config.host = "api.#{env}.jamm-pay.jp"
|
58
60
|
end
|
59
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -63,16 +63,20 @@ files:
|
|
63
63
|
- lib/jamm/api/api/customer_api.rb
|
64
64
|
- lib/jamm/api/api/healthcheck_api.rb
|
65
65
|
- lib/jamm/api/api/payment_api.rb
|
66
|
+
- lib/jamm/api/api/webhook_service_api.rb
|
66
67
|
- lib/jamm/api/api_client.rb
|
67
68
|
- lib/jamm/api/api_error.rb
|
68
69
|
- lib/jamm/api/configuration.rb
|
69
70
|
- lib/jamm/api/models/customer_service_update_customer_body.rb
|
71
|
+
- lib/jamm/api/models/googlerpc_status.rb
|
70
72
|
- lib/jamm/api/models/protobuf_any.rb
|
71
|
-
- lib/jamm/api/models/rpc_status.rb
|
72
73
|
- lib/jamm/api/models/v1_add_charge_request.rb
|
73
74
|
- lib/jamm/api/models/v1_add_charge_response.rb
|
74
75
|
- lib/jamm/api/models/v1_buyer.rb
|
75
76
|
- lib/jamm/api/models/v1_charge.rb
|
77
|
+
- lib/jamm/api/models/v1_charge_message.rb
|
78
|
+
- lib/jamm/api/models/v1_charge_message_status.rb
|
79
|
+
- lib/jamm/api/models/v1_charge_result.rb
|
76
80
|
- lib/jamm/api/models/v1_contract.rb
|
77
81
|
- lib/jamm/api/models/v1_contract_status.rb
|
78
82
|
- lib/jamm/api/models/v1_create_contract_with_charge_request.rb
|
@@ -83,22 +87,35 @@ files:
|
|
83
87
|
- lib/jamm/api/models/v1_create_customer_response.rb
|
84
88
|
- lib/jamm/api/models/v1_customer.rb
|
85
89
|
- lib/jamm/api/models/v1_delete_customer_response.rb
|
90
|
+
- lib/jamm/api/models/v1_event_type.rb
|
91
|
+
- lib/jamm/api/models/v1_get_charge_response.rb
|
92
|
+
- lib/jamm/api/models/v1_get_charges_response.rb
|
86
93
|
- lib/jamm/api/models/v1_get_contract_response.rb
|
87
94
|
- lib/jamm/api/models/v1_get_customer_response.rb
|
88
95
|
- lib/jamm/api/models/v1_initial_charge.rb
|
89
96
|
- lib/jamm/api/models/v1_merchant.rb
|
90
97
|
- lib/jamm/api/models/v1_merchant_customer.rb
|
98
|
+
- lib/jamm/api/models/v1_merchant_webhook_message.rb
|
99
|
+
- lib/jamm/api/models/v1_message_response.rb
|
100
|
+
- lib/jamm/api/models/v1_pagination.rb
|
91
101
|
- lib/jamm/api/models/v1_payment_link.rb
|
92
102
|
- lib/jamm/api/models/v1_ping_response.rb
|
93
103
|
- lib/jamm/api/models/v1_update_customer_response.rb
|
94
104
|
- lib/jamm/api/models/v1_url.rb
|
105
|
+
- lib/jamm/api/models/v1_withdraw_request.rb
|
106
|
+
- lib/jamm/api/models/v1_withdraw_response.rb
|
95
107
|
- lib/jamm/api/version.rb
|
108
|
+
- lib/jamm/api_patches.rb
|
109
|
+
- lib/jamm/charge.rb
|
96
110
|
- lib/jamm/client.rb
|
111
|
+
- lib/jamm/contract.rb
|
97
112
|
- lib/jamm/customer.rb
|
98
113
|
- lib/jamm/errors.rb
|
114
|
+
- lib/jamm/healthcheck.rb
|
99
115
|
- lib/jamm/oauth.rb
|
100
|
-
- lib/jamm/
|
116
|
+
- lib/jamm/openapi.rb
|
101
117
|
- lib/jamm/version.rb
|
118
|
+
- lib/jamm/webhook.rb
|
102
119
|
homepage: https://jamm-pay.jp
|
103
120
|
licenses:
|
104
121
|
- MIT
|
data/lib/jamm/payment.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rest-client'
|
4
|
-
require 'json'
|
5
|
-
require 'base64'
|
6
|
-
require 'jamm/errors'
|
7
|
-
|
8
|
-
module Jamm
|
9
|
-
module Payment
|
10
|
-
def self.contract_with_charge(**params)
|
11
|
-
request = Jamm::CreateContractWithChargeRequest.new(params)
|
12
|
-
|
13
|
-
Jamm::PaymentApi.new(Jamm::Client.handler).create_contract_with_charge(request)
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.get_contract(contract:)
|
17
|
-
Jamm::PaymentApi.new(Jamm::Client.handler).get_contract(contract)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.add_charge(**params)
|
21
|
-
request = Jamm::AddChargeRequest.new(params)
|
22
|
-
|
23
|
-
p = Jamm::PaymentApi.new(Jamm::Client.handler)
|
24
|
-
p.add_charge(request)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|