iyzipay 1.0.34 → 1.0.35
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 +5 -13
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +64 -7
- data/VERSION +1 -1
- data/iyzipay.gemspec +1 -2
- data/lib/Iyzipay.rb +1 -2
- data/lib/iyzipay/http_client.rb +1 -1
- data/lib/iyzipay/iyzipay_resource.rb +1 -0
- data/lib/iyzipay/model.rb +8 -1
- data/lib/iyzipay/model/api_test.rb +10 -0
- data/lib/iyzipay/model/bkm_initialize.rb +1 -0
- data/lib/iyzipay/model/card.rb +36 -0
- data/lib/iyzipay/model/card_information.rb +17 -0
- data/lib/iyzipay/model/card_list.rb +17 -0
- data/lib/iyzipay/model/currency.rb +1 -0
- data/lib/iyzipay/model/locale.rb +8 -0
- data/lib/iyzipay/model/pecco_initialize.rb +27 -0
- data/lib/iyzipay/model/pecco_payment.rb +17 -0
- data/spec/{basic_payment_post_auth_spec.rb → api_test_spec.rb} +3 -11
- data/spec/approval_spec.rb +2 -17
- data/spec/bin_number_spec.rb +2 -2
- data/spec/bkm_spec.rb +19 -24
- data/spec/cancel_spec.rb +2 -2
- data/spec/card_storage_spec.rb +94 -0
- data/spec/checkout_form_spec.rb +20 -26
- data/spec/{payment_post_auth_spec.rb → disapproval_spec.rb} +5 -8
- data/spec/installment_spec.rb +5 -5
- data/spec/payment_spec.rb +54 -58
- data/spec/{checkout_form_pre_auth_spec.rb → pecco_spec.rb} +30 -18
- data/spec/refund_spec.rb +5 -23
- data/spec/retrieve_transactions_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/sub_merchant_spec.rb +7 -8
- data/spec/threeds_payment_spec.rb +9 -9
- metadata +33 -34
- data/lib/iyzipay/version.rb +0 -3
- data/spec/basic_bkm_spec.rb +0 -261
- data/spec/basic_payment_pre_auth_spec.rb +0 -73
- data/spec/basic_payment_spec.rb +0 -73
- data/spec/basic_threeds_pre_auth_spec.rb +0 -103
- data/spec/basic_threeds_spec.rb +0 -103
- data/spec/cross_booking_spec.rb +0 -51
- data/spec/payment_pre_auth_spec.rb +0 -280
- data/spec/threeds_pre_auth_spec.rb +0 -226
data/spec/basic_threeds_spec.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe 'Iyzipay' do
|
6
|
-
before :all do
|
7
|
-
@options = Iyzipay::Options.new
|
8
|
-
@options.api_key = 'your api key'
|
9
|
-
@options.secret_key = 'your secret key'
|
10
|
-
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should initialize threeds with card' do
|
14
|
-
payment_card = {
|
15
|
-
cardHolderName: 'John Doe',
|
16
|
-
cardNumber: '5528790000000008',
|
17
|
-
expireYear: '2030',
|
18
|
-
expireMonth: '12',
|
19
|
-
cvc: '123',
|
20
|
-
registerCard: 0
|
21
|
-
}
|
22
|
-
request = {
|
23
|
-
locale: 'tr',
|
24
|
-
conversationId: '123456789',
|
25
|
-
buyerEmail: 'john@doe.com',
|
26
|
-
buyerId: '100',
|
27
|
-
buyerIp: '85.34.78.112',
|
28
|
-
connectorName: '294-isbank',
|
29
|
-
installment: 1,
|
30
|
-
paidPrice: '1',
|
31
|
-
price: '1',
|
32
|
-
callbackUrl: 'https://www.merchant.com/callback',
|
33
|
-
currency: Iyzipay::Model::Currency::TRY,
|
34
|
-
paymentCard: payment_card
|
35
|
-
}
|
36
|
-
threeds_initialize = Iyzipay::Model::BasicThreedsInitialize.new.create(request, @options)
|
37
|
-
|
38
|
-
begin
|
39
|
-
$stderr.puts threeds_initialize.inspect
|
40
|
-
|
41
|
-
threeds_initialize_dict = JSON.parse(threeds_initialize)
|
42
|
-
unless threeds_initialize_dict['threeDSHtmlContent'].nil?
|
43
|
-
$stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
|
44
|
-
end
|
45
|
-
rescue
|
46
|
-
$stderr.puts 'oops'
|
47
|
-
raise
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should initialize threeds with card token' do
|
52
|
-
payment_card = {
|
53
|
-
cardToken: 'card token',
|
54
|
-
cardUserKey: 'card user key'
|
55
|
-
}
|
56
|
-
request = {
|
57
|
-
locale: 'tr',
|
58
|
-
conversationId: '123456789',
|
59
|
-
buyerEmail: 'john@doe.com',
|
60
|
-
buyerId: '100',
|
61
|
-
buyerIp: '85.34.78.112',
|
62
|
-
connectorName: 'isbank',
|
63
|
-
installment: 1,
|
64
|
-
paidPrice: '1',
|
65
|
-
price: '1',
|
66
|
-
callbackUrl: 'https://www.merchant.com/callback',
|
67
|
-
currency: Iyzipay::Model::Currency::TRY,
|
68
|
-
paymentCard: payment_card
|
69
|
-
}
|
70
|
-
threeds_initialize = Iyzipay::Model::BasicThreedsInitialize.new.create(request, @options)
|
71
|
-
|
72
|
-
begin
|
73
|
-
$stderr.puts threeds_initialize.inspect
|
74
|
-
|
75
|
-
threeds_initialize_dict = JSON.parse(threeds_initialize)
|
76
|
-
unless threeds_initialize_dict['threeDSHtmlContent'].nil?
|
77
|
-
$stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
|
78
|
-
end
|
79
|
-
rescue
|
80
|
-
$stderr.puts 'oops'
|
81
|
-
raise
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'should auth threeds' do
|
86
|
-
request = {
|
87
|
-
locale: 'tr',
|
88
|
-
conversationId: '123456789',
|
89
|
-
paymentId: '1'
|
90
|
-
}
|
91
|
-
basic_threeds = Iyzipay::Model::BasicThreedsPayment.new.create(request, @options)
|
92
|
-
|
93
|
-
begin
|
94
|
-
$stderr.puts basic_threeds.inspect
|
95
|
-
rescue
|
96
|
-
$stderr.puts 'oops'
|
97
|
-
raise
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
after :each do
|
102
|
-
end
|
103
|
-
end
|
data/spec/cross_booking_spec.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe 'Iyzipay' do
|
6
|
-
before :all do
|
7
|
-
@options = Iyzipay::Options.new
|
8
|
-
@options.api_key = 'your api key'
|
9
|
-
@options.secret_key = 'your secret key'
|
10
|
-
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should send money to sub merchant' do
|
14
|
-
request = {
|
15
|
-
locale: 'tr',
|
16
|
-
conversationId: '123456789',
|
17
|
-
subMerchantKey: 'sub merchant key',
|
18
|
-
price: '1.0',
|
19
|
-
reason: 'reason text',
|
20
|
-
currency: Iyzipay::Model::Currency::TRY
|
21
|
-
}
|
22
|
-
cross_booking = Iyzipay::Model::CrossBookingToSubMerchant.new.create(request, @options)
|
23
|
-
begin
|
24
|
-
$stderr.puts cross_booking.inspect
|
25
|
-
rescue
|
26
|
-
$stderr.puts 'oops'
|
27
|
-
raise
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should receive money from sub merchant' do
|
32
|
-
request = {
|
33
|
-
locale: 'tr',
|
34
|
-
conversationId: '123456789',
|
35
|
-
subMerchantKey: 'sub merchant key',
|
36
|
-
price: '1.0',
|
37
|
-
reason: 'reason text',
|
38
|
-
currency: Iyzipay::Model::Currency::TRY
|
39
|
-
}
|
40
|
-
cross_booking = Iyzipay::Model::CrossBookingFromSubMerchant.new.create(request, @options)
|
41
|
-
begin
|
42
|
-
$stderr.puts cross_booking.inspect
|
43
|
-
rescue
|
44
|
-
$stderr.puts 'oops'
|
45
|
-
raise
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
after :each do
|
50
|
-
end
|
51
|
-
end
|
@@ -1,280 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe 'Iyzipay' do
|
6
|
-
before :all do
|
7
|
-
@options = Iyzipay::Options.new
|
8
|
-
@options.api_key = 'your api key'
|
9
|
-
@options.secret_key = 'your secret key'
|
10
|
-
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should create payment with physical and virtual item for standard merchant' do
|
14
|
-
payment_card = {
|
15
|
-
cardHolderName: 'John Doe',
|
16
|
-
cardNumber: '5528790000000008',
|
17
|
-
expireYear: '2030',
|
18
|
-
expireMonth: '12',
|
19
|
-
cvc: '123',
|
20
|
-
registerCard: 0
|
21
|
-
}
|
22
|
-
buyer = {
|
23
|
-
id: 'BY789',
|
24
|
-
name: 'John',
|
25
|
-
surname: 'Doe',
|
26
|
-
identityNumber: '74300864791',
|
27
|
-
email: 'email@email.com',
|
28
|
-
gsmNumber: '+905350000000',
|
29
|
-
registrationDate: '2013-04-21 15:12:09',
|
30
|
-
lastLoginDate: '2015-10-05 12:43:35',
|
31
|
-
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
32
|
-
city: 'Istanbul',
|
33
|
-
country: 'Turkey',
|
34
|
-
zipCode: '34732',
|
35
|
-
ip: '85.34.78.112'
|
36
|
-
}
|
37
|
-
address = {
|
38
|
-
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
39
|
-
zipCode: '34732',
|
40
|
-
contactName: 'John Doe',
|
41
|
-
city: 'Istanbul',
|
42
|
-
country: 'Turkey'
|
43
|
-
}
|
44
|
-
|
45
|
-
item1 = {
|
46
|
-
id: 'BI101',
|
47
|
-
name: 'Binocular',
|
48
|
-
category1: 'Collectibles',
|
49
|
-
category2: 'Accessories',
|
50
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
51
|
-
price: '0.3',
|
52
|
-
}
|
53
|
-
item2 = {
|
54
|
-
id: 'BI102',
|
55
|
-
name: 'Game code',
|
56
|
-
category1: 'Game',
|
57
|
-
category2: 'Online Game Items',
|
58
|
-
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
59
|
-
price: '0.5',
|
60
|
-
}
|
61
|
-
item3 = {
|
62
|
-
id: 'BI103',
|
63
|
-
name: 'Usb',
|
64
|
-
category1: 'Electronics',
|
65
|
-
category2: 'Usb / Cable',
|
66
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
67
|
-
price: '0.2',
|
68
|
-
}
|
69
|
-
request = {
|
70
|
-
locale: 'tr',
|
71
|
-
conversationId: '123456789',
|
72
|
-
price: '1.0',
|
73
|
-
paidPrice: '1.1',
|
74
|
-
installment: 1,
|
75
|
-
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
76
|
-
basketId: 'B67832',
|
77
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
|
78
|
-
currency: Iyzipay::Model::Currency::TRY,
|
79
|
-
paymentCard: payment_card,
|
80
|
-
buyer: buyer,
|
81
|
-
billingAddress: address,
|
82
|
-
shippingAddress: address,
|
83
|
-
basketItems: [item1, item2, item3]
|
84
|
-
}
|
85
|
-
payment = Iyzipay::Model::PaymentPreAuth.new.create(request, @options)
|
86
|
-
begin
|
87
|
-
$stderr.puts payment.inspect
|
88
|
-
rescue
|
89
|
-
$stderr.puts 'oops'
|
90
|
-
raise
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'should create payment with physical and virtual item for marketplace' do
|
95
|
-
payment_card = {
|
96
|
-
cardHolderName: 'John Doe',
|
97
|
-
cardNumber: '5528790000000008',
|
98
|
-
expireYear: '2030',
|
99
|
-
expireMonth: '12',
|
100
|
-
cvc: '123',
|
101
|
-
registerCard: 0
|
102
|
-
}
|
103
|
-
buyer = {
|
104
|
-
id: 'BY789',
|
105
|
-
name: 'John',
|
106
|
-
surname: 'Doe',
|
107
|
-
identityNumber: '74300864791',
|
108
|
-
email: 'email@email.com',
|
109
|
-
gsmNumber: '+905350000000',
|
110
|
-
registrationDate: '2013-04-21 15:12:09',
|
111
|
-
lastLoginDate: '2015-10-05 12:43:35',
|
112
|
-
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
113
|
-
city: 'Istanbul',
|
114
|
-
country: 'Turkey',
|
115
|
-
zipCode: '34732',
|
116
|
-
ip: '85.34.78.112'
|
117
|
-
}
|
118
|
-
address = {
|
119
|
-
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
120
|
-
zipCode: '34732',
|
121
|
-
contactName: 'John Doe',
|
122
|
-
city: 'Istanbul',
|
123
|
-
country: 'Turkey'
|
124
|
-
}
|
125
|
-
|
126
|
-
item1 = {
|
127
|
-
id: 'BI101',
|
128
|
-
name: 'Binocular',
|
129
|
-
category1: 'Collectibles',
|
130
|
-
category2: 'Accessories',
|
131
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
132
|
-
price: '0.3',
|
133
|
-
subMerchantKey: 'sub merchant key',
|
134
|
-
subMerchantPrice: '0.27'
|
135
|
-
}
|
136
|
-
item2 = {
|
137
|
-
id: 'BI102',
|
138
|
-
name: 'Game code',
|
139
|
-
category1: 'Game',
|
140
|
-
category2: 'Online Game Items',
|
141
|
-
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
142
|
-
price: '0.5',
|
143
|
-
subMerchantKey: 'sub merchant key',
|
144
|
-
subMerchantPrice: '0.42'
|
145
|
-
}
|
146
|
-
item3 = {
|
147
|
-
id: 'BI103',
|
148
|
-
name: 'Usb',
|
149
|
-
category1: 'Electronics',
|
150
|
-
category2: 'Usb / Cable',
|
151
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
152
|
-
price: '0.2',
|
153
|
-
subMerchantKey: 'sub merchant key',
|
154
|
-
subMerchantPrice: '0.18'
|
155
|
-
}
|
156
|
-
request = {
|
157
|
-
locale: 'tr',
|
158
|
-
conversationId: '123456789',
|
159
|
-
price: '1.0',
|
160
|
-
paidPrice: '1.1',
|
161
|
-
installment: 1,
|
162
|
-
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
163
|
-
basketId: 'B67832',
|
164
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
|
165
|
-
currency: Iyzipay::Model::Currency::TRY,
|
166
|
-
paymentCard: payment_card,
|
167
|
-
buyer: buyer,
|
168
|
-
billingAddress: address,
|
169
|
-
shippingAddress: address,
|
170
|
-
basketItems: [item1, item2, item3]
|
171
|
-
}
|
172
|
-
payment_pre_auth = Iyzipay::Model::PaymentPreAuth.new.create(request, @options)
|
173
|
-
begin
|
174
|
-
$stderr.puts payment_pre_auth.inspect
|
175
|
-
rescue
|
176
|
-
$stderr.puts 'oops'
|
177
|
-
raise
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'should create payment with physical and virtual item for listing or subscription' do
|
182
|
-
payment_card = {
|
183
|
-
cardHolderName: 'John Doe',
|
184
|
-
cardNumber: '5528790000000008',
|
185
|
-
expireYear: '2030',
|
186
|
-
expireMonth: '12',
|
187
|
-
cvc: '123',
|
188
|
-
registerCard: 0
|
189
|
-
}
|
190
|
-
buyer = {
|
191
|
-
id: 'BY789',
|
192
|
-
name: 'John',
|
193
|
-
surname: 'Doe',
|
194
|
-
identityNumber: '74300864791',
|
195
|
-
email: 'email@email.com',
|
196
|
-
gsmNumber: '+905350000000',
|
197
|
-
registrationDate: '2013-04-21 15:12:09',
|
198
|
-
lastLoginDate: '2015-10-05 12:43:35',
|
199
|
-
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
200
|
-
city: 'Istanbul',
|
201
|
-
country: 'Turkey',
|
202
|
-
zipCode: '34732',
|
203
|
-
ip: '85.34.78.112'
|
204
|
-
}
|
205
|
-
address = {
|
206
|
-
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
207
|
-
zipCode: '34732',
|
208
|
-
contactName: 'John Doe',
|
209
|
-
city: 'Istanbul',
|
210
|
-
country: 'Turkey'
|
211
|
-
}
|
212
|
-
|
213
|
-
item1 = {
|
214
|
-
id: 'BI101',
|
215
|
-
name: 'Binocular',
|
216
|
-
category1: 'Collectibles',
|
217
|
-
category2: 'Accessories',
|
218
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
219
|
-
price: '0.3',
|
220
|
-
}
|
221
|
-
item2 = {
|
222
|
-
id: 'BI102',
|
223
|
-
name: 'Game code',
|
224
|
-
category1: 'Game',
|
225
|
-
category2: 'Online Game Items',
|
226
|
-
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
227
|
-
price: '0.5',
|
228
|
-
}
|
229
|
-
item3 = {
|
230
|
-
id: 'BI103',
|
231
|
-
name: 'Usb',
|
232
|
-
category1: 'Electronics',
|
233
|
-
category2: 'Usb / Cable',
|
234
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
235
|
-
price: '0.2',
|
236
|
-
}
|
237
|
-
request = {
|
238
|
-
locale: 'tr',
|
239
|
-
conversationId: '123456789',
|
240
|
-
price: '1.0',
|
241
|
-
paidPrice: '1.1',
|
242
|
-
installment: 1,
|
243
|
-
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
244
|
-
basketId: 'B67832',
|
245
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::SUBSCRIPTION,
|
246
|
-
currency: Iyzipay::Model::Currency::TRY,
|
247
|
-
paymentCard: payment_card,
|
248
|
-
buyer: buyer,
|
249
|
-
billingAddress: address,
|
250
|
-
shippingAddress: address,
|
251
|
-
basketItems: [item1, item2, item3]
|
252
|
-
}
|
253
|
-
payment = Iyzipay::Model::PaymentPreAuth.new.create(request, @options)
|
254
|
-
begin
|
255
|
-
$stderr.puts payment.inspect
|
256
|
-
rescue
|
257
|
-
$stderr.puts 'oops'
|
258
|
-
raise
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
it 'should retrieve payment' do
|
263
|
-
request = {
|
264
|
-
locale: 'tr',
|
265
|
-
conversationId: '123456789',
|
266
|
-
paymentId: '1',
|
267
|
-
paymentConversationId: '123456789',
|
268
|
-
}
|
269
|
-
payment_pre_auth = Iyzipay::Model::PaymentPreAuth.new.retrieve(request, @options)
|
270
|
-
begin
|
271
|
-
$stderr.puts payment_pre_auth.inspect
|
272
|
-
rescue
|
273
|
-
$stderr.puts 'oops'
|
274
|
-
raise
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
after :each do
|
279
|
-
end
|
280
|
-
end
|
@@ -1,226 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require_relative 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe 'Iyzipay' do
|
6
|
-
before :all do
|
7
|
-
@options = Iyzipay::Options.new
|
8
|
-
@options.api_key = 'your api key'
|
9
|
-
@options.secret_key = 'your secret key'
|
10
|
-
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should create payment with physical and virtual item for standard merchant' do
|
14
|
-
payment_card = {
|
15
|
-
cardHolderName: 'John Doe',
|
16
|
-
cardNumber: '5528790000000008',
|
17
|
-
expireYear: '2030',
|
18
|
-
expireMonth: '12',
|
19
|
-
cvc: '123',
|
20
|
-
registerCard: 0
|
21
|
-
}
|
22
|
-
buyer = {
|
23
|
-
id: 'BY789',
|
24
|
-
name: 'John',
|
25
|
-
surname: 'Doe',
|
26
|
-
identityNumber: '74300864791',
|
27
|
-
email: 'email@email.com',
|
28
|
-
gsmNumber: '+905350000000',
|
29
|
-
registrationDate: '2013-04-21 15:12:09',
|
30
|
-
lastLoginDate: '2015-10-05 12:43:35',
|
31
|
-
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
32
|
-
city: 'Istanbul',
|
33
|
-
country: 'Turkey',
|
34
|
-
zipCode: '34732',
|
35
|
-
ip: '85.34.78.112'
|
36
|
-
}
|
37
|
-
address = {
|
38
|
-
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
39
|
-
zipCode: '34732',
|
40
|
-
contactName: 'John Doe',
|
41
|
-
city: 'Istanbul',
|
42
|
-
country: 'Turkey'
|
43
|
-
}
|
44
|
-
|
45
|
-
item1 = {
|
46
|
-
id: 'BI101',
|
47
|
-
name: 'Binocular',
|
48
|
-
category1: 'Collectibles',
|
49
|
-
category2: 'Accessories',
|
50
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
51
|
-
price: '0.3',
|
52
|
-
}
|
53
|
-
item2 = {
|
54
|
-
id: 'BI102',
|
55
|
-
name: 'Game code',
|
56
|
-
category1: 'Game',
|
57
|
-
category2: 'Online Game Items',
|
58
|
-
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
59
|
-
price: '0.5',
|
60
|
-
}
|
61
|
-
item3 = {
|
62
|
-
id: 'BI103',
|
63
|
-
name: 'Usb',
|
64
|
-
category1: 'Electronics',
|
65
|
-
category2: 'Usb / Cable',
|
66
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
67
|
-
price: '0.2',
|
68
|
-
}
|
69
|
-
request = {
|
70
|
-
locale: 'tr',
|
71
|
-
conversationId: '123456789',
|
72
|
-
price: '1.0',
|
73
|
-
paidPrice: '1.1',
|
74
|
-
installment: 1,
|
75
|
-
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
76
|
-
basketId: 'B67832',
|
77
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
|
78
|
-
callbackUrl: 'https://www.merchant.com/callback',
|
79
|
-
currency: Iyzipay::Model::Currency::TRY,
|
80
|
-
paymentCard: payment_card,
|
81
|
-
buyer: buyer,
|
82
|
-
billingAddress: address,
|
83
|
-
shippingAddress: address,
|
84
|
-
basketItems: [item1, item2, item3]
|
85
|
-
}
|
86
|
-
threeds_initialize_pre_auth = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
|
87
|
-
begin
|
88
|
-
$stderr.puts threeds_initialize_pre_auth.inspect
|
89
|
-
threeds_initialize_dict = JSON.parse(threeds_initialize_pre_auth)
|
90
|
-
unless threeds_initialize_dict['threeDSHtmlContent'].nil?
|
91
|
-
$stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
|
92
|
-
end
|
93
|
-
rescue
|
94
|
-
$stderr.puts 'oops'
|
95
|
-
raise
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should create three payment with physical and virtual item for market place' do
|
100
|
-
payment_card = {
|
101
|
-
cardHolderName: 'John Doe',
|
102
|
-
cardNumber: '5528790000000008',
|
103
|
-
expireYear: '2030',
|
104
|
-
expireMonth: '12',
|
105
|
-
cvc: '123',
|
106
|
-
registerCard: 0
|
107
|
-
}
|
108
|
-
buyer = {
|
109
|
-
id: 'BY789',
|
110
|
-
name: 'John',
|
111
|
-
surname: 'Doe',
|
112
|
-
identityNumber: '74300864791',
|
113
|
-
email: 'email@email.com',
|
114
|
-
gsmNumber: '+905350000000',
|
115
|
-
registrationDate: '2013-04-21 15:12:09',
|
116
|
-
lastLoginDate: '2015-10-05 12:43:35',
|
117
|
-
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
118
|
-
city: 'Istanbul',
|
119
|
-
country: 'Turkey',
|
120
|
-
zipCode: '34732',
|
121
|
-
ip: '85.34.78.112'
|
122
|
-
}
|
123
|
-
address = {
|
124
|
-
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
125
|
-
zipCode: '34732',
|
126
|
-
contactName: 'John Doe',
|
127
|
-
city: 'Istanbul',
|
128
|
-
country: 'Turkey'
|
129
|
-
}
|
130
|
-
|
131
|
-
item1 = {
|
132
|
-
id: 'BI101',
|
133
|
-
name: 'Binocular',
|
134
|
-
category1: 'Collectibles',
|
135
|
-
category2: 'Accessories',
|
136
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
137
|
-
price: '0.3',
|
138
|
-
subMerchantKey: 'sub merchant key',
|
139
|
-
subMerchantPrice: '0.27'
|
140
|
-
}
|
141
|
-
item2 = {
|
142
|
-
id: 'BI102',
|
143
|
-
name: 'Game code',
|
144
|
-
category1: 'Game',
|
145
|
-
category2: 'Online Game Items',
|
146
|
-
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
147
|
-
price: '0.5',
|
148
|
-
subMerchantKey: 'sub merchant key',
|
149
|
-
subMerchantPrice: '0.42'
|
150
|
-
}
|
151
|
-
item3 = {
|
152
|
-
id: 'BI103',
|
153
|
-
name: 'Usb',
|
154
|
-
category1: 'Electronics',
|
155
|
-
category2: 'Usb / Cable',
|
156
|
-
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
157
|
-
price: '0.2',
|
158
|
-
subMerchantKey: 'sub merchant key',
|
159
|
-
subMerchantPrice: '0.18'
|
160
|
-
}
|
161
|
-
request = {
|
162
|
-
locale: 'tr',
|
163
|
-
conversationId: '123456789',
|
164
|
-
price: '1.0',
|
165
|
-
paidPrice: '1.1',
|
166
|
-
installment: 1,
|
167
|
-
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
168
|
-
basketId: 'B67832',
|
169
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
|
170
|
-
callbackUrl: 'https://www.merchant.com/callback',
|
171
|
-
currency: Iyzipay::Model::Currency::TRY,
|
172
|
-
paymentCard: payment_card,
|
173
|
-
buyer: buyer,
|
174
|
-
billingAddress: address,
|
175
|
-
shippingAddress: address,
|
176
|
-
basketItems: [item1, item2, item3]
|
177
|
-
}
|
178
|
-
threeds_initialize_pre_auth = Iyzipay::Model::ThreedsInitializePreAuth.new.create(request, @options)
|
179
|
-
begin
|
180
|
-
$stderr.puts threeds_initialize_pre_auth.inspect
|
181
|
-
|
182
|
-
threeds_initialize_dict = JSON.parse(threeds_initialize_pre_auth)
|
183
|
-
unless threeds_initialize_dict['threeDSHtmlContent'].nil?
|
184
|
-
$stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
|
185
|
-
end
|
186
|
-
rescue
|
187
|
-
$stderr.puts 'oops'
|
188
|
-
raise
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
it 'should auth threeds' do
|
193
|
-
request = {
|
194
|
-
locale: 'tr',
|
195
|
-
conversationId: '123456789',
|
196
|
-
paymentId: '9',
|
197
|
-
conversationData: 'conversation data',
|
198
|
-
}
|
199
|
-
threeds_payment = Iyzipay::Model::ThreedsPayment.new.create(request, @options)
|
200
|
-
begin
|
201
|
-
$stderr.puts threeds_payment.inspect
|
202
|
-
rescue
|
203
|
-
$stderr.puts 'oops'
|
204
|
-
raise
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'should retrieve payment' do
|
209
|
-
request = {
|
210
|
-
locale: 'tr',
|
211
|
-
conversationId: '123456789',
|
212
|
-
paymentId: '267',
|
213
|
-
paymentConversationId: '123456789',
|
214
|
-
}
|
215
|
-
threeds_payment = Iyzipay::Model::ThreedsPayment.new.retrieve(request, @options)
|
216
|
-
begin
|
217
|
-
$stderr.puts threeds_payment.inspect
|
218
|
-
rescue
|
219
|
-
$stderr.puts 'oops'
|
220
|
-
raise
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
after :each do
|
225
|
-
end
|
226
|
-
end
|