iyzipay 1.0.36 → 1.0.44

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.
data/spec/pecco_spec.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require_relative 'spec_helper'
4
+ require_relative 'builder'
4
5
 
5
6
  RSpec.describe 'Iyzipay' do
6
7
  before :all do
7
8
  @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'
9
+ @options.api_key = SpecOptions::API_KEY
10
+ @options.secret_key = SpecOptions::SECRET_KEY
11
+ @options.base_url = SpecOptions::BASE_URL
11
12
  end
12
13
 
13
14
  it 'should initialize pecco' do
@@ -75,9 +76,14 @@ RSpec.describe 'Iyzipay' do
75
76
  pecco_initialize = Iyzipay::Model::PeccoInitialize.new.create(request, @options)
76
77
  begin
77
78
  $stderr.puts pecco_initialize.inspect
78
- threeds_initialize_dict = JSON.parse(pecco_initialize)
79
- unless threeds_initialize_dict['htmlContent'].nil?
80
- $stderr.puts Base64.decode64(threeds_initialize_dict['htmlContent']).inspect
79
+ pecco_initialize = JSON.parse(pecco_initialize)
80
+ unless pecco_initialize['htmlContent'].nil?
81
+ $stdout.puts Base64.decode64(pecco_initialize['htmlContent']).inspect
82
+ expect(pecco_initialize['status']).to eq('success')
83
+ expect(pecco_initialize['locale']).to eq('tr')
84
+ expect(pecco_initialize['systemTime']).not_to be_nil
85
+ expect(pecco_initialize['conversationId']).to eq('123456789')
86
+ expect(pecco_initialize['htmlContent']).not_to be_nil
81
87
  end
82
88
  rescue
83
89
  $stderr.puts 'oops'
@@ -86,16 +92,21 @@ RSpec.describe 'Iyzipay' do
86
92
  end
87
93
 
88
94
  it 'should create pecco payment' do
95
+
96
+ # This test needs manual payment from Pecco on sandbox environment. So it does not contain any assertions.
97
+ pecco_initialize = Builder::PeccoInitializeBuilder.new.create_pecco_initialize(@options)
98
+
89
99
  request = {
90
100
  locale: Iyzipay::Model::Locale::TR,
91
101
  conversationId: '123456789',
92
- token: 'token'
102
+ token: pecco_initialize['token']
93
103
  }
94
104
  pecco_payment = Iyzipay::Model::PeccoPayment.new.create(request, @options)
105
+
95
106
  begin
96
- $stderr.puts pecco_payment.inspect
107
+ $stdout.puts pecco_payment.inspect
97
108
  rescue
98
- $stderr.puts 'oops'
109
+ $stdout.puts 'oops'
99
110
  raise
100
111
  end
101
112
  end
data/spec/refund_spec.rb CHANGED
@@ -1,27 +1,70 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require_relative 'spec_helper'
4
+ require_relative 'builder'
4
5
 
5
6
  RSpec.describe 'Iyzipay' do
6
7
  before :all do
7
8
  @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'
9
+ @options.api_key = SpecOptions::API_KEY
10
+ @options.secret_key = SpecOptions::SECRET_KEY
11
+ @options.base_url = SpecOptions::BASE_URL
11
12
  end
12
13
 
13
14
  it 'should refund payment' do
15
+ # create payment
16
+ payment = Builder::PaymentBuilder.new.create_standard_listing_payment(@options)
17
+
14
18
  request = {
15
19
  locale: Iyzipay::Model::Locale::TR,
16
20
  conversationId: '123456789',
17
- paymentTransactionId: '1',
18
- price: '0.5',
21
+ paymentTransactionId: payment['itemTransactions'][0]['paymentTransactionId'],
22
+ price: '0.2',
19
23
  currency: Iyzipay::Model::Currency::TRY,
20
24
  ip: '85.34.78.112'
21
25
  }
22
26
  refund = Iyzipay::Model::Refund.new.create(request, @options)
23
27
  begin
