pokepay_partner_ruby_sdk 0.1.1 → 0.1.2
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.lock +7 -7
- data/README.md +14 -0
- data/docs/index.md +285 -72
- data/examples/examples.rb +178 -13
- data/lib/pokepay_partner_ruby_sdk/client.rb +9 -7
- data/lib/pokepay_partner_ruby_sdk/parameter/product.rb +21 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_check.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_cpm_transaction.rb +17 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_customer_account.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_exchange_transaction.rb +18 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_organization.rb +18 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_payment_transaction.rb +18 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_shop.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_topup_transaction.rb +17 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_topup_transaction_with_check.rb +16 -0
- data/lib/pokepay_partner_ruby_sdk/request/create_transaction.rb +5 -5
- data/lib/pokepay_partner_ruby_sdk/request/get_account.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/get_ping.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/get_private_money_organization_summaries.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/get_transaction.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/get_user.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/list_account_balances.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/list_transactions.rb +7 -4
- data/lib/pokepay_partner_ruby_sdk/request/list_transfers.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/request/send_echo.rb +4 -1
- data/lib/pokepay_partner_ruby_sdk/response/account.rb +2 -0
- data/lib/pokepay_partner_ruby_sdk/response/account_balance.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/response/account_detail.rb +24 -0
- data/lib/pokepay_partner_ruby_sdk/response/account_with_user.rb +21 -0
- data/lib/pokepay_partner_ruby_sdk/response/account_without_private_money_detail.rb +20 -0
- data/lib/pokepay_partner_ruby_sdk/response/admin_user_with_shops_and_private_moneys.rb +26 -0
- data/lib/pokepay_partner_ruby_sdk/response/bad_request.rb +11 -0
- data/lib/pokepay_partner_ruby_sdk/response/check.rb +37 -0
- data/lib/pokepay_partner_ruby_sdk/response/echo.rb +6 -3
- data/lib/pokepay_partner_ruby_sdk/response/invalid_parameters.rb +15 -0
- data/lib/pokepay_partner_ruby_sdk/response/organization.rb +3 -0
- data/lib/pokepay_partner_ruby_sdk/response/organization_summary.rb +19 -0
- data/lib/pokepay_partner_ruby_sdk/response/paginated_account_balance.rb +16 -0
- data/lib/pokepay_partner_ruby_sdk/response/paginated_private_money_organization_summaries.rb +16 -0
- data/lib/pokepay_partner_ruby_sdk/response/paginated_transaction.rb +16 -0
- data/lib/pokepay_partner_ruby_sdk/response/paginated_transfers.rb +16 -0
- data/lib/pokepay_partner_ruby_sdk/response/pagination.rb +9 -6
- data/lib/pokepay_partner_ruby_sdk/response/partner_client_not_found.rb +13 -0
- data/lib/pokepay_partner_ruby_sdk/response/partner_decryption_failed.rb +13 -0
- data/lib/pokepay_partner_ruby_sdk/response/partner_request_already_done.rb +13 -0
- data/lib/pokepay_partner_ruby_sdk/response/partner_request_expired.rb +13 -0
- data/lib/pokepay_partner_ruby_sdk/response/pong.rb +11 -0
- data/lib/pokepay_partner_ruby_sdk/response/private_money.rb +8 -0
- data/lib/pokepay_partner_ruby_sdk/response/private_money_organization_summary.rb +17 -0
- data/lib/pokepay_partner_ruby_sdk/response/response.rb +3 -3
- data/lib/pokepay_partner_ruby_sdk/response/transaction.rb +5 -1
- data/lib/pokepay_partner_ruby_sdk/response/transfer.rb +31 -0
- data/lib/pokepay_partner_ruby_sdk/response/user.rb +3 -0
- data/lib/pokepay_partner_ruby_sdk/response/user_transaction.rb +33 -0
- data/lib/pokepay_partner_ruby_sdk/version.rb +1 -1
- data/lib/pokepay_partner_ruby_sdk.rb +43 -6
- data/pokepay_partner_ruby_sdk.gemspec +4 -4
- metadata +47 -10
- data/lib/pokepay_partner_ruby_sdk/response/transactions.rb +0 -15
data/examples/examples.rb
CHANGED
@@ -1,16 +1,181 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require "pokepay_partner_ruby_sdk"
|
3
|
+
client = Pokepay::Client.new("~/.pokepay/config.ini")
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
shop_id = "8b9fbece-73fa-494d-bad5-c7fd9e52f9a0" # 店舗ID
|
6
|
+
shop_account_id = "1e1c912d-b055-4fd7-9863-7e60a8f72f23" # 店舗アカウントID
|
7
|
+
customer_id = "78e56df5-dd71-4554-86e5-b0eb8d3781cb" # エンドユーザーのID
|
8
|
+
customer_account_id = "c025d1cb-f5e9-47d0-b87f-f6366df26c1b" # エンドユーザーアカウントID
|
9
|
+
money_id = "4b138a4c-8944-4f98-a5c4-96d3c1c415eb" # 送るマネーのID
|
10
|
+
|
11
|
+
## echo
|
12
|
+
print("=== echo ==========================\n")
|
13
|
+
request = Pokepay::Request::SendEcho.new('hello')
|
14
|
+
response = client.send(request)
|
15
|
+
|
16
|
+
p response.code
|
17
|
+
# => 200
|
18
|
+
|
19
|
+
p response.body
|
20
|
+
# => {"status"=>"ok", "message"=>"hello"}
|
21
|
+
|
22
|
+
p response.object
|
23
|
+
# => #<Pokepay::Response::Echo:0x000055fd7cc0db20 @message="hello">
|
24
|
+
|
25
|
+
p response.object.message
|
26
|
+
# => "hello"
|
27
|
+
|
28
|
+
## paging
|
29
|
+
|
30
|
+
print("=== paging ==========================\n")
|
31
|
+
|
32
|
+
request = Pokepay::Request::ListTransactions.new({ "page" => 1, "per_page" => 10 })
|
33
|
+
response = client.send(request)
|
34
|
+
|
35
|
+
if response.object.pagination.has_next then
|
36
|
+
next_page = response.object.pagination.current + 1
|
37
|
+
request = Pokepay::Request::ListTransactions.new({ "page" => next_page, "per_page" => 10 })
|
38
|
+
response = client.send(request)
|
39
|
+
end
|
40
|
+
|
41
|
+
## error
|
42
|
+
|
43
|
+
print("=== error ==========================\n")
|
44
|
+
|
45
|
+
request = Pokepay::Request::SendEcho.new(-1)
|
46
|
+
|
47
|
+
p response = client.send(request)
|
48
|
+
# => #<Net::HTTPBadRequest 400 Bad Request readbody=true>
|
49
|
+
|
50
|
+
p response.code
|
51
|
+
# => 400
|
52
|
+
|
53
|
+
p response.body
|
54
|
+
# => {"type"=>"invalid_parameters", "message"=>"Invalid parameters", "errors"=>{"invalid"=>["message"]}}
|
55
|
+
|
56
|
+
## get transaction
|
57
|
+
|
58
|
+
print("=== get transaction ==========================\n")
|
59
|
+
|
60
|
+
response = client.send(Pokepay::Request::GetTransaction.new(
|
61
|
+
"6054a1d0-35eb-4eee-ad0c-07b951b1add3" # 取引ID
|
62
|
+
))
|
63
|
+
|
64
|
+
p response.object
|
65
|
+
|
66
|
+
## topup
|
67
|
+
|
68
|
+
print("=== topup ==========================\n")
|
69
|
+
|
70
|
+
response = client.send(Pokepay::Request::CreateTopupTransaction.new(
|
71
|
+
shop_id, # 店舗ID
|
72
|
+
customer_id, # エンドユーザーのID
|
73
|
+
money_id, # 送るマネーのID
|
74
|
+
{
|
75
|
+
"money_amount" => 100, # チャージマネー額
|
76
|
+
"point_amount" => 200, # チャージするポイント額 (任意)
|
77
|
+
"description" => "チャージテスト" # 取引履歴に表示する説明文 (任意)
|
78
|
+
}))
|
79
|
+
|
80
|
+
p response.object
|
81
|
+
|
82
|
+
## payment
|
83
|
+
|
84
|
+
print("=== payment ==========================\n")
|
85
|
+
|
86
|
+
response = client.send(Pokepay::Request::CreatePaymentTransaction.new(
|
87
|
+
shop_id, # 店舗ID
|
88
|
+
customer_id, # エンドユーザーのID
|
89
|
+
money_id, # 支払うマネーのID
|
90
|
+
100, # 支払い額
|
91
|
+
{
|
92
|
+
"description" => "たい焼き(小倉)" # 取引履歴に表示する説明文 (任意)
|
93
|
+
}))
|
94
|
+
|
95
|
+
p response.object
|
96
|
+
|
97
|
+
## create check
|
98
|
+
|
99
|
+
print("=== create check ==========================\n")
|
100
|
+
|
101
|
+
response = client.send(Pokepay::Request::CreateCheck.new(
|
102
|
+
shop_account_id, # 店舗アカウントID
|
103
|
+
{
|
104
|
+
"money_amount" => 100,
|
105
|
+
"point_amount" => 0
|
106
|
+
}))
|
107
|
+
|
108
|
+
p response.object
|
109
|
+
|
110
|
+
check_id = response.object.id
|
111
|
+
|
112
|
+
## create transaction with check
|
113
|
+
|
114
|
+
print("=== create transaction with check ==========================\n")
|
115
|
+
|
116
|
+
response = client.send(Pokepay::Request::CreateTopupTransactionWithCheck.new(
|
117
|
+
check_id, # チャージ用QRコードのID
|
118
|
+
customer_id # エンドユーザーのID
|
119
|
+
))
|
120
|
+
|
121
|
+
p response.object
|
122
|
+
|
123
|
+
## list transactions
|
124
|
+
|
125
|
+
print("=== list transactions ==========================\n")
|
126
|
+
|
127
|
+
response = client.send(Pokepay::Request::ListTransactions.new(
|
128
|
+
{
|
129
|
+
# ページング
|
130
|
+
"page" => 1,
|
131
|
+
"per_page" => 10,
|
132
|
+
|
133
|
+
# フィルタオプション (すべて任意)
|
134
|
+
# 期間指定 (ISO8601形式の文字列)
|
135
|
+
"from" => "2019-01-01T00:00:00+09:00",
|
136
|
+
"to" => "2020-07-30T18:13:39+09:00",
|
137
|
+
|
138
|
+
# 検索オプション
|
139
|
+
"customer_id" => customer_id, # エンドユーザーID
|
140
|
+
# "customer_name" => "masatoi", # エンドユーザー名
|
141
|
+
# "transaction_id" => "24bba30c......", # 取引ID
|
142
|
+
# "shop_id" => "456a820b......", # 店舗ID
|
143
|
+
# "terminal_id" => "d8023185......", # 端末ID
|
144
|
+
# "organization" => "pocketchange", # 組織コード
|
145
|
+
"private_money_id" => money_id, # マネーID
|
146
|
+
"is_modified" => true, # キャンセルされた取引のみ検索するか
|
147
|
+
# 取引種別 (複数指定可)、チャージ=topup、支払い=payment
|
148
|
+
"types" => ["topup", "payment"],
|
149
|
+
}))
|
150
|
+
|
151
|
+
p response.body
|
152
|
+
|
153
|
+
## add new user account
|
154
|
+
|
155
|
+
print("=== add new user account ==========================\n")
|
156
|
+
|
157
|
+
response = client.send(Pokepay::Request::CreateCustomerAccount.new(
|
158
|
+
money_id,
|
159
|
+
{
|
160
|
+
"user_name" => "ポケペイ太郎",
|
161
|
+
"account_name" => "ポケペイ太郎のアカウント"
|
162
|
+
}))
|
163
|
+
|
164
|
+
p response.object
|
165
|
+
|
166
|
+
|
167
|
+
## customer account detail info
|
168
|
+
|
169
|
+
print("=== customer account detail info ==========================\n")
|
170
|
+
|
171
|
+
response = client.send(Pokepay::Request::GetAccount.new(customer_account_id))
|
172
|
+
|
173
|
+
p response.object
|
174
|
+
|
175
|
+
## customer account balances
|
176
|
+
|
177
|
+
print("=== customer account balances ==========================\n")
|
178
|
+
|
179
|
+
response = client.send(Pokepay::Request::ListAccountBalances.new(customer_account_id))
|
180
|
+
|
181
|
+
p response.object
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require "openssl"
|
4
4
|
require "base64"
|
5
5
|
require "uri"
|
6
|
-
require "net/
|
6
|
+
require "net/http"
|
7
7
|
require "time"
|
8
8
|
require "json"
|
9
9
|
require "securerandom"
|
@@ -26,11 +26,13 @@ module Pokepay
|
|
26
26
|
@ssl_cert_file = ini['global']['SSL_CERT_FILE']
|
27
27
|
@timezone = ini['global']['TIMEZONE']
|
28
28
|
@timeout = ini['global']['TIMEOUT']
|
29
|
-
@
|
30
|
-
@
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
@http = Net::HTTP.new(@api_base_url.host, @api_base_url.port)
|
30
|
+
if @api_base_url.scheme == 'https'
|
31
|
+
@http.use_ssl = true
|
32
|
+
@http.cert = OpenSSL::X509::Certificate.new(File.read(@ssl_cert_file))
|
33
|
+
@http.key = OpenSSL::PKey::RSA.new(File.read(@ssl_key_file))
|
34
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
35
|
+
end
|
34
36
|
@crypto = Pokepay::Crypto.new(@client_secret)
|
35
37
|
end
|
36
38
|
|
@@ -47,7 +49,7 @@ module Pokepay
|
|
47
49
|
"data" => Base64.urlsafe_encode64(@crypto.encrypt(JSON.generate(encrypt_data)))}
|
48
50
|
req = request_class.new(path)
|
49
51
|
req.set_form_data(params)
|
50
|
-
res = @
|
52
|
+
res = @http.start { @http.request(req) }
|
51
53
|
res_map = JSON.parse(res.body)
|
52
54
|
if(res_map["response_data"]) then
|
53
55
|
res.body =
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
|
4
|
+
module Pokepay::Response
|
5
|
+
class Product
|
6
|
+
def initialize(row)
|
7
|
+
@jan_code = row["jan_code"]
|
8
|
+
@name = row["name"]
|
9
|
+
@unit_price = row["unit_price"]
|
10
|
+
@price = row["price"]
|
11
|
+
@is_discounted = row["is_discounted"]
|
12
|
+
@other = row["other"]
|
13
|
+
end
|
14
|
+
attr_reader :jan_code
|
15
|
+
attr_reader :name
|
16
|
+
attr_reader :unit_price
|
17
|
+
attr_reader :price
|
18
|
+
attr_reader :is_discounted
|
19
|
+
attr_reader :other
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/check"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateCheck < Request
|
7
|
+
def initialize(account_id, rest_args = {})
|
8
|
+
@path = "/checks"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "account_id" => account_id }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::Check
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateCpmTransaction < Request
|
7
|
+
def initialize(cpm_token, amount, shop_id, rest_args = {})
|
8
|
+
@path = "/transactions" + "/cpm"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "cpm_token" => cpm_token,
|
11
|
+
"amount" => amount,
|
12
|
+
"shop_id" => shop_id }.merge(rest_args)
|
13
|
+
@response_class = Pokepay::Response::Transaction
|
14
|
+
end
|
15
|
+
attr_reader :response_class
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/account_with_user"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateCustomerAccount < Request
|
7
|
+
def initialize(private_money_id, rest_args = {})
|
8
|
+
@path = "/accounts" + "/customers"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "private_money_id" => private_money_id }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::AccountWithUser
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateExchangeTransaction < Request
|
7
|
+
def initialize(user_id, sender_private_money_id, receiver_private_money_id, amount, rest_args = {})
|
8
|
+
@path = "/transactions" + "/exchange"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "user_id" => user_id,
|
11
|
+
"sender_private_money_id" => sender_private_money_id,
|
12
|
+
"receiver_private_money_id" => receiver_private_money_id,
|
13
|
+
"amount" => amount }.merge(rest_args)
|
14
|
+
@response_class = Pokepay::Response::Transaction
|
15
|
+
end
|
16
|
+
attr_reader :response_class
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/organization"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateOrganization < Request
|
7
|
+
def initialize(code, name, issuer_admin_user_email, member_admin_user_email, rest_args = {})
|
8
|
+
@path = "/organizations"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "code" => code,
|
11
|
+
"name" => name,
|
12
|
+
"issuer_admin_user_email" => issuer_admin_user_email,
|
13
|
+
"member_admin_user_email" => member_admin_user_email }.merge(rest_args)
|
14
|
+
@response_class = Pokepay::Response::Organization
|
15
|
+
end
|
16
|
+
attr_reader :response_class
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreatePaymentTransaction < Request
|
7
|
+
def initialize(shop_id, customer_id, private_money_id, amount, rest_args = {})
|
8
|
+
@path = "/transactions" + "/payment"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "shop_id" => shop_id,
|
11
|
+
"customer_id" => customer_id,
|
12
|
+
"private_money_id" => private_money_id,
|
13
|
+
"amount" => amount }.merge(rest_args)
|
14
|
+
@response_class = Pokepay::Response::Transaction
|
15
|
+
end
|
16
|
+
attr_reader :response_class
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/user"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateShop < Request
|
7
|
+
def initialize(shop_name, rest_args = {})
|
8
|
+
@path = "/shops"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "shop_name" => shop_name }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::User
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateTopupTransaction < Request
|
7
|
+
def initialize(shop_id, customer_id, private_money_id, rest_args = {})
|
8
|
+
@path = "/transactions" + "/topup"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "shop_id" => shop_id,
|
11
|
+
"customer_id" => customer_id,
|
12
|
+
"private_money_id" => private_money_id }.merge(rest_args)
|
13
|
+
@response_class = Pokepay::Response::Transaction
|
14
|
+
end
|
15
|
+
attr_reader :response_class
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class CreateTopupTransactionWithCheck < Request
|
7
|
+
def initialize(check_id, customer_id)
|
8
|
+
@path = "/transactions" + "/topup" + "/check"
|
9
|
+
@method = "POST"
|
10
|
+
@body_params = { "check_id" => check_id,
|
11
|
+
"customer_id" => customer_id }
|
12
|
+
@response_class = Pokepay::Response::Transaction
|
13
|
+
end
|
14
|
+
attr_reader :response_class
|
15
|
+
end
|
16
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
1
3
|
require "pokepay_partner_ruby_sdk/response/transaction"
|
2
4
|
|
3
5
|
module Pokepay::Request
|
4
6
|
class CreateTransaction < Request
|
5
|
-
def initialize(shop_id, customer_id, private_money_id,
|
7
|
+
def initialize(shop_id, customer_id, private_money_id, rest_args = {})
|
6
8
|
@path = "/transactions"
|
7
9
|
@method = "POST"
|
8
10
|
@body_params = { "shop_id" => shop_id,
|
9
11
|
"customer_id" => customer_id,
|
10
|
-
"private_money_id" => private_money_id
|
11
|
-
"money_amount" => money_amount,
|
12
|
-
"point_amount" => point_amount,
|
13
|
-
"description" => description }
|
12
|
+
"private_money_id" => private_money_id }.merge(rest_args)
|
14
13
|
@response_class = Pokepay::Response::Transaction
|
15
14
|
end
|
15
|
+
attr_reader :response_class
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/account_detail"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class GetAccount < Request
|
7
|
+
def initialize(account_id)
|
8
|
+
@path = "/accounts" + "/" + account_id
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }
|
11
|
+
@response_class = Pokepay::Response::AccountDetail
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/pong"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class GetPing < Request
|
7
|
+
def initialize()
|
8
|
+
@path = "/ping"
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }
|
11
|
+
@response_class = Pokepay::Response::Pong
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/paginated_private_money_organization_summaries"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class GetPrivateMoneyOrganizationSummaries < Request
|
7
|
+
def initialize(private_money_id, rest_args = {})
|
8
|
+
@path = "/private-moneys" + "/" + private_money_id + "/organization-summaries"
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::PaginatedPrivateMoneyOrganizationSummaries
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/transaction"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class GetTransaction < Request
|
7
|
+
def initialize(transaction_id)
|
8
|
+
@path = "/transactions" + "/" + transaction_id
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }
|
11
|
+
@response_class = Pokepay::Response::Transaction
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/admin_user_with_shops_and_private_moneys"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class GetUser < Request
|
7
|
+
def initialize()
|
8
|
+
@path = "/user"
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }
|
11
|
+
@response_class = Pokepay::Response::AdminUserWithShopsAndPrivateMoneys
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/paginated_account_balance"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class ListAccountBalances < Request
|
7
|
+
def initialize(account_id, rest_args = {})
|
8
|
+
@path = "/accounts" + "/" + account_id + "/balances"
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::PaginatedAccountBalance
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -1,12 +1,15 @@
|
|
1
|
-
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/paginated_transaction"
|
2
4
|
|
3
5
|
module Pokepay::Request
|
4
6
|
class ListTransactions < Request
|
5
|
-
def initialize(
|
7
|
+
def initialize(rest_args = {})
|
6
8
|
@path = "/transactions"
|
7
9
|
@method = "GET"
|
8
|
-
@body_params =
|
9
|
-
@response_class = Pokepay::Response::
|
10
|
+
@body_params = { }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::PaginatedTransaction
|
10
12
|
end
|
13
|
+
attr_reader :response_class
|
11
14
|
end
|
12
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/paginated_transfers"
|
4
|
+
|
5
|
+
module Pokepay::Request
|
6
|
+
class ListTransfers < Request
|
7
|
+
def initialize(rest_args = {})
|
8
|
+
@path = "/transfers"
|
9
|
+
@method = "GET"
|
10
|
+
@body_params = { }.merge(rest_args)
|
11
|
+
@response_class = Pokepay::Response::PaginatedTransfers
|
12
|
+
end
|
13
|
+
attr_reader :response_class
|
14
|
+
end
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
1
3
|
require "pokepay_partner_ruby_sdk/response/echo"
|
2
4
|
|
3
5
|
module Pokepay::Request
|
@@ -5,8 +7,9 @@ module Pokepay::Request
|
|
5
7
|
def initialize(message)
|
6
8
|
@path = "/echo"
|
7
9
|
@method = "POST"
|
8
|
-
@body_params = {"message" => message}
|
10
|
+
@body_params = { "message" => message }
|
9
11
|
@response_class = Pokepay::Response::Echo
|
10
12
|
end
|
13
|
+
attr_reader :response_class
|
11
14
|
end
|
12
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
|
4
|
+
module Pokepay::Response
|
5
|
+
class AccountBalance
|
6
|
+
def initialize(row)
|
7
|
+
@expires_at = row["expires_at"]
|
8
|
+
@money_amount = row["money_amount"]
|
9
|
+
@point_amount = row["point_amount"]
|
10
|
+
end
|
11
|
+
attr_reader :expires_at
|
12
|
+
attr_reader :money_amount
|
13
|
+
attr_reader :point_amount
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/private_money"
|
4
|
+
|
5
|
+
module Pokepay::Response
|
6
|
+
class AccountDetail
|
7
|
+
def initialize(row)
|
8
|
+
@id = row["id"]
|
9
|
+
@name = row["name"]
|
10
|
+
@is_suspended = row["is_suspended"]
|
11
|
+
@balance = row["balance"]
|
12
|
+
@money_balance = row["money_balance"]
|
13
|
+
@point_balance = row["point_balance"]
|
14
|
+
@private_money = PrivateMoney.new(row["private_money"])
|
15
|
+
end
|
16
|
+
attr_reader :id
|
17
|
+
attr_reader :name
|
18
|
+
attr_reader :is_suspended
|
19
|
+
attr_reader :balance
|
20
|
+
attr_reader :money_balance
|
21
|
+
attr_reader :point_balance
|
22
|
+
attr_reader :private_money
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# DO NOT EDIT: File is generated by code generator.
|
2
|
+
|
3
|
+
require "pokepay_partner_ruby_sdk/response/private_money"
|
4
|
+
require "pokepay_partner_ruby_sdk/response/user"
|
5
|
+
|
6
|
+
module Pokepay::Response
|
7
|
+
class AccountWithUser
|
8
|
+
def initialize(row)
|
9
|
+
@id = row["id"]
|
10
|
+
@name = row["name"]
|
11
|
+
@is_suspended = row["is_suspended"]
|
12
|
+
@private_money = PrivateMoney.new(row["private_money"])
|
13
|
+
@user = User.new(row["user"])
|
14
|
+
end
|
15
|
+
attr_reader :id
|
16
|
+
attr_reader :name
|
17
|
+
attr_reader :is_suspended
|
18
|
+
attr_reader :private_money
|
19
|
+
attr_reader :user
|
20
|
+
end
|
21
|
+
end
|