iyzipay 1.0.29 → 1.0.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWNkZDljZDliNzVlMjI4ZDM0NmFhOGRkZjU1MjIwNTgyY2ZkYTYyMg==
4
+ ZWU3MmQxNjZhZDFiOTk4NjM5MDhjMWNlNjE3M2EyYWM1ZDRmMmIyNA==
5
5
  data.tar.gz: !binary |-
6
- NzcyZWVkYzA4YWRjZmVlMDhhNDhlZWIzZTE5YmFkZmFjZjc1MzI5NQ==
6
+ NmIzMjAwNWJlNjMxZjY4OGU1NjhhOGEyN2QxNTZjMDA0ZDA0YzllZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzEzM2I3ZmMxMDhlYzVkYzE2Y2IwMmViYTI5Nzc5MjExMzEwYzA3Y2Y0Mjdi
10
- MDdiMmEzM2U2ODc0MTliZjJmODFjNzkxZGZkYzI2YmFmZmI3MmE4MjAyNGM0
11
- YzljOGI1OTRiYzBkNzAyZjIwNGEyNzY3ZjRlODk0ZGVjNjcyODM=
9
+ ODQ3ODk3ZjY3NmIxMGQxNDVhMTcyMGM0MDI5NDUwZWQ1OTU2MjJhNWEwYTg2
10
+ MTIyZTEzZTllOWYwODBiMmQ2OTY3MWRmNGExZGQ0ODQyZDczOTc2NGMzNjE4
11
+ NjM2YTBmNmVlY2Y4NjAyOTgwOTQ0ZDU4YWE4OWU1MDE4YmI0YzY=
12
12
  data.tar.gz: !binary |-
13
- MWQ1ZDA4NTE4OTE4M2I1NTZiMTIxMTk3YTQyNzc1YTgxM2JmZmJhZmYxNWJi
14
- ZDNjMTVkMzFhNDdjNzJiNzc3NTBiN2VhZWQ2MmM1YmU2ZmY2MWQ1ODRiYzEx
15
- ZjkxNWFlZGEyZjAyMjI0MWVjY2FlMWJkMmUwYmMxNThhOTg2YmQ=
13
+ M2EyZDZjOGE5NjEyZmNjZDFkNmJkMDc5YjdhN2E3NGYzNWRiNDBmNzQwNTQ2
14
+ YTAyZTVlNDBkNjA0NWIyZWIyNTIxODEyOGM3OTlhZTBiMGE2YWJjMDc0YmQ1
15
+ YzhlOTIyMjZjNzNkNzM2Mzg1NWEwZWEwZTE5ZTJjNGI2YjJjZjg=
@@ -1 +1 @@
1
- 2.1.6
1
+ 1.9.3
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  ruby:
3
+ - '1.9'
4
+ - '2.0'
3
5
  - '2.1'
4
6
  - '2.2'
5
7
  - '2.3'
data/README.md CHANGED
@@ -1,3 +1,112 @@
1
1
  # iyzipay-ruby
2
2
 