24
- $stderr.puts refund.inspect
28
+ $stdout.puts refund.inspect
29
+ refund = JSON.parse(refund)
30
+ expect(refund['status']).to eq('success')
31
+ expect(refund['locale']).to eq('tr')
32
+ expect(refund['systemTime']).not_to be_nil
33
+ expect(refund['conversationId']).to eq('123456789')
34
+ expect(refund['paymentId']).to eq(payment['paymentId'])
35
+ expect(refund['paymentTransactionId']).to eq(payment['itemTransactions'][0]['paymentTransactionId'])
36
+ expect(refund['price']).to eq(0.2)
37
+ rescue
38
+ $stderr.puts 'oops'
39
+ raise
40
+ end
41
+ end
42
+
43
+ it 'should refund payment with reason and description' do
44
+ # create payment
45
+ payment = Builder::PaymentBuilder.new.create_standard_listing_payment(@options)
46
+
47
+ request = {
48
+ locale: Iyzipay::Model::Locale::TR,
49
+ conversationId: '123456789',
50
+ paymentTransactionId: payment['itemTransactions'][0]['paymentTransactionId'],
51
+ price: '0.2',
52
+ currency: Iyzipay::Model::Currency::TRY,
53
+ ip: '85.34.78.112',
54
+ reason: Iyzipay::Model::RefundReason::OTHER,
55
+ description: 'customer requested for default sample'
56
+ }
57
+ refund = Iyzipay::Model::Refund.new.create(request, @options)
58
+ begin
59
+ $stdout.puts refund.inspect
60
+ refund = JSON.parse(refund)
61
+ expect(refund['status']).to eq('success')
62
+ expect(refund['locale']).to eq('tr')
63
+ expect(refund['systemTime']).not_to be_nil
64
+ expect(refund['conversationId']).to eq('123456789')
65
+ expect(refund['paymentId']).to eq(payment['paymentId'])
66
+ expect(refund['paymentTransactionId']).to eq(payment['itemTransactions'][0]['paymentTransactionId'])
67
+ expect(refund['price']).to eq(0.2)
25
68
  rescue
26
69
  $stderr.puts 'oops'
27
70
  raise
@@ -5,9 +5,9 @@ require_relative 'spec_helper'
5
5
  RSpec.describe 'Iyzipay' do
6
6
  before :all do
7
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'
8
+ @options.api_key = SpecOptions::API_KEY
9
+ @options.secret_key = SpecOptions::SECRET_KEY
10
+ @options.base_url = SpecOptions::BASE_URL
11
11
  end
12
12
 
13
13
  it 'should retrieve payout completed transactions' do
@@ -16,9 +16,14 @@ RSpec.describe 'Iyzipay' do
16
16
  conversationId: '123456789',
17
17
  date: '2016-01-22 19:13:00'
18
18
  }
19
- refund = Iyzipay::Model::PayoutCompletedTransactionList.new.retrieve(request, @options)
19
+ transaction_list = Iyzipay::Model::PayoutCompletedTransactionList.new.retrieve(request, @options)
20
20
  begin
21
- $stderr.puts refund.inspect
21
+ $stdout.puts transaction_list.inspect
22
+ transaction_list = JSON.parse(transaction_list)
23
+ expect(transaction_list['status']).to eq('success')
24
+ expect(transaction_list['locale']).to eq('tr')
25
+ expect(transaction_list['systemTime']).not_to be_nil
26
+ expect(transaction_list['conversationId']).to eq('123456789')
22
27
  rescue
23
28
  $stderr.puts 'oops'
24
29
  raise
@@ -31,9 +36,14 @@ RSpec.describe 'Iyzipay' do
31
36
  conversationId: '123456789',
32
37
  date: '2016-01-22 19:13:00'
33
38
  }
34
- refund = Iyzipay::Model::BouncedBankTransferList.new.retrieve(request, @options)
39
+ bounced_bank_transfer_list = Iyzipay::Model::BouncedBankTransferList.new.retrieve(request, @options)
35
40
  begin
36
- $stderr.puts refund.inspect
41
+ $stdout.puts bounced_bank_transfer_list.inspect
42
+ bounced_bank_transfer_list = JSON.parse(bounced_bank_transfer_list)
43
+ expect(bounced_bank_transfer_list['status']).to eq('success')
44
+ expect(bounced_bank_transfer_list['locale']).to eq('tr')
45
+ expect(bounced_bank_transfer_list['systemTime']).not_to be_nil
46
+ expect(bounced_bank_transfer_list['conversationId']).to eq('123456789')
37
47
  rescue
