gmo 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +39 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -4
- data/README.md +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_cancel_mail_deposit_gets_data_about_a_mail_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_create_mail_deposit_gets_data_about_a_mail_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_delete_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_balance_gets_data_about_balance.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_deposit_gets_data_about_a_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_search_mail_deposit_gets_data_about_a_mail_deposit.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_RemittanceAPI/_update_account_gets_data_about_an_account.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_change_order_auth_to_sale.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_gets_data_about_order.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_alter_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_brandtoken_gets_data_about_order.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_gets_data_about_order.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_change_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_cvs_cancel_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_brandtoken_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_cvs_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_docomo_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_edy_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_linepay_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_pay_easy_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_rakuten_id_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_suica_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_entry_tran_virtualaccount_gets_data_about_a_transaction.yml +35 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_brandtoken_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +5 -5
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_cvs_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_docomo_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_doesn_t_require_card_info_if_token_is_present.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_edy_gets_data_about_a_transaction.yml +67 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_linepay_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_parameter_contains_Japanese_characters_should_correctly_handle_Japanese.yml +3 -3
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_pay_easy_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_rakuten_id_gets_data_about_a_transaction.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_suica_gets_data_about_a_transaction.yml +67 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_exec_tran_virtualaccount_gets_data_about_a_transaction.yml +68 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_refund_tran_brandtoken_gets_data_about_a_transaction.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_sales_tran_brandtoken_gets_data_about_a_transaction.yml +8 -8
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_gets_data_about_order.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_gets_data_about_order.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_search_trade_multi_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_secure_tran_gets_data_about_a_transaction.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAPI/_void_tran_brandtoken_gets_data_about_order.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_exec_tran_brandtoken_got_data.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_register_recurring_credit_got_data.yml +36 -0
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_brandtoken_got_data.yml +6 -6
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_data.yml +8 -8
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_trade_card_got_error_if_missing_options.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_ShopAndSiteAPI/_unregister_recurring_success_unregister.yml +69 -0
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_brandtoken_gets_data_about_a_brandtoken.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_card_gets_data_about_a_card.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_delete_member_gets_data_about_a_member.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_doesn_t_require_card_info_if_token_is_present.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_card_gets_data_about_a_card.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_save_member_gets_data_about_a_transaction.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml +4 -4
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_detail_by_member_id_gets_data_about_card_detail.yml +1 -1
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_card_gets_data_about_a_card.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_member_gets_data_about_a_member.yml +2 -2
- data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_update_member_gets_data_about_a_transaction.yml +1 -1
- data/lib/gmo/const.rb +18 -1
- data/lib/gmo/shop_and_site_api.rb +90 -0
- data/lib/gmo/shop_api.rb +90 -0
- data/lib/gmo/version.rb +1 -1
- data/lib/gmo.rb +1 -1
- data/spec/gmo/shop_and_site_api_spec.rb +24 -0
- data/spec/gmo/shop_api_spec.rb +162 -5
- data/spec/spec_helper.rb +2 -5
- metadata +12 -6
- data/.travis.yml +0 -21
- data/spec/support/encoding.rb +0 -33
data/fixtures/vcr_cassettes/GMO_Payment_SiteAPI/_search_brandtoken_gets_data_about_a_brandtoken.yml
CHANGED
@@ -4,7 +4,7 @@ http_interactions:
|
|
4
4
|
method: post
|
5
5
|
uri: https://<HOST>/payment/TradedBrandtoken.idPass
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: Windows-31J
|
8
8
|
string: OrderID=<SHOP_PASS>502<SHOP_PASS>90974&MemberID=<SHOP_PASS>502<SHOP_PASS>90974&ShopID=<SHOP_ID>&ShopPass=<SHOP_PASS>&SiteID=<SITE_ID>&SitePass=<SHOP_PASS>
|
9
9
|
headers:
|
10
10
|
Accept-Encoding:
|
@@ -32,7 +32,7 @@ http_interactions:
|
|
32
32
|
Content-Language:
|
33
33
|
- ja-JP
|
34
34
|
body:
|
35
|
-
encoding:
|
35
|
+
encoding: Windows-31J
|
36
36
|
string: TokenSeq=0&CardNoToken=*************<SHOP_PASS><SHOP_PASS><SHOP_PASS>&Forward=2a99663
|
37
37
|
http_version:
|
38
38
|
recorded_at: Tue, 08 Aug 2017 11:16:15 GMT
|
@@ -40,7 +40,7 @@ http_interactions:
|
|
40
40
|
method: post
|
41
41
|
uri: https://<HOST>/payment/SearchBrandtoken.idPass
|
42
42
|
body:
|
43
|
-
encoding:
|
43
|
+
encoding: Windows-31J
|
44
44
|
string: MemberID=<SHOP_PASS>502<SHOP_PASS>9<SHOP_PASS><SHOP_PASS><SHOP_PASS>7&SeqMode=0&SiteID=<SITE_ID>&SitePass=<SHOP_PASS>
|
45
45
|
headers:
|
46
46
|
Accept-Encoding:
|
@@ -67,7 +67,7 @@ http_interactions:
|
|
67
67
|
Content-Language:
|
68
68
|
- ja-JP
|
69
69
|
body:
|
70
|
-
encoding:
|
70
|
+
encoding: Windows-31J
|
71
71
|
string: TokenSeq=0&DefaultFlag=0&CardName=&CardNoToken=*************111&Expire=2212&HolderName=&DeleteFlag=0
|
72
72
|
http_version:
|
73
73
|
recorded_at: Tue, 08 Aug 2017 11:18:38 GMT
|
@@ -4,7 +4,7 @@ http_interactions:
|
|
4
4
|
method: post
|
5
5
|
uri: https://<HOST>/payment/SaveCard.idPass
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: Windows-31J
|
8
8
|
string: MemberID=1362106780&CardNo=4111111111111111&Expire=1405&SiteID=<SITE_ID>&SitePass=<SITE_PASS>
|
9
9
|
headers:
|
10
10
|
Accept:
|
@@ -33,7 +33,7 @@ http_interactions:
|
|
33
33
|
method: post
|
34
34
|
uri: https://<HOST>/payment/SearchCard.idPass
|
35
35
|
body:
|
36
|
-
encoding:
|
36
|
+
encoding: Windows-31J
|
37
37
|
string: MemberID=1362106780&CardSeq=0&SeqMode=0&SiteID=<SITE_ID>&SitePass=<SITE_PASS>
|
38
38
|
headers:
|
39
39
|
Accept:
|
@@ -4,7 +4,7 @@ http_interactions:
|
|
4
4
|
method: post
|
5
5
|
uri: https://<HOST>/payment/SaveMember.idPass
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: Windows-31J
|
8
8
|
string: MemberID=1362106992&MemberName=John+Smith&SiteID=<SITE_ID>&SitePass=<SITE_PASS>
|
9
9
|
headers:
|
10
10
|
Accept:
|
@@ -33,7 +33,7 @@ http_interactions:
|
|
33
33
|
method: post
|
34
34
|
uri: https://<HOST>/payment/SearchMember.idPass
|
35
35
|
body:
|
36
|
-
encoding:
|
36
|
+
encoding: Windows-31J
|
37
37
|
string: MemberID=1362106992&SiteID=<SITE_ID>&SitePass=<SITE_PASS>
|
38
38
|
headers:
|
39
39
|
Accept:
|
data/lib/gmo/const.rb
CHANGED
@@ -14,6 +14,12 @@ module GMO
|
|
14
14
|
apple_pay: 'APay'
|
15
15
|
}.freeze
|
16
16
|
|
17
|
+
RECURRING_REGIST_TYPE = {
|
18
|
+
member_id: '1',
|
19
|
+
card_number: '2',
|
20
|
+
order_id: '3'
|
21
|
+
}
|
22
|
+
|
17
23
|
INPUT_PARAMS = {
|
18
24
|
:access_id => "AccessID",
|
19
25
|
:access_pass => "AccessPass",
|
@@ -38,6 +44,10 @@ module GMO
|
|
38
44
|
:card_no => "CardNo",
|
39
45
|
:card_pass => "CardPass",
|
40
46
|
:card_seq => "CardSeq",
|
47
|
+
:charge_day => "ChargeDay",
|
48
|
+
:charge_month => "ChargeMonth",
|
49
|
+
:charge_start_date => "ChargeStartDate",
|
50
|
+
:charge_stop_date => "ChargeStopDate",
|
41
51
|
:client_field_1 => "ClientField1",
|
42
52
|
:client_field_2 => "ClientField2",
|
43
53
|
:client_field_3 => "ClientField3",
|
@@ -102,7 +112,9 @@ module GMO
|
|
102
112
|
:receipts_disp_11 => "ReceiptsDisp11",
|
103
113
|
:receipts_disp_12 => "ReceiptsDisp12",
|
104
114
|
:receipts_disp_13 => "ReceiptsDisp13",
|
115
|
+
:recurring_id => "RecurringID",
|
105
116
|
:redirect_url => "RedirectURL",
|
117
|
+
:regist_type => "RegistType",
|
106
118
|
:register_disp_1 => "RegisterDisp1",
|
107
119
|
:register_disp_2 => "RegisterDisp2",
|
108
120
|
:register_disp_3 => "RegisterDisp3",
|
@@ -122,6 +134,7 @@ module GMO
|
|
122
134
|
:shop_pass => "ShopPass",
|
123
135
|
:site_id => "SiteID",
|
124
136
|
:site_pass => "SitePass",
|
137
|
+
:src_order_id => "SrcOrderID",
|
125
138
|
:suica_add_info_1 => "SuicaAddInfo1",
|
126
139
|
:suica_add_info_2 => "SuicaAddInfo2",
|
127
140
|
:suica_add_info_3 => "SuicaAddInfo3",
|
@@ -141,7 +154,11 @@ module GMO
|
|
141
154
|
:lang_cd => "LangCd",
|
142
155
|
:user_info => "UserInfo",
|
143
156
|
:package_name => "PackageName",
|
144
|
-
:search_type => "SearchType"
|
157
|
+
:search_type => "SearchType",
|
158
|
+
:trade_days => "TradeDays",
|
159
|
+
:trade_reason => "TradeReason",
|
160
|
+
:trade_client_name => "TradeClientName",
|
161
|
+
:trade_client_mail_address => "TradeClientMailAddress"
|
145
162
|
}.freeze
|
146
163
|
|
147
164
|
API_ERROR_MESSAGES_EN = {
|
@@ -103,6 +103,96 @@ module GMO
|
|
103
103
|
post_request name, options
|
104
104
|
end
|
105
105
|
|
106
|
+
### @params ###
|
107
|
+
# ShopID
|
108
|
+
# ShopPass
|
109
|
+
# RecurringID
|
110
|
+
# Amount
|
111
|
+
# Tax
|
112
|
+
# ChargeDay
|
113
|
+
# ChargeMonth
|
114
|
+
# ChargeStartDate
|
115
|
+
# ChargeStopDate
|
116
|
+
# RegistType
|
117
|
+
# SiteID
|
118
|
+
# SitePass
|
119
|
+
# MemberID
|
120
|
+
# CardNo
|
121
|
+
# Expire
|
122
|
+
# SrcOrderID
|
123
|
+
# ClientField1
|
124
|
+
# ClientField2
|
125
|
+
# ClientField3
|
126
|
+
### @return ###
|
127
|
+
# ShopID
|
128
|
+
# RecurringID
|
129
|
+
# Amount
|
130
|
+
# Tax
|
131
|
+
# ChargeDay
|
132
|
+
# ChargeMonth
|
133
|
+
# ChargeStartDate
|
134
|
+
# ChargeStopDate
|
135
|
+
# NextChargeDate
|
136
|
+
# Method
|
137
|
+
### example ###
|
138
|
+
# gmo.register_recurring_credit({
|
139
|
+
# recurring_id: "1535964921",
|
140
|
+
# amount: 100,
|
141
|
+
# regist_type: GMO::Const::RECURRING_REGIST_TYPE[:member_id],
|
142
|
+
# member_id: "mem10001"
|
143
|
+
# })
|
144
|
+
# => {"ShopID"=>"tshop0001", "RecurringID"=>"1535964921", "Amount"=>"100", "Tax"=>"0", "ChargeDay"=>"31", "ChargeMonth"=>"01|02|03|04|05|06|07|08|09|10|11|12", "ChargeStartDate"=>"20180904", "ChargeStopDate"=>"", "NextChargeDate"=>"20180930", "Method"=>"RECURRING_CREDIT", "CardNo"=>"", "Expire"=>"", "SiteID"=>"", "MemberID"=>"mem1001"}
|
145
|
+
def register_recurring_credit(options = {})
|
146
|
+
name = "RegisterRecurringCredit.idPass"
|
147
|
+
required = [:recurring_id, :charge_day, :amount, :regist_type]
|
148
|
+
required += case options[:regist_type].to_i
|
149
|
+
when 1
|
150
|
+
options.update(site_id: @site_id, site_pass: @site_pass)
|
151
|
+
[:member_id]
|
152
|
+
when 2
|
153
|
+
[:card_no, :expire]
|
154
|
+
when 3
|
155
|
+
[:src_order_id]
|
156
|
+
end
|
157
|
+
assert_required_options(required, options)
|
158
|
+
post_request name, options
|
159
|
+
end
|
160
|
+
|
161
|
+
### @params ###
|
162
|
+
# ShopID
|
163
|
+
# ShopPass
|
164
|
+
# RecurringID
|
165
|
+
### @return ###
|
166
|
+
# ShopID
|
167
|
+
# RecurringID
|
168
|
+
# Amount
|
169
|
+
# Tax
|
170
|
+
# ChargeDay
|
171
|
+
# ChargeMonth
|
172
|
+
# ChargeStartDate
|
173
|
+
# ChargeStopDate
|
174
|
+
# NextChargeDate
|
175
|
+
# Method
|
176
|
+
# SiteID
|
177
|
+
# MemberID
|
178
|
+
# CardNo
|
179
|
+
# Expire
|
180
|
+
# PrintStr
|
181
|
+
# ErrCode
|
182
|
+
# ErrInfo
|
183
|
+
### example ###
|
184
|
+
# gmo.unregister_recurring({
|
185
|
+
# recurring_id: "1535964921"
|
186
|
+
# })
|
187
|
+
# => {"ShopID"=>"tshop0001", "RecurringID"=>"1536039145", "Amount"=>"100", "Tax"=>"0", "ChargeDay"=>"31", "ChargeMonth"=>"01|02|03|04|05|06|07|08|09|10|11|12", "ChargeStartDate"=>"20180905", "ChargeStopDate"=>"", "NextChargeDate"=>"", "Method"=>"RECURRING_CREDIT", "CardNo"=>"", "Expire"=>"", "SiteID"=>"tsite0001", "MemberID"=>"mem1001", "PrintStr"=>""}
|
188
|
+
def unregister_recurring(options = {})
|
189
|
+
name = "UnregisterRecurring.idPass"
|
190
|
+
options.merge!(site_id: @site_id, site_pass: @site_pass)
|
191
|
+
required = [:recurring_id]
|
192
|
+
assert_required_options(required, options)
|
193
|
+
post_request name, options
|
194
|
+
end
|
195
|
+
|
106
196
|
private
|
107
197
|
|
108
198
|
def api_call(name, args = {}, verb = "post", options = {})
|
data/lib/gmo/shop_api.rb
CHANGED
@@ -158,6 +158,69 @@ module GMO
|
|
158
158
|
post_request name, options
|
159
159
|
end
|
160
160
|
|
161
|
+
### @params ###
|
162
|
+
# OrderID
|
163
|
+
# Amount
|
164
|
+
# Tax
|
165
|
+
### @return ###
|
166
|
+
# AccessID
|
167
|
+
# AccessPass
|
168
|
+
### example ###
|
169
|
+
# gmo.entry_tran_virtualaccount({
|
170
|
+
# order_id: "ord12345",
|
171
|
+
# tax: "0001001",
|
172
|
+
# amount: 100
|
173
|
+
# })
|
174
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
175
|
+
def entry_tran_virtualaccount(options = {})
|
176
|
+
name = "EntryTranVirtualaccount.idPass"
|
177
|
+
required = [:order_id, :amount]
|
178
|
+
assert_required_options(required, options)
|
179
|
+
post_request name, options
|
180
|
+
end
|
181
|
+
|
182
|
+
### @params ###
|
183
|
+
# OrderID
|
184
|
+
# Amount
|
185
|
+
# Tax
|
186
|
+
### @return ###
|
187
|
+
# AccessID
|
188
|
+
# AccessPass
|
189
|
+
### example ###
|
190
|
+
# gmo.entry_tran_suica({
|
191
|
+
# order_id: "ord12345",
|
192
|
+
# tax: "0001001",
|
193
|
+
# amount: 100
|
194
|
+
# })
|
195
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
196
|
+
def entry_tran_suica(options = {})
|
197
|
+
name = "EntryTranSuica.idPass"
|
198
|
+
required = [:order_id, :amount]
|
199
|
+
assert_required_options(required, options)
|
200
|
+
post_request name, options
|
201
|
+
end
|
202
|
+
|
203
|
+
### @params ###
|
204
|
+
# OrderID
|
205
|
+
# Amount
|
206
|
+
# Tax
|
207
|
+
### @return ###
|
208
|
+
# AccessID
|
209
|
+
# AccessPass
|
210
|
+
### example ###
|
211
|
+
# gmo.entry_tran_edy({
|
212
|
+
# order_id: "ord12345",
|
213
|
+
# tax: "0001001",
|
214
|
+
# amount: 100
|
215
|
+
# })
|
216
|
+
# => {"AccessID"=>"139f8ec33a07c55f406937c52ce4473d", "AccessPass"=>"2689b204d2c17192fa35f9269fa7e744"}
|
217
|
+
def entry_tran_edy(options = {})
|
218
|
+
name = "EntryTranEdy.idPass"
|
219
|
+
required = [:order_id, :amount]
|
220
|
+
assert_required_options(required, options)
|
221
|
+
post_request name, options
|
222
|
+
end
|
223
|
+
|
161
224
|
## 2.2.2.2.決済実行
|
162
225
|
# 指定されたサイトに会員を登録します。
|
163
226
|
# return
|
@@ -286,6 +349,33 @@ module GMO
|
|
286
349
|
post_request name, options
|
287
350
|
end
|
288
351
|
|
352
|
+
# 【銀行振込(バーチャル口座)決済】
|
353
|
+
# 18.1.2.2. 決済実行
|
354
|
+
def exec_tran_virtualaccount(options = {})
|
355
|
+
name = "ExecTranVirtualaccount.idPass"
|
356
|
+
required = [:access_id, :access_pass, :order_id, :trade_days]
|
357
|
+
assert_required_options(required, options)
|
358
|
+
post_request name, options
|
359
|
+
end
|
360
|
+
|
361
|
+
# 【モバイルSuica決済】
|
362
|
+
# 18.1.2.2. 決済実行
|
363
|
+
def exec_tran_suica(options = {})
|
364
|
+
name = "ExecTranSuica.idPass"
|
365
|
+
required = [:access_id, :access_pass, :order_id, :item_name, :mail_address]
|
366
|
+
assert_required_options(required, options)
|
367
|
+
post_request name, options
|
368
|
+
end
|
369
|
+
|
370
|
+
# 【楽天Edy決済】
|
371
|
+
# 18.1.2.2. 決済実行
|
372
|
+
def exec_tran_edy(options = {})
|
373
|
+
name = "ExecTranEdy.idPass"
|
374
|
+
required = [:access_id, :access_pass, :order_id, :mail_address]
|
375
|
+
assert_required_options(required, options)
|
376
|
+
post_request name, options
|
377
|
+
end
|
378
|
+
|
289
379
|
### @params ###
|
290
380
|
# AccessID
|
291
381
|
# AccessPass
|
data/lib/gmo/version.rb
CHANGED
data/lib/gmo.rb
CHANGED
@@ -42,7 +42,7 @@ module GMO
|
|
42
42
|
key_values = result.body.to_s.split('&').map { |str| str.split('=', 2) }.flatten
|
43
43
|
response = Hash[*key_values]
|
44
44
|
# converting to UTF-8
|
45
|
-
body = response = Hash[response.map { |k,v| [k, NKF.nkf('-w',v)] }]
|
45
|
+
body = response = Hash[response.map { |k,v| [k, NKF.nkf('-S -w',v)] }]
|
46
46
|
# Check for errors if provided a error_checking_block
|
47
47
|
yield(body) if error_checking_block
|
48
48
|
# Return result
|
@@ -171,4 +171,28 @@ describe "GMO::Payment::ShopAndSiteAPI" do
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
+
describe "#register_recurring_credit" do
|
175
|
+
it "got data", :vcr do
|
176
|
+
recurring_id = generate_id
|
177
|
+
member_id = 'mem1001'
|
178
|
+
result = @service.register_recurring_credit({
|
179
|
+
:recurring_id => recurring_id,
|
180
|
+
:amount => 100,
|
181
|
+
:charge_day => 31,
|
182
|
+
:regist_type => GMO::Const::RECURRING_REGIST_TYPE[:member_id],
|
183
|
+
:member_id => member_id,
|
184
|
+
})
|
185
|
+
result["NextChargeDate"].nil?.should_not be true
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "#unregister_recurring" do
|
190
|
+
it "success unregister", :vcr do
|
191
|
+
recurring_id = generate_id
|
192
|
+
result = @service.unregister_recurring({
|
193
|
+
recurring_id: recurring_id
|
194
|
+
})
|
195
|
+
result["Method"].should == "RECURRING_CREDIT"
|
196
|
+
end
|
197
|
+
end
|
174
198
|
end
|
data/spec/gmo/shop_api_spec.rb
CHANGED
@@ -174,6 +174,60 @@ describe "GMO::Payment::ShopAPI" do
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
+
describe "#entry_tran_virtualaccount" do
|
178
|
+
it "gets data about a transaction", :vcr do
|
179
|
+
order_id = @order_id
|
180
|
+
result = @service.entry_tran_virtualaccount({
|
181
|
+
:order_id => order_id,
|
182
|
+
:amount => 100
|
183
|
+
})
|
184
|
+
result["AccessID"].nil?.should_not be true
|
185
|
+
result["AccessPass"].nil?.should_not be true
|
186
|
+
end
|
187
|
+
|
188
|
+
it "got error if missing options", :vcr do
|
189
|
+
lambda {
|
190
|
+
result = @service.entry_tran_virtualaccount()
|
191
|
+
}.should raise_error('Required order_id, amount were not provided.')
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe "#entry_tran_suica" do
|
196
|
+
it "gets data about a transaction", :vcr do
|
197
|
+
order_id = @order_id
|
198
|
+
result = @service.entry_tran_suica({
|
199
|
+
:order_id => order_id,
|
200
|
+
:amount => 100
|
201
|
+
})
|
202
|
+
result["AccessID"].nil?.should_not be true
|
203
|
+
result["AccessPass"].nil?.should_not be true
|
204
|
+
end
|
205
|
+
|
206
|
+
it "got error if missing options", :vcr do
|
207
|
+
lambda {
|
208
|
+
result = @service.entry_tran_suica()
|
209
|
+
}.should raise_error('Required order_id, amount were not provided.')
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "#entry_tran_edy" do
|
214
|
+
it "gets data about a transaction", :vcr do
|
215
|
+
order_id = @order_id
|
216
|
+
result = @service.entry_tran_edy({
|
217
|
+
:order_id => order_id,
|
218
|
+
:amount => 100
|
219
|
+
})
|
220
|
+
result["AccessID"].nil?.should_not be true
|
221
|
+
result["AccessPass"].nil?.should_not be true
|
222
|
+
end
|
223
|
+
|
224
|
+
it "got error if missing options", :vcr do
|
225
|
+
lambda {
|
226
|
+
result = @service.entry_tran_edy()
|
227
|
+
}.should raise_error('Required order_id, amount were not provided.')
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
177
231
|
describe "#exec_tran" do
|
178
232
|
it "gets data about a transaction", :vcr do
|
179
233
|
order_id = generate_id
|
@@ -470,6 +524,110 @@ describe "GMO::Payment::ShopAPI" do
|
|
470
524
|
end
|
471
525
|
end
|
472
526
|
|
527
|
+
describe "#exec_tran_virtualaccount" do
|
528
|
+
it "gets data about a transaction", :vcr do
|
529
|
+
order_id = generate_id
|
530
|
+
result = @service.entry_tran_virtualaccount({
|
531
|
+
:order_id => order_id,
|
532
|
+
:amount => 100
|
533
|
+
})
|
534
|
+
access_id = result["AccessID"]
|
535
|
+
access_pass = result["AccessPass"]
|
536
|
+
result = @service.exec_tran_virtualaccount({
|
537
|
+
:order_id => order_id,
|
538
|
+
:access_id => access_id,
|
539
|
+
:access_pass => access_pass,
|
540
|
+
:trade_days => 14
|
541
|
+
})
|
542
|
+
result["AccessID"].nil?.should_not be_truthy
|
543
|
+
result["BankCode"].nil?.should_not be_truthy
|
544
|
+
result["BankName"].nil?.should_not be_truthy
|
545
|
+
result["BranchCode"].nil?.should_not be_truthy
|
546
|
+
result["BranchName"].nil?.should_not be_truthy
|
547
|
+
result["AccountType"].nil?.should_not be_truthy
|
548
|
+
result["AccountNumber"].nil?.should_not be_truthy
|
549
|
+
result["AvailableDate"].nil?.should_not be_truthy
|
550
|
+
result["TradeCode"].nil?.should_not be_truthy
|
551
|
+
end
|
552
|
+
|
553
|
+
it "got error if missing options", :vcr do
|
554
|
+
lambda {
|
555
|
+
result = @service.exec_tran_virtualaccount()
|
556
|
+
}.should raise_error("Required access_id, access_pass, order_id, trade_days were not provided.")
|
557
|
+
end
|
558
|
+
end
|
559
|
+
|
560
|
+
describe "#exec_tran_suica" do
|
561
|
+
it "gets data about a transaction", :vcr do
|
562
|
+
order_id = generate_id
|
563
|
+
client_field_1 = "client_field1"
|
564
|
+
result = @service.entry_tran_suica({
|
565
|
+
:order_id => order_id,
|
566
|
+
:amount => 100
|
567
|
+
})
|
568
|
+
access_id = result["AccessID"]
|
569
|
+
access_pass = result["AccessPass"]
|
570
|
+
result = @service.exec_tran_suica({
|
571
|
+
:order_id => order_id,
|
572
|
+
:access_id => access_id,
|
573
|
+
:access_pass => access_pass,
|
574
|
+
:item_name => '購入する商品名',
|
575
|
+
:mail_address => 'test@example.com',
|
576
|
+
:client_field_1 => client_field_1,
|
577
|
+
:client_field_flg => 1
|
578
|
+
})
|
579
|
+
result["OrderID"].nil?.should_not be_truthy
|
580
|
+
result["SuicaOrderNo"].nil?.should_not be_truthy
|
581
|
+
result["ReceiptNo"].nil?.should_not be_truthy
|
582
|
+
result["PaymentTerm"].nil?.should_not be_truthy
|
583
|
+
result["TranDate"].nil?.should_not be_truthy
|
584
|
+
result["CheckString"].nil?.should_not be_truthy
|
585
|
+
(result["ClientField1"] == client_field_1).should be_truthy
|
586
|
+
result["ClientField3"].nil?.should_not be_truthy
|
587
|
+
end
|
588
|
+
|
589
|
+
it "got error if missing options", :vcr do
|
590
|
+
lambda {
|
591
|
+
result = @service.exec_tran_suica()
|
592
|
+
}.should raise_error("Required access_id, access_pass, order_id, item_name, mail_address were not provided.")
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
describe "#exec_tran_edy" do
|
597
|
+
it "gets data about a transaction", :vcr do
|
598
|
+
order_id = generate_id
|
599
|
+
client_field_1 = "client_field1"
|
600
|
+
result = @service.entry_tran_edy({
|
601
|
+
:order_id => order_id,
|
602
|
+
:amount => 100
|
603
|
+
})
|
604
|
+
access_id = result["AccessID"]
|
605
|
+
access_pass = result["AccessPass"]
|
606
|
+
result = @service.exec_tran_edy({
|
607
|
+
:order_id => order_id,
|
608
|
+
:access_id => access_id,
|
609
|
+
:access_pass => access_pass,
|
610
|
+
:mail_address => 'test@example.com',
|
611
|
+
:client_field_1 => client_field_1,
|
612
|
+
:client_field_flg => 1
|
613
|
+
})
|
614
|
+
result["OrderID"].nil?.should_not be_truthy
|
615
|
+
result["ReceiptNo"].nil?.should_not be_truthy
|
616
|
+
result["EdyOrderNo"].nil?.should_not be_truthy
|
617
|
+
result["PaymentTerm"].nil?.should_not be_truthy
|
618
|
+
result["TranDate"].nil?.should_not be_truthy
|
619
|
+
result["CheckString"].nil?.should_not be_truthy
|
620
|
+
(result["ClientField1"] == client_field_1).should be_truthy
|
621
|
+
result["ClientField3"].nil?.should_not be_truthy
|
622
|
+
end
|
623
|
+
|
624
|
+
it "got error if missing options", :vcr do
|
625
|
+
lambda {
|
626
|
+
result = @service.exec_tran_edy()
|
627
|
+
}.should raise_error("Required access_id, access_pass, order_id, mail_address were not provided.")
|
628
|
+
end
|
629
|
+
end
|
630
|
+
|
473
631
|
describe "#exec_tran_brandtoken" do
|
474
632
|
it "gets data about a transaction", :vcr do
|
475
633
|
order_id = generate_id
|
@@ -495,7 +653,7 @@ describe "GMO::Payment::ShopAPI" do
|
|
495
653
|
result["Approve"].nil?.should_not be true
|
496
654
|
result["TranID"].nil?.should_not be true
|
497
655
|
result["TranDate"].nil?.should_not be true
|
498
|
-
|
656
|
+
result["ClientField1"].should eq client_field_1
|
499
657
|
result["ClientField2"].nil?.should_not be true
|
500
658
|
result["ClientField3"].nil?.should_not be true
|
501
659
|
end
|
@@ -511,7 +669,6 @@ describe "GMO::Payment::ShopAPI" do
|
|
511
669
|
|
512
670
|
it "should correctly handle Japanese", :vcr do
|
513
671
|
order_id = generate_id
|
514
|
-
client_field_1 = "〜−¢£¬−‖①ほげほげhogehoge"
|
515
672
|
result = @service.entry_tran_brandtoken({
|
516
673
|
:order_id => order_id,
|
517
674
|
:job_cd => "AUTH",
|
@@ -525,7 +682,7 @@ describe "GMO::Payment::ShopAPI" do
|
|
525
682
|
:access_pass => access_pass,
|
526
683
|
:token_type => :apple_pay,
|
527
684
|
:token => 'base64encodedtoken',
|
528
|
-
:client_field_1 =>
|
685
|
+
:client_field_1 => 'カソウシテン'
|
529
686
|
})
|
530
687
|
result["Status"].nil?.should_not be true
|
531
688
|
result["OrderID"].nil?.should_not be true
|
@@ -533,8 +690,8 @@ describe "GMO::Payment::ShopAPI" do
|
|
533
690
|
result["Approve"].nil?.should_not be true
|
534
691
|
result["TranID"].nil?.should_not be true
|
535
692
|
result["TranDate"].nil?.should_not be true
|
536
|
-
|
537
|
-
|
693
|
+
result["ClientField1"].should eq "カソウシテン"
|
694
|
+
result["ClientField1"].encoding.name.should eq "UTF-8"
|
538
695
|
result["ClientField2"].nil?.should_not be true
|
539
696
|
result["ClientField3"].nil?.should_not be true
|
540
697
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,17 +11,14 @@ end
|
|
11
11
|
require 'gmo'
|
12
12
|
require 'rspec'
|
13
13
|
require 'vcr'
|
14
|
+
require 'pry'
|
14
15
|
require 'support/config_loader'
|
15
16
|
require 'support/factory'
|
16
17
|
require 'support/vcr'
|
17
18
|
|
18
|
-
if RUBY_VERSION < '1.9.0'
|
19
|
-
require 'support/encoding'
|
20
|
-
end
|
21
|
-
|
22
19
|
RSpec.configure do |config|
|
23
20
|
config.mock_with :rspec
|
24
21
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
22
|
config.filter_run :focus => true
|
26
23
|
config.run_all_when_everything_filtered = true
|
27
|
-
end
|
24
|
+
end
|