3
- Ruby client is still in development
3
+ [![Build Status](https://travis-ci.org/iyzico/iyzipay-ruby.svg?branch=master)](https://travis-ci.org/iyzico/iyzipay-ruby)
4
+
5
+ You can sign up for an iyzico account at https://iyzico.com
6
+
7
+ # Requirements
8
+
9
+ * Ruby 1.9.3 or newer
10
+ * rest-client
11
+
12
+ # Installation
13
+
14
+ gem install iyzipay
15
+
16
+ # Usage
17
+
18
+ ```ruby
19
+
20
+ before :all do
21
+ @options = Iyzipay::Options.new
22
+ @options.api_key = 'your api key'
23
+ @options.secret_key = 'your secret key'
24
+ @options.base_url = 'https://api.iyzipay.com'
25
+ end
26
+
27
+ it 'should create payment with physical and virtual item for listing or subscription' do
28
+ payment_card = {
29
+ cardHolderName: 'John Doe',
30
+ cardNumber: '5528790000000008',
31
+ expireYear: '2030',
32
+ expireMonth: '12',
33
+ cvc: '123',
34
+ registerCard: 0
35
+ }
36
+ buyer = {
37
+ id: 'BY789',
38
+ name: 'John',
39
+ surname: 'Doe',
40
+ identityNumber: '74300864791',
41
+ email: 'email@email.com',
42
+ gsmNumber: '+905350000000',
43
+ registrationDate: '2013-04-21 15:12:09',
44
+ lastLoginDate: '2015-10-05 12:43:35',
45
+ registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
46
+ city: 'Istanbul',
47
+ country: 'Turkey',
48
+ zipCode: '34732',
49
+ ip: '85.34.78.112'
50
+ }
51
+ address = {
52
+ address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
53
+ zipCode: '34732',
54
+ contactName: 'John Doe',
55
+ city: 'Istanbul',
56
+ country: 'Turkey'
57
+ }
58
+
59
+ item1 = {
60
+ id: 'BI101',
61
+ name: 'Binocular',
62
+ category1: 'Collectibles',
63
+ category2: 'Accessories',
64
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
65
+ price: '0.3',
66
+ }
67
+ item2 = {
68
+ id: 'BI102',
69
+ name: 'Game code',
70
+ category1: 'Game',
71
+ category2: 'Online Game Items',
72
+ itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
73
+ price: '0.5',
74
+ }
75
+ item3 = {
76
+ id: 'BI103',
77
+ name: 'Usb',
78
+ category1: 'Electronics',
79
+ category2: 'Usb / Cable',
80
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
81
+ price: '0.2',
82
+ }
83
+ request = {
84
+ locale: 'tr',
85
+ conversationId: '123456789',
86
+ price: '1.0',
87
+ paidPrice: '1.1',
88
+ installment: 1,
89
+ paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
90
+ basketId: 'B67832',
91
+ paymentGroup: Iyzipay::Model::PaymentGroup::SUBSCRIPTION,
92
+ paymentCard: payment_card,
93
+ buyer: buyer,
94
+ billingAddress: address,
95
+ shippingAddress: address,
96
+ basketItems: [item1, item2, item3]
97
+ }
98
+ payment = Iyzipay::Model::Payment.new.create(request, @options)
99
+ begin
100
+ $stderr.puts payment.inspect
101
+ rescue
102
+ $stderr.puts 'oops'
103
+ raise
104
+ end
105
+ end
106
+ ```
107
+ See other samples under iyzipay-ruby/spec module.
108
+
109
+ Testing
110
+ =======
111
+
112
+ You can run specs with RSpec under spec module.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.29
1
+ 1.0.31
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = 'iyzipay'
7
7
  s.version = Iyzipay::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.required_ruby_version = '>= 2.1.6'
9
+ s.required_ruby_version = '>= 1.9.3'
10
10
  s.summary = %q{iyzipay api ruby client}
11
11
  s.description = %q{iyzipay api ruby client. You can sign up for an iyzico account at https://iyzico.com}
12
12
  s.authors = ['Iyzico']
@@ -39,5 +39,6 @@ require_relative 'model/refund'
39
39
  require_relative 'model/refund_charged_from_merchant'
40
40
  require_relative 'model/sub_merchant'
41
41
  require_relative 'model/sub_merchant_type'
42
+ require_relative 'model/threeds_initialize'
42
43
  require_relative 'model/threeds_initialize_pre_auth'
43
44
  require_relative 'model/threeds_payment'
@@ -3,12 +3,19 @@ module Iyzipay
3
3
  class Payment < IyzipayResource
4
4
 
5
5
  def create(request = {}, options)
6
- pki_string = to_pki_string(request)
6
+ pki_string = to_pki_string_create(request)
7
7
  HttpClient.post("#{options.base_url}/payment/iyzipos/auth/ecom", get_http_header(pki_string, options), request.to_json)
8
8
  end
9
9
 
10
- def to_pki_string(request)
11
- PkiBuilder.new.append_super(super).
10
+ def retrieve(request = {}, options)
11
+ pki_string = to_pki_string_retrieve(request)
12
+ HttpClient.post("#{options.base_url}/payment/detail", get_http_header(pki_string, options), request.to_json)
13
+ end
14
+
15
+ def to_pki_string_create(request)
16
+ PkiBuilder.new.
17
+ append(:locale, request[:locale]).
18
+ append(:conversationId, request[:conversationId]).
12
19
  append_price(:price, request[:price]).
13
20
  append_price(:paidPrice, request[:paidPrice]).
14
21
  append(:installment, request[:installment]).
@@ -21,6 +28,18 @@ module Iyzipay
21
28
  append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
22
29
  append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
23
30
  append(:paymentSource, request[:paymentSource]).
31
+ append(:currency, request[:currency]).
32
+ append(:posOrderId, request[:posOrderId]).
33
+ append(:connectorName, request[:connectorName]).
34
+ get_request_string
35
+ end
36
+
37
+ def to_pki_string_retrieve(request)
38
+ PkiBuilder.new.
39
+ append(:locale, request[:locale]).
40
+ append(:conversationId, request[:conversationId]).
41
+ append(:paymentId, request[:paymentId]).
42
+ append(:paymentConversationId, request[:paymentConversationId]).
24
43
  get_request_string
25
44
  end
26
45
  end
@@ -28,6 +28,9 @@ module Iyzipay
28
28
  append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
29
29
  append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
30
30
  append(:paymentSource, request[:paymentSource]).
31
+ append(:currency, request[:currency]).
32
+ append(:posOrderId, request[:posOrderId]).
33
+ append(:connectorName, request[:connectorName]).
31
34
  get_request_string
32
35
  end
33
36
 
@@ -21,6 +21,10 @@ module Iyzipay
21
21
  append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
22
22
  append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
23
23
  append(:paymentSource, request[:paymentSource]).
24
+ append(:currency, request[:currency]).
25
+ append(:posOrderId, request[:posOrderId]).
26
+ append(:connectorName, request[:connectorName]).
27
+ append(:callbackUrl, request[:callbackUrl]).
24
28
  get_request_string
25
29
  end
26
30
  end
@@ -21,9 +21,10 @@ module Iyzipay
21
21
  append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
22
22
  append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
23
23
  append(:paymentSource, request[:paymentSource]).
24
- append(:callbackUrl, request[:callbackUrl]).
24
+ append(:currency, request[:currency]).
25
25
  append(:posOrderId, request[:posOrderId]).
26
26
  append(:connectorName, request[:connectorName]).
27
+ append(:callbackUrl, request[:callbackUrl]).
27
28
  get_request_string
28
29
  end
29
30
  end
@@ -10,6 +10,86 @@ RSpec.describe 'Iyzipay' do
10
10
  @options.base_url = 'https://api.iyzipay.com'
11
11
  end
12
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
+ paymentCard: payment_card,
79
+ buyer: buyer,
80
+ billingAddress: address,
81
+ shippingAddress: address,
82
+ basketItems: [item1, item2, item3]
83
+ }
84
+ payment = Iyzipay::Model::PaymentPreAuth.new.create(request, @options)
85
+ begin
86
+ $stderr.puts payment.inspect
87
+ rescue
88
+ $stderr.puts 'oops'
89
+ raise
90
+ end
91
+ end
92
+
13
93
  it 'should create payment with physical and virtual item for standard merchant' do
14
94
  payment_card = {
15
95
  cardHolderName: 'John Doe',
@@ -96,6 +176,86 @@ RSpec.describe 'Iyzipay' do
96
176
  end
97
177
  end
98
178
 
179
+ it 'should create payment with physical and virtual item for listing or subscription' do
180
+ payment_card = {
181
+ cardHolderName: 'John Doe',
182
+ cardNumber: '5528790000000008',
183
+ expireYear: '2030',
184
+ expireMonth: '12',
185
+ cvc: '123',
186
+ registerCard: 0
187
+ }
188
+ buyer = {
189
+ id: 'BY789',
190
+ name: 'John',
191
+ surname: 'Doe',
192
+ identityNumber: '74300864791',
193
+ email: 'email@email.com',
194
+ gsmNumber: '+905350000000',
195
+ registrationDate: '2013-04-21 15:12:09',
196
+ lastLoginDate: '2015-10-05 12:43:35',
197
+ registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
198
+ city: 'Istanbul',
199
+ country: 'Turkey',
200
+ zipCode: '34732',
201
+ ip: '85.34.78.112'
202
+ }
203
+ address = {
204
+ address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
205
+ zipCode: '34732',
206
+ contactName: 'John Doe',
207
+ city: 'Istanbul',
208
+ country: 'Turkey'
209
+ }
210
+
211
+ item1 = {
212
+ id: 'BI101',
213
+ name: 'Binocular',
214
+ category1: 'Collectibles',
215
+ category2: 'Accessories',
216
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
217
+ price: '0.3',
218
+ }
219
+ item2 = {
220
+ id: 'BI102',
221
+ name: 'Game code',
222
+ category1: 'Game',
223
+ category2: 'Online Game Items',
224
+ itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
225
+ price: '0.5',
226
+ }
227
+ item3 = {
228
+ id: 'BI103',
229
+ name: 'Usb',
230
+ category1: 'Electronics',
231
+ category2: 'Usb / Cable',
232
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
233
+ price: '0.2',
234
+ }
235
+ request = {
236
+ locale: 'tr',
237
+ conversationId: '123456789',
238
+ price: '1.0',
239
+ paidPrice: '1.1',
240
+ installment: 1,
241
+ paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
242
+ basketId: 'B67832',
243
+ paymentGroup: Iyzipay::Model::PaymentGroup::SUBSCRIPTION,
244
+ paymentCard: payment_card,
245
+ buyer: buyer,
246
+ billingAddress: address,
247
+ shippingAddress: address,
248
+ basketItems: [item1, item2, item3]
249
+ }
250
+ payment = Iyzipay::Model::PaymentPreAuth.new.create(request, @options)
251
+ begin
252
+ $stderr.puts payment.inspect
253
+ rescue
254
+ $stderr.puts 'oops'
255
+ raise
256
+ end
257
+ end
258
+
99
259
  it 'should retrieve payment' do
100
260
  request = {
101
261
  locale: 'tr',
@@ -10,6 +10,86 @@ RSpec.describe 'Iyzipay' do
10
10
  @options.base_url = 'https://api.iyzipay.com'
11
11
  end
12
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
+ paymentCard: payment_card,
79
+ buyer: buyer,
80
+ billingAddress: address,
81
+ shippingAddress: address,
82
+ basketItems: [item1, item2, item3]
83
+ }
84
+ payment = Iyzipay::Model::Payment.new.create(request, @options)
85
+ begin
86
+ $stderr.puts payment.inspect
87
+ rescue
88
+ $stderr.puts 'oops'
89
+ raise
90
+ end
91
+ end
92
+
13
93
  it 'should create payment with physical and virtual item for market place' do
14
94
  payment_card = {
15
95
  cardHolderName: 'John Doe',
@@ -49,7 +129,7 @@ RSpec.describe 'Iyzipay' do
49
129
  category2: 'Accessories',
50
130
  itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
51
131
  price: '0.3',
52
- subMerchantKey: 'sub merchant key',
132
+ subMerchantKey: 'ha3us4v5mk2652kkjk5728cc4407an',
53
133
  subMerchantPrice: '0.27'
54
134
  }
55
135
  item2 = {
@@ -59,7 +139,7 @@ RSpec.describe 'Iyzipay' do
59
139
  category2: 'Online Game Items',
60
140
  itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
61
141
  price: '0.5',
62
- subMerchantKey: 'sub merchant key',
142
+ subMerchantKey: 'ha3us4v5mk2652kkjk5728cc4407an',
63
143
  subMerchantPrice: '0.42'
64
144
  }
65
145
  item3 = {
@@ -69,7 +149,7 @@ RSpec.describe 'Iyzipay' do
69
149
  category2: 'Usb / Cable',
70
150
  itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
71
151
  price: '0.2',
72
- subMerchantKey: 'sub merchant key',
152
+ subMerchantKey: 'ha3us4v5mk2652kkjk5728cc4407an',
73
153
  subMerchantPrice: '0.18'
74
154
  }
75
155
  request = {
@@ -96,6 +176,102 @@ RSpec.describe 'Iyzipay' do
96
176
  end
97
177
  end
98
178
 
179
+ it 'should create payment with physical and virtual item for listing or subscription' do
180
+ payment_card = {
181
+ cardHolderName: 'John Doe',
182
+ cardNumber: '5528790000000008',
183
+ expireYear: '2030',
184
+ expireMonth: '12',
185
+ cvc: '123',
186
+ registerCard: 0
187
+ }
188
+ buyer = {
189
+ id: 'BY789',
190
+ name: 'John',
191
+ surname: 'Doe',
192
+ identityNumber: '74300864791',
193
+ email: 'email@email.com',
194
+ gsmNumber: '+905350000000',
195
+ registrationDate: '2013-04-21 15:12:09',
196
+ lastLoginDate: '2015-10-05 12:43:35',
197
+ registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
198
+ city: 'Istanbul',
199
+ country: 'Turkey',
200
+ zipCode: '34732',
201
+ ip: '85.34.78.112'
202
+ }
203
+ address = {
204
+ address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
205
+ zipCode: '34732',
206
+ contactName: 'John Doe',
207
+ city: 'Istanbul',
208
+ country: 'Turkey'
209
+ }
210
+
211
+ item1 = {
212
+ id: 'BI101',
213
+ name: 'Binocular',
214
+ category1: 'Collectibles',
215
+ category2: 'Accessories',
216
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
217
+ price: '0.3',
218
+ }
219
+ item2 = {
220
+ id: 'BI102',
221
+ name: 'Game code',
222
+ category1: 'Game',
223
+ category2: 'Online Game Items',
224
+ itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
225
+ price: '0.5',
226
+ }
227
+ item3 = {
228
+ id: 'BI103',
229
+ name: 'Usb',
230
+ category1: 'Electronics',
231
+ category2: 'Usb / Cable',
232
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
233
+ price: '0.2',
234
+ }
235
+ request = {
236
+ locale: 'tr',
237
+ conversationId: '123456789',
238
+ price: '1.0',
239
+ paidPrice: '1.1',
240
+ installment: 1,
241
+ paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
242
+ basketId: 'B67832',
243
+ paymentGroup: Iyzipay::Model::PaymentGroup::SUBSCRIPTION,
244
+ paymentCard: payment_card,
245
+ buyer: buyer,
246
+ billingAddress: address,
247
+ shippingAddress: address,
248
+ basketItems: [item1, item2, item3]
249
+ }
250
+ payment = Iyzipay::Model::Payment.new.create(request, @options)
251
+ begin
252
+ $stderr.puts payment.inspect
253
+ rescue
254
+ $stderr.puts 'oops'
255
+ raise
256
+ end
257
+ end
258
+
259
+ it 'should retrieve payment' do
260
+ request = {
261
+ locale: 'tr',
262
+ conversationId: '123456789',
263
+ paymentId: '262',
264
+ paymentConversationId: '123456789'
265
+ }
266
+ bkm = Iyzipay::Model::Payment.new.retrieve(request, @options)
267
+ begin
268
+ $stderr.puts bkm.inspect
269
+ rescue
270
+ $stderr.puts 'oops'
271
+ raise
272
+ end
273
+ end
274
+
99
275
  after :each do
100
276
  end
101
277
  end
@@ -0,0 +1,224 @@
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://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
+ paymentCard: payment_card,
80
+ buyer: buyer,
81
+ billingAddress: address,
82
+ shippingAddress: address,
83
+ basketItems: [item1, item2, item3]
84
+ }
85
+ threeds_initialize = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
86
+ begin
87
+ $stderr.puts threeds_initialize.inspect
88
+ threeds_initialize_dict = JSON.parse(threeds_initialize)
89
+ unless threeds_initialize_dict['threeDSHtmlContent'].nil?
90
+ $stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
91
+ end
92
+ rescue
93
+ $stderr.puts 'oops'
94
+ raise
95
+ end
96
+ end
97
+
98
+ it 'should create three payment with physical and virtual item for market place' do
99
+ payment_card = {
100
+ cardHolderName: 'John Doe',
101
+ cardNumber: '5528790000000008',
102
+ expireYear: '2030',
103
+ expireMonth: '12',
104
+ cvc: '123',
105
+ registerCard: 0
106
+ }
107
+ buyer = {
108
+ id: 'BY789',
109
+ name: 'John',
110
+ surname: 'Doe',
111
+ identityNumber: '74300864791',
112
+ email: 'email@email.com',
113
+ gsmNumber: '+905350000000',
114
+ registrationDate: '2013-04-21 15:12:09',
115
+ lastLoginDate: '2015-10-05 12:43:35',
116
+ registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
117
+ city: 'Istanbul',
118
+ country: 'Turkey',
119
+ zipCode: '34732',
120
+ ip: '85.34.78.112'
121
+ }
122
+ address = {
123
+ address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
124
+ zipCode: '34732',
125
+ contactName: 'John Doe',
126
+ city: 'Istanbul',
127
+ country: 'Turkey'
128
+ }
129
+
130
+ item1 = {
131
+ id: 'BI101',
132
+ name: 'Binocular',
133
+ category1: 'Collectibles',
134
+ category2: 'Accessories',
135
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
136
+ price: '0.3',
137
+ subMerchantKey: 'sub merchant key',
138
+ subMerchantPrice: '0.27'
139
+ }
140
+ item2 = {
141
+ id: 'BI102',
142
+ name: 'Game code',
143
+ category1: 'Game',
144
+ category2: 'Online Game Items',
145
+ itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
146
+ price: '0.5',
147
+ subMerchantKey: 'sub merchant key',
148
+ subMerchantPrice: '0.42'
149
+ }
150
+ item3 = {
151
+ id: 'BI103',
152
+ name: 'Usb',
153
+ category1: 'Electronics',
154
+ category2: 'Usb / Cable',
155
+ itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
156
+ price: '0.2',
157
+ subMerchantKey: 'sub merchant key',
158
+ subMerchantPrice: '0.18'
159
+ }
160
+ request = {
161
+ locale: 'tr',
162
+ conversationId: '123456789',
163
+ price: '1.0',
164
+ paidPrice: '1.1',
165
+ installment: 1,
166
+ paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
167
+ basketId: 'B67832',
168
+ paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
169
+ callbackUrl: 'https://www.merchant.com/callback',
170
+ paymentCard: payment_card,
171
+ buyer: buyer,
172
+ billingAddress: address,
173
+ shippingAddress: address,
174
+ basketItems: [item1, item2, item3]
175
+ }
176
+ threeds_initialize = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
177
+ begin
178
+ $stderr.puts threeds_initialize.inspect
179
+
180
+ threeds_initialize_dict = JSON.parse(threeds_initialize)
181
+ unless threeds_initialize_dict['threeDSHtmlContent'].nil?
182
+ $stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
183
+ end
184
+ rescue
185
+ $stderr.puts 'oops'
186
+ raise
187
+ end
188
+ end
189
+
190
+ it 'should auth threeds' do
191
+ request = {
192
+ locale: 'tr',
193
+ conversationId: '123456789',
194
+ paymentId: '1',
195
+ conversationData: 'conversation data',
196
+ }
197
+ threeds_payment = Iyzipay::Model::ThreedsPayment.new.retrieve(request, @options)
198
+ begin
199
+ $stderr.puts threeds_payment.inspect
200
+ rescue
201
+ $stderr.puts 'oops'
202
+ raise
203
+ end
204
+ end
205
+
206
+ it 'should retrieve payment' do
207
+ request = {
208
+ locale: 'tr',
209
+ conversationId: '123456789',
210
+ paymentId: '9',
211
+ paymentConversationId: '123456789',
212
+ }
213
+ threeds_payment = Iyzipay::Model::ThreedsPayment.new.retrieve(request, @options)
214
+ begin
215
+ $stderr.puts threeds_payment.inspect
216
+ rescue
217
+ $stderr.puts 'oops'
218
+ raise
219
+ end
220
+ end
221
+
222
+ after :each do
223
+ end
224
+ end
@@ -10,6 +10,91 @@ RSpec.describe 'Iyzipay' do
10
10
  @options.base_url = 'https://api.iyzipay.com'
11
11
  end
12
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
+ paymentCard: payment_card,
80
+ buyer: buyer,
81
+ billingAddress: address,
82
+ shippingAddress: address,
83
+ basketItems: [item1, item2, item3]
84
+ }
85
+ threeds_initialize_pre_auth = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
86
+ begin
87
+ $stderr.puts threeds_initialize_pre_auth.inspect
88
+ threeds_initialize_dict = JSON.parse(threeds_initialize_pre_auth)
89
+ unless threeds_initialize_dict['threeDSHtmlContent'].nil?
90
+ $stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
91
+ end
92
+ rescue
93
+ $stderr.puts 'oops'
94
+ raise
95
+ end
96
+ end
97
+
13
98
  it 'should create three payment with physical and virtual item for market place' do
14
99
  payment_card = {
15
100
  cardHolderName: 'John Doe',
@@ -106,7 +191,7 @@ RSpec.describe 'Iyzipay' do
106
191
  request = {
107
192
  locale: 'tr',
108
193
  conversationId: '123456789',
109
- paymentId: '1',
194
+ paymentId: '9',
110
195
  conversationData: 'conversation data',
111
196
  }
112
197
  threeds_payment = Iyzipay::Model::ThreedsPayment.new.create(request, @options)
@@ -122,10 +207,10 @@ RSpec.describe 'Iyzipay' do
122
207
  request = {
123
208
  locale: 'tr',
124
209
  conversationId: '123456789',
125
- paymentId: '9',
210
+ paymentId: '267',
126
211
  paymentConversationId: '123456789',
127
212
  }
128
- threeds_payment = Iyzipay::Model::PaymentPreAuth.new.retrieve(request, @options)
213
+ threeds_payment = Iyzipay::Model::ThreedsPayment.new.retrieve(request, @options)
129
214
  begin
130
215
  $stderr.puts threeds_payment.inspect
131
216
  rescue
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iyzipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.29
4
+ version: 1.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iyzico
@@ -157,6 +157,7 @@ files:
157
157
  - spec/retrieve_transactions_spec.rb
158
158
  - spec/spec_helper.rb
159
159
  - spec/sub_merchant_spec.rb
160
+ - spec/threeds_payment_spec.rb
160
161
  - spec/threeds_pre_auth_spec.rb
161
162
  homepage: http://rubygems.org/gems/iyzipay
162
163
  licenses:
@@ -170,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
171
  requirements:
171
172
  - - ! '>='
172
173
  - !ruby/object:Gem::Version
173
- version: 2.1.6
174
+ version: 1.9.3
174
175
  required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  requirements:
176
177
  - - ! '>='