38
48
  $stderr.puts 'oops'
39
49
  raise
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
- require_relative '../lib/Iyzipay.rb'
1
+ require_relative '../lib/iyzipay.rb'
2
+ require_relative 'spec_options'
2
3
 
3
4
  RSpec.configure do |config|
4
5
  # rspec-expectations config goes here. You can use an alternate
@@ -0,0 +1,5 @@
1
+ module SpecOptions
2
+ API_KEY = 'sandbox-afXhZPW0MQlE4dCUUlHcEopnMBgXnAZI'
3
+ SECRET_KEY = 'sandbox-wbwpzKIiplZxI3hh5ALI4FJyAcZKL6kq'
4
+ BASE_URL = 'https://sandbox-api.iyzipay.com'
5
+ end
@@ -1,25 +1,27 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require_relative 'spec_helper'
4
+ require_relative 'builder'
4
5
 
5
6
  RSpec.describe 'Iyzipay' do
6
7
  before :all do
7
8
  @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'
9
+ @options.api_key = SpecOptions::API_KEY
10
+ @options.secret_key = SpecOptions::SECRET_KEY
11
+ @options.base_url = SpecOptions::BASE_URL
11
12
  end
12
13
 
13
14
  it 'should create personal sub merchant' do
15
+ random_number = Random.rand(11**11).to_s
14
16
  request = {
15
17
  locale: Iyzipay::Model::Locale::TR,
16
18
  conversationId: '123456789',
17
- subMerchantExternalId: 'B49224',
19
+ subMerchantExternalId: 'B' + random_number,
18
20
  subMerchantType: Iyzipay::Model::SubMerchantType::PERSONAL,
19
21
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
20
22
  contactName: 'John',
21
23
  contactSurname: 'Doe',
22
- email: 'email@submerchantemail.com',
24
+ email: random_number + '@email.com',
23
25
  gsmNumber: '+905350000000',
24
26
  name: 'John\'s market',
25
27
  iban: 'TR180006200119000006672315',
@@ -28,7 +30,12 @@ RSpec.describe 'Iyzipay' do
28
30
  }
29
31
  sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
30
32
  begin
31
- $stderr.puts sub_merchant.inspect
33
+ $stdout.puts sub_merchant.inspect
34
+ sub_merchant = JSON.parse(sub_merchant)
35
+ expect(sub_merchant['status']).to eq('success')
36
+ expect(sub_merchant['locale']).to eq('tr')
37
+ expect(sub_merchant['systemTime']).not_to be_nil
38
+ expect(sub_merchant['conversationId']).to eq('123456789')
32
39
  rescue
33
40
  $stderr.puts 'oops'
34
41
  raise
@@ -36,15 +43,16 @@ RSpec.describe 'Iyzipay' do
36
43
  end
37
44
 
38
45
  it 'should create private sub merchant' do
46
+ random_number = Random.rand(11**11).to_s
39
47
  request = {
40
48
  locale: Iyzipay::Model::Locale::TR,
41
49
  conversationId: '123456789',
42
- subMerchantExternalId: 'S49222',
50
+ subMerchantExternalId: 'B' + random_number,
43
51
  subMerchantType: Iyzipay::Model::SubMerchantType::PRIVATE_COMPANY,
44
52
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
45
53
  taxOffice: 'Tax office',
46
54
  legalCompanyTitle: 'John Doe inc',
47
- email: 'email@submerchantemail.com',
55
+ email: random_number + '@email.com',
48
56
  gsmNumber: '+905350000000',
49
57
  name: 'John\'s market',
50
58
  iban: 'TR180006200119000006672315',
@@ -53,7 +61,11 @@ RSpec.describe 'Iyzipay' do
53
61
  }
54
62
  sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
55
63
  begin
56
- $stderr.puts sub_merchant.inspect
64
+ sub_merchant = JSON.parse(sub_merchant)
65
+ expect(sub_merchant['status']).to eq('success')
66
+ expect(sub_merchant['locale']).to eq('tr')
67
+ expect(sub_merchant['systemTime']).not_to be_nil
68
+ expect(sub_merchant['conversationId']).to eq('123456789')
57
69
  rescue
58
70
  $stderr.puts 'oops'
59
71
  raise
@@ -61,10 +73,11 @@ RSpec.describe 'Iyzipay' do
61
73
  end
62
74
 
63
75
  it 'should create limited company sub merchant' do
76
+ random_number = Random.rand(11**11).to_s
64
77
  request = {
65
78
  locale: Iyzipay::Model::Locale::TR,
66
79
  conversationId: '123456789',
67
- subMerchantExternalId: 'AS49224',
80
+ subMerchantExternalId: 'B' + random_number,
68
81
  subMerchantType: Iyzipay::Model::SubMerchantType::LIMITED_OR_JOINT_STOCK_COMPANY,
69
82
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
70
83
  taxOffice: 'Tax office',
@@ -78,7 +91,11 @@ RSpec.describe 'Iyzipay' do
78
91
  }
79
92
  sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
80
93
  begin
81
- $stderr.puts sub_merchant.inspect
94
+ sub_merchant = JSON.parse(sub_merchant)
95
+ expect(sub_merchant['status']).to eq('success')
96
+ expect(sub_merchant['locale']).to eq('tr')
97
+ expect(sub_merchant['systemTime']).not_to be_nil
98
+ expect(sub_merchant['conversationId']).to eq('123456789')
82
99
  rescue
83
100
  $stderr.puts 'oops'
84
101
  raise
@@ -86,11 +103,14 @@ RSpec.describe 'Iyzipay' do
86
103
  end
87
104
 
88
105
  it 'should update personal sub merchant' do
106
+ # create personal sub merchant
107
+ sub_merchant = Builder::SubMerchantBuilder.new.create_personal_sub_merchant(@options)
108
+
89
109
  request = {
90
110
  locale: Iyzipay::Model::Locale::TR,
91
111
  conversationId: '123456789',
92
- subMerchantExternalId: 'B49224',
93
- subMerchantKey: 'sub merchant key',
112
+ subMerchantExternalId: sub_merchant['subMerchantExternalId'],
113
+ subMerchantKey: sub_merchant['subMerchantKey'],
94
114
  iban: 'TR180006200119000006672315',
95
115
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
96
116
  contactName: 'Jane',
@@ -103,7 +123,12 @@ RSpec.describe 'Iyzipay' do
103
123
  }
104
124
  sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
105
125
  begin
106
- $stderr.puts sub_merchant.inspect
126
+ $stdout.puts sub_merchant.inspect
127
+ sub_merchant = JSON.parse(sub_merchant)
128
+ expect(sub_merchant['status']).to eq('success')
129
+ expect(sub_merchant['locale']).to eq('tr')
130
+ expect(sub_merchant['systemTime']).not_to be_nil
131
+ expect(sub_merchant['conversationId']).to eq('123456789')
107
132
  rescue
108
133
  $stderr.puts 'oops'
109
134
  raise
@@ -111,11 +136,14 @@ RSpec.describe 'Iyzipay' do
111
136
  end
112
137
 
113
138
  it 'should update private sub merchant' do
139
+ # create private sub merchant
140
+ sub_merchant = Builder::SubMerchantBuilder.new.create_private_sub_merchant(@options)
141
+
114
142
  request = {
115
143
  locale: Iyzipay::Model::Locale::TR,
116
144
  conversationId: '123456789',
117
145
  subMerchantExternalId: 'S49222',
118
- subMerchantKey: 'sub merchant key',
146
+ subMerchantKey: sub_merchant['subMerchantKey'],
119
147
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
120
148
  taxOffice: 'Tax office',
121
149
  legalCompanyTitle: 'Jane Doe inc',
@@ -128,7 +156,12 @@ RSpec.describe 'Iyzipay' do
128
156
  }
129
157
  sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
130
158
  begin
131
- $stderr.puts sub_merchant.inspect
159
+ $stdout.puts sub_merchant.inspect
160
+ sub_merchant = JSON.parse(sub_merchant)
161
+ expect(sub_merchant['status']).to eq('success')
162
+ expect(sub_merchant['locale']).to eq('tr')
163
+ expect(sub_merchant['systemTime']).not_to be_nil
164
+ expect(sub_merchant['conversationId']).to eq('123456789')
132
165
  rescue
133
166
  $stderr.puts 'oops'
134
167
  raise
@@ -136,10 +169,12 @@ RSpec.describe 'Iyzipay' do
136
169
  end
137
170
 
138
171
  it 'should update limited company sub merchant' do
172
+ sub_merchant = Builder::SubMerchantBuilder.new.create_limited_sub_merchant(@options)
173
+
139
174
  request = {
140
175
  locale: Iyzipay::Model::Locale::TR,
141
176
  conversationId: '123456789',
142
- subMerchantKey: 'sub merchant key',
177
+ subMerchantKey: sub_merchant['subMerchantKey'],
143
178
  address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
144
179
  taxOffice: 'Tax office',
145
180
  taxNumber: '9261877',
@@ -152,7 +187,12 @@ RSpec.describe 'Iyzipay' do
152
187
  }
153
188
  sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
154
189
  begin
155
- $stderr.puts sub_merchant.inspect
190
+ $stdout.puts sub_merchant.inspect
191
+ sub_merchant = JSON.parse(sub_merchant)
192
+ expect(sub_merchant['status']).to eq('success')
193
+ expect(sub_merchant['locale']).to eq('tr')
194
+ expect(sub_merchant['systemTime']).not_to be_nil
195
+ expect(sub_merchant['conversationId']).to eq('123456789')
156
196
  rescue
157
197
  $stderr.puts 'oops'
158
198
  raise
@@ -160,14 +200,22 @@ RSpec.describe 'Iyzipay' do
160
200
  end
161
201
 
162
202
  it 'should retrieve sub merchant' do
203
+ random_number = Random.rand(11**11).to_s
204
+ Builder::SubMerchantBuilder.new.create_limited_sub_merchant_with_external_key(random_number, @options)
205
+
163
206
  request = {
164
207
  locale: Iyzipay::Model::Locale::TR,
165
208
  conversationId: '123456789',
166
- subMerchantExternalId: 'AS49224'
209
+ subMerchantExternalId: random_number
167
210
  }
168
211
  sub_merchant = Iyzipay::Model::SubMerchant.new.retrieve(request, @options)
169
212
  begin
170
- $stderr.puts sub_merchant.inspect
213
+ $stdout.puts sub_merchant.inspect
214
+ sub_merchant = JSON.parse(sub_merchant)
215
+ expect(sub_merchant['status']).to eq('success')
216
+ expect(sub_merchant['locale']).to eq('tr')
217
+ expect(sub_merchant['systemTime']).not_to be_nil
218
+ expect(sub_merchant['conversationId']).to eq('123456789')
171
219
  rescue
172
220
  $stderr.puts 'oops'
173
221
  raise
@@ -1,13 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require_relative 'spec_helper'
4
+ require_relative 'builder'
4
5
 
5
6
  RSpec.describe 'Iyzipay' do
6
7
  before :all do
7
8
  @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'
9
+ @options.api_key = SpecOptions::API_KEY
10
+ @options.secret_key = SpecOptions::SECRET_KEY
11
+ @options.base_url = SpecOptions::BASE_URL
11
12
  end
12
13
 
13
14
  it 'should create payment with physical and virtual item for standard merchant' do
@@ -74,7 +75,7 @@ RSpec.describe 'Iyzipay' do
74
75
  installment: 1,
75
76
  paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
76
77
  basketId: 'B67832',
77
- paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
78
+ paymentGroup: Iyzipay::Model::PaymentGroup::LISTING,
78
79
  callbackUrl: 'https://www.merchant.com/callback',
79
80
  currency: Iyzipay::Model::Currency::TRY,
80
81
  paymentCard: payment_card,
@@ -85,10 +86,13 @@ RSpec.describe 'Iyzipay' do
85
86
  }
86
87
  threeds_initialize = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
87
88
  begin
88
- $stderr.puts threeds_initialize.inspect
89
+ $stdout.puts threeds_initialize.inspect
89
90
  threeds_initialize_dict = JSON.parse(threeds_initialize)
90
91
  unless threeds_initialize_dict['threeDSHtmlContent'].nil?
91
- $stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
92
+ $stdout.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
93
+ expect(threeds_initialize_dict['status']).to eq('success')
94
+ expect(threeds_initialize_dict['locale']).to eq('tr')
95
+ expect(threeds_initialize_dict['systemTime']).not_to be_nil
92
96
  end
93
97
  rescue
94
98
  $stderr.puts 'oops'
@@ -135,8 +139,6 @@ RSpec.describe 'Iyzipay' do
135
139
  category2: 'Accessories',
136
140
  itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
137
141
  price: '0.3',
138
- subMerchantKey: 'sub merchant key',
139
- subMerchantPrice: '0.27'
140
142
  }
141
143
  item2 = {
142
144
  id: 'BI102',
@@ -145,8 +147,6 @@ RSpec.describe 'Iyzipay' do
145
147
  category2: 'Online Game Items',
146
148
  itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
147
149
  price: '0.5',
148
- subMerchantKey: 'sub merchant key',
149
- subMerchantPrice: '0.42'
150
150
  }
151
151
  item3 = {
152
152
  id: 'BI103',
@@ -155,8 +155,6 @@ RSpec.describe 'Iyzipay' do
155
155
  category2: 'Usb / Cable',
156
156
  itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
157
157
  price: '0.2',
158
- subMerchantKey: 'sub merchant key',
159
- subMerchantPrice: '0.18'
160
158
  }
161
159
  request = {
162
160
  locale: Iyzipay::Model::Locale::TR,
@@ -166,7 +164,7 @@ RSpec.describe 'Iyzipay' do
166
164
  installment: 1,
167
165
  paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
168
166
  basketId: 'B67832',
169
- paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
167
+ paymentGroup: Iyzipay::Model::PaymentGroup::LISTING,
170
168
  callbackUrl: 'https://www.merchant.com/callback',
171
169
  currency: Iyzipay::Model::Currency::TRY,
172
170
  paymentCard: payment_card,
@@ -177,11 +175,14 @@ RSpec.describe 'Iyzipay' do
177
175
  }
178
176
  threeds_initialize = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
179
177
  begin
180
- $stderr.puts threeds_initialize.inspect
178
+ $stdout.puts threeds_initialize.inspect
181
179
 
182
180
  threeds_initialize_dict = JSON.parse(threeds_initialize)
183
181
  unless threeds_initialize_dict['threeDSHtmlContent'].nil?
184
- $stderr.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
182
+ $stdout.puts Base64.decode64(threeds_initialize_dict['threeDSHtmlContent']).inspect
183
+ expect(threeds_initialize_dict['status']).to eq('success')
184
+ expect(threeds_initialize_dict['locale']).to eq('tr')
185
+ expect(threeds_initialize_dict['systemTime']).not_to be_nil
185
186
  end
186
187
  rescue
187
188
  $stderr.puts 'oops'
@@ -190,6 +191,7 @@ RSpec.describe 'Iyzipay' do
190
191
  end
191
192
 
192
193
  it 'should auth threeds' do
194
+ # This test needs manual payment from Pecco on sandbox environment. So it does not contain any assertions.
193
195
  request = {
194
196
  locale: Iyzipay::Model::Locale::TR,
195
197
  conversationId: '123456789',
@@ -198,14 +200,15 @@ RSpec.describe 'Iyzipay' do
198
200
  }
199
201
  threeds_payment = Iyzipay::Model::ThreedsPayment.new.create(request, @options)
200
202
  begin
201
- $stderr.puts threeds_payment.inspect
203
+ $stdout.puts threeds_payment.inspect
202
204
  rescue
203
- $stderr.puts 'oops'
205
+ $stdout.puts 'oops'
204
206
  raise
205
207
  end
206
208
  end
207
209
 
208
210
  it 'should retrieve payment' do
211
+ # This test needs manual payment from Pecco on sandbox environment. So it does not contain any assertions.
209
212
  request = {
210
213
  locale: Iyzipay::Model::Locale::TR,
211
214
  conversationId: '123456789',
@@ -214,9 +217,9 @@ RSpec.describe 'Iyzipay' do
214
217
  }
215
218
  threeds_payment = Iyzipay::Model::ThreedsPayment.new.retrieve(request, @options)
216
219
  begin
217
- $stderr.puts threeds_payment.inspect
220
+ $stdout.puts threeds_payment.inspect
218
221
  rescue
219
- $stderr.puts 'oops'
222
+ $stdout.puts 'oops'
220
223
  raise
221
224
  end
222
225
  end
@@ -0,0 +1,16 @@
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.base_url = 'https://sandbox-api-tls12.iyzipay.com/'
9
+ end
10
+
11
+ it 'should test tls 1.2 support' do
12
+ api_test = Iyzipay::Model::ApiTest.new.retrieve(@options)
13
+ api_test = JSON.parse(api_test)
14
+ expect(api_test['status']).to eq('success')
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iyzipay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.36
4
+ version: 1.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iyzico
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -35,9 +35,6 @@ dependencies:
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.3'
40
- - - ">="
41
38
  - !ruby/object:Gem::Version
42
39
  version: 3.3.0
43
40
  type: :development
@@ -45,9 +42,6 @@ dependencies:
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '3.3'
50
- - - ">="
51
45
  - !ruby/object:Gem::Version
52
46
  version: 3.3.0
53
47
  - !ruby/object:Gem::Dependency
@@ -55,9 +49,6 @@ dependencies:
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '3.3'
60
- - - ">="
61
52
  - !ruby/object:Gem::Version
62
53
  version: 3.3.0
63
54
  type: :development
@@ -65,9 +56,6 @@ dependencies:
65
56
  version_requirements: !ruby/object:Gem::Requirement
66
57
  requirements:
67
58
  - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.3'
70
- - - ">="
71
59
  - !ruby/object:Gem::Version
72
60
  version: 3.3.0
73
61
  description: iyzipay api ruby client. You can sign up for an iyzico account at https://iyzico.com
@@ -79,7 +67,6 @@ files:
79
67
  - ".gitignore"
80
68
  - ".rspec"
81
69
  - ".ruby-gemset"
82
- - ".ruby-version"
83
70
  - ".travis.yml"
84
71
  - Gemfile
85
72
  - LICENSE
@@ -87,8 +74,9 @@ files:
87
74
  - Rakefile
88
75
  - VERSION
89
76
  - contributors
77
+ - gemfiles/Gemfile.nokogiri-1.6.8.1
90
78
  - iyzipay.gemspec
91
- - lib/Iyzipay.rb
79
+ - lib/iyzipay.rb
92
80
  - lib/iyzipay/http_client.rb
93
81
  - lib/iyzipay/iyzipay_resource.rb
94
82
  - lib/iyzipay/model.rb
@@ -136,6 +124,7 @@ files:
136
124
  - lib/iyzipay/model/pecco_payment.rb
137
125
  - lib/iyzipay/model/refund.rb
138
126
  - lib/iyzipay/model/refund_charged_from_merchant.rb
127
+ - lib/iyzipay/model/refund_reason.rb
139
128
  - lib/iyzipay/model/sub_merchant.rb
140
129
  - lib/iyzipay/model/sub_merchant_type.rb
141
130
  - lib/iyzipay/model/threeds_initialize.rb
@@ -147,6 +136,13 @@ files:
147
136
  - spec/approval_spec.rb
148
137
  - spec/bin_number_spec.rb
149
138
  - spec/bkm_spec.rb
139
+ - spec/builder.rb
140
+ - spec/builder/approval_builder.rb
141
+ - spec/builder/card_builder.rb
142
+ - spec/builder/checkout_form_builder.rb
143
+ - spec/builder/payment_builder.rb
144
+ - spec/builder/pecco_initialize_builder.rb
145
+ - spec/builder/sub_merchant_builder.rb
150
146
  - spec/cancel_spec.rb
151
147
  - spec/card_storage_spec.rb
152
148
  - spec/checkout_form_spec.rb
@@ -157,8 +153,10 @@ files:
157
153
  - spec/refund_spec.rb
158
154
  - spec/retrieve_transactions_spec.rb
159
155
  - spec/spec_helper.rb
156
+ - spec/spec_options.rb
160
157
  - spec/sub_merchant_spec.rb
161
158
  - spec/threeds_payment_spec.rb
159
+ - spec/tls12_test_spec.rb
162
160
  homepage: http://rubygems.org/gems/iyzipay
163
161
  licenses:
164
162
  - MIT
@@ -179,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
177
  version: '0'
180
178
  requirements: []
181
179
  rubyforge_project:
182
- rubygems_version: 2.4.5
180
+ rubygems_version: 2.7.3
183
181
  signing_key:
184
182
  specification_version: 4
185
183
  summary: iyzipay api ruby client
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 1.9.3