erdem-iyzipay 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +16 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +180 -0
- data/Rakefile +5 -0
- data/VERSION +1 -0
- data/contributors +2 -0
- data/iyzipay.gemspec +23 -0
- data/lib/Iyzipay.rb +15 -0
- data/lib/iyzipay/http_client.rb +19 -0
- data/lib/iyzipay/iyzipay_resource.rb +60 -0
- data/lib/iyzipay/model/address.rb +17 -0
- data/lib/iyzipay/model/api_test.rb +10 -0
- data/lib/iyzipay/model/approval.rb +17 -0
- data/lib/iyzipay/model/basic_bkm.rb +17 -0
- data/lib/iyzipay/model/basic_bkm_initialize.rb +24 -0
- data/lib/iyzipay/model/basic_payment.rb +27 -0
- data/lib/iyzipay/model/basic_payment_post_auth.rb +20 -0
- data/lib/iyzipay/model/basic_payment_pre_auth.rb +27 -0
- data/lib/iyzipay/model/basic_threeds_initialize.rb +27 -0
- data/lib/iyzipay/model/basic_threeds_initialize_pre_auth.rb +27 -0
- data/lib/iyzipay/model/basic_threeds_payment.rb +18 -0
- data/lib/iyzipay/model/basket.rb +26 -0
- data/lib/iyzipay/model/basket_item_type.rb +8 -0
- data/lib/iyzipay/model/bin_number.rb +17 -0
- data/lib/iyzipay/model/bkm.rb +17 -0
- data/lib/iyzipay/model/bkm_initialize.rb +26 -0
- data/lib/iyzipay/model/bounced_bank_transfer_list.rb +17 -0
- data/lib/iyzipay/model/buyer.rb +25 -0
- data/lib/iyzipay/model/cancel.rb +18 -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/checkout_form.rb +17 -0
- data/lib/iyzipay/model/checkout_form_initialize.rb +31 -0
- data/lib/iyzipay/model/checkout_form_initialize_pre_auth.rb +30 -0
- data/lib/iyzipay/model/cross_booking_from_sub_merchant.rb +20 -0
- data/lib/iyzipay/model/cross_booking_to_sub_merchant.rb +20 -0
- data/lib/iyzipay/model/currency.rb +11 -0
- data/lib/iyzipay/model/disapproval.rb +17 -0
- data/lib/iyzipay/model/installment_details.rb +19 -0
- data/lib/iyzipay/model/installment_info.rb +18 -0
- data/lib/iyzipay/model/installment_prices.rb +19 -0
- data/lib/iyzipay/model/locale.rb +8 -0
- data/lib/iyzipay/model/payment.rb +47 -0
- data/lib/iyzipay/model/payment_card.rb +22 -0
- data/lib/iyzipay/model/payment_channel.rb +14 -0
- data/lib/iyzipay/model/payment_group.rb +9 -0
- data/lib/iyzipay/model/payment_post_auth.rb +20 -0
- data/lib/iyzipay/model/payment_pre_auth.rb +47 -0
- data/lib/iyzipay/model/payout_completed_transaction_list.rb +17 -0
- data/lib/iyzipay/model/pecco_initialize.rb +27 -0
- data/lib/iyzipay/model/pecco_payment.rb +17 -0
- data/lib/iyzipay/model/refund.rb +20 -0
- data/lib/iyzipay/model/refund_charged_from_merchant.rb +20 -0
- data/lib/iyzipay/model/sub_merchant.rb +72 -0
- data/lib/iyzipay/model/sub_merchant_type.rb +9 -0
- data/lib/iyzipay/model/threeds_initialize.rb +32 -0
- data/lib/iyzipay/model/threeds_initialize_pre_auth.rb +32 -0
- data/lib/iyzipay/model/threeds_payment.rb +34 -0
- data/lib/iyzipay/model.rb +52 -0
- data/lib/iyzipay/options.rb +7 -0
- data/lib/iyzipay/pki_builder.rb +101 -0
- data/spec/api_test_spec.rb +25 -0
- data/spec/approval_spec.rb +30 -0
- data/spec/bin_number_spec.rb +30 -0
- data/spec/bkm_spec.rb +106 -0
- data/spec/cancel_spec.rb +31 -0
- data/spec/card_storage_spec.rb +94 -0
- data/spec/checkout_form_spec.rb +103 -0
- data/spec/disapproval_spec.rb +30 -0
- data/spec/installment_spec.rb +31 -0
- data/spec/payment_spec.rb +276 -0
- data/spec/pecco_spec.rb +105 -0
- data/spec/refund_spec.rb +33 -0
- data/spec/retrieve_transactions_spec.rb +45 -0
- data/spec/spec_helper.rb +80 -0
- data/spec/sub_merchant_spec.rb +179 -0
- data/spec/threeds_payment_spec.rb +226 -0
- metadata +186 -0
@@ -0,0 +1,45 @@
|
|
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 retrieve payout completed transactions' do
|
14
|
+
request = {
|
15
|
+
locale: Iyzipay::Model::Locale::TR,
|
16
|
+
conversationId: '123456789',
|
17
|
+
date: '2016-01-22 19:13:00'
|
18
|
+
}
|
19
|
+
refund = Iyzipay::Model::PayoutCompletedTransactionList.new.retrieve(request, @options)
|
20
|
+
begin
|
21
|
+
$stderr.puts refund.inspect
|
22
|
+
rescue
|
23
|
+
$stderr.puts 'oops'
|
24
|
+
raise
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should retrieve bounced bank transfers' do
|
29
|
+
request = {
|
30
|
+
locale: Iyzipay::Model::Locale::TR,
|
31
|
+
conversationId: '123456789',
|
32
|
+
date: '2016-01-22 19:13:00'
|
33
|
+
}
|
34
|
+
refund = Iyzipay::Model::BouncedBankTransferList.new.retrieve(request, @options)
|
35
|
+
begin
|
36
|
+
$stderr.puts refund.inspect
|
37
|
+
rescue
|
38
|
+
$stderr.puts 'oops'
|
39
|
+
raise
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
after :each do
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require_relative '../lib/Iyzipay.rb'
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
# rspec-expectations config goes here. You can use an alternate
|
5
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
6
|
+
# assertions if you prefer.
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
9
|
+
# and `failure_message` of custom matchers include text for helper methods
|
10
|
+
# defined using `chain`, e.g.:
|
11
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
12
|
+
# # => "be bigger than 2 and smaller than 4"
|
13
|
+
# ...rather than:
|
14
|
+
# # => "be bigger than 2"
|
15
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
16
|
+
end
|
17
|
+
|
18
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
19
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
20
|
+
config.mock_with :rspec do |mocks|
|
21
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
22
|
+
# a real object. This is generally recommended, and will default to
|
23
|
+
# `true` in RSpec 4.
|
24
|
+
mocks.verify_partial_doubles = true
|
25
|
+
end
|
26
|
+
|
27
|
+
# The settings below are suggested to provide a good initial experience
|
28
|
+
# with RSpec, but feel free to customize to your heart's content.
|
29
|
+
=begin
|
30
|
+
# These two settings work together to allow you to limit a spec run
|
31
|
+
# to individual examples or groups you care about by tagging them with
|
32
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
33
|
+
# get run.
|
34
|
+
config.filter_run :focus
|
35
|
+
config.run_all_when_everything_filtered = true
|
36
|
+
|
37
|
+
# Allows RSpec to persist some state between runs in order to support
|
38
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
39
|
+
# you configure your source control system to ignore this file.
|
40
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
41
|
+
|
42
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
43
|
+
# recommended. For more details, see:
|
44
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
45
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
46
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
47
|
+
config.disable_monkey_patching!
|
48
|
+
|
49
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
50
|
+
# be too noisy due to issues in dependencies.
|
51
|
+
config.warnings = true
|
52
|
+
|
53
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
54
|
+
# file, and it's useful to allow more verbose output when running an
|
55
|
+
# individual spec file.
|
56
|
+
if config.files_to_run.one?
|
57
|
+
# Use the documentation formatter for detailed output,
|
58
|
+
# unless a formatter has already been configured
|
59
|
+
# (e.g. via a command-line flag).
|
60
|
+
config.default_formatter = 'doc'
|
61
|
+
end
|
62
|
+
|
63
|
+
# Print the 10 slowest examples and example groups at the
|
64
|
+
# end of the spec run, to help surface which specs are running
|
65
|
+
# particularly slow.
|
66
|
+
config.profile_examples = 10
|
67
|
+
|
68
|
+
# Run specs in random order to surface order dependencies. If you find an
|
69
|
+
# order dependency and want to debug it, you can fix the order by providing
|
70
|
+
# the seed, which is printed after each run.
|
71
|
+
# --seed 1234
|
72
|
+
config.order = :random
|
73
|
+
|
74
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
75
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
76
|
+
# test failures related to randomization by passing the same `--seed` value
|
77
|
+
# as the one that triggered the failure.
|
78
|
+
Kernel.srand config.seed
|
79
|
+
=end
|
80
|
+
end
|
@@ -0,0 +1,179 @@
|
|
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 personal sub merchant' do
|
14
|
+
request = {
|
15
|
+
locale: Iyzipay::Model::Locale::TR,
|
16
|
+
conversationId: '123456789',
|
17
|
+
subMerchantExternalId: 'B49224',
|
18
|
+
subMerchantType: Iyzipay::Model::SubMerchantType::PERSONAL,
|
19
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
20
|
+
contactName: 'John',
|
21
|
+
contactSurname: 'Doe',
|
22
|
+
email: 'email@submerchantemail.com',
|
23
|
+
gsmNumber: '+905350000000',
|
24
|
+
name: 'John\'s market',
|
25
|
+
iban: 'TR180006200119000006672315',
|
26
|
+
identityNumber: '1234567890',
|
27
|
+
currency: Iyzipay::Model::Currency::TRY
|
28
|
+
}
|
29
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
|
30
|
+
begin
|
31
|
+
$stderr.puts sub_merchant.inspect
|
32
|
+
rescue
|
33
|
+
$stderr.puts 'oops'
|
34
|
+
raise
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should create private sub merchant' do
|
39
|
+
request = {
|
40
|
+
locale: Iyzipay::Model::Locale::TR,
|
41
|
+
conversationId: '123456789',
|
42
|
+
subMerchantExternalId: 'S49222',
|
43
|
+
subMerchantType: Iyzipay::Model::SubMerchantType::PRIVATE_COMPANY,
|
44
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
45
|
+
taxOffice: 'Tax office',
|
46
|
+
legalCompanyTitle: 'John Doe inc',
|
47
|
+
email: 'email@submerchantemail.com',
|
48
|
+
gsmNumber: '+905350000000',
|
49
|
+
name: 'John\'s market',
|
50
|
+
iban: 'TR180006200119000006672315',
|
51
|
+
identityNumber: '31300864726',
|
52
|
+
currency: Iyzipay::Model::Currency::TRY
|
53
|
+
}
|
54
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
|
55
|
+
begin
|
56
|
+
$stderr.puts sub_merchant.inspect
|
57
|
+
rescue
|
58
|
+
$stderr.puts 'oops'
|
59
|
+
raise
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should create limited company sub merchant' do
|
64
|
+
request = {
|
65
|
+
locale: Iyzipay::Model::Locale::TR,
|
66
|
+
conversationId: '123456789',
|
67
|
+
subMerchantExternalId: 'AS49224',
|
68
|
+
subMerchantType: Iyzipay::Model::SubMerchantType::LIMITED_OR_JOINT_STOCK_COMPANY,
|
69
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
70
|
+
taxOffice: 'Tax office',
|
71
|
+
taxNumber: '9261877',
|
72
|
+
legalCompanyTitle: 'XYZ inc',
|
73
|
+
email: 'email@submerchantemail.com',
|
74
|
+
gsmNumber: '+905350000000',
|
75
|
+
name: 'John\'s market',
|
76
|
+
iban: 'TR180006200119000006672315',
|
77
|
+
currency: Iyzipay::Model::Currency::TRY
|
78
|
+
}
|
79
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.create(request, @options)
|
80
|
+
begin
|
81
|
+
$stderr.puts sub_merchant.inspect
|
82
|
+
rescue
|
83
|
+
$stderr.puts 'oops'
|
84
|
+
raise
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should update personal sub merchant' do
|
89
|
+
request = {
|
90
|
+
locale: Iyzipay::Model::Locale::TR,
|
91
|
+
conversationId: '123456789',
|
92
|
+
subMerchantExternalId: 'B49224',
|
93
|
+
subMerchantKey: 'sub merchant key',
|
94
|
+
iban: 'TR180006200119000006672315',
|
95
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
96
|
+
contactName: 'Jane',
|
97
|
+
contactSurname: 'Doe',
|
98
|
+
email: 'email@submerchantemail.com',
|
99
|
+
gsmNumber: '+905350000000',
|
100
|
+
name: 'Jane\'s market',
|
101
|
+
identityNumber: '31300864726',
|
102
|
+
currency: Iyzipay::Model::Currency::TRY
|
103
|
+
}
|
104
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
|
105
|
+
begin
|
106
|
+
$stderr.puts sub_merchant.inspect
|
107
|
+
rescue
|
108
|
+
$stderr.puts 'oops'
|
109
|
+
raise
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should update private sub merchant' do
|
114
|
+
request = {
|
115
|
+
locale: Iyzipay::Model::Locale::TR,
|
116
|
+
conversationId: '123456789',
|
117
|
+
subMerchantExternalId: 'S49222',
|
118
|
+
subMerchantKey: 'sub merchant key',
|
119
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
120
|
+
taxOffice: 'Tax office',
|
121
|
+
legalCompanyTitle: 'Jane Doe inc',
|
122
|
+
email: 'email@submerchantemail.com',
|
123
|
+
gsmNumber: '+905350000000',
|
124
|
+
name: 'Jane\'s market',
|
125
|
+
iban: 'TR180006200119000006672315',
|
126
|
+
identityNumber: '31300864726',
|
127
|
+
currency: Iyzipay::Model::Currency::TRY
|
128
|
+
}
|
129
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
|
130
|
+
begin
|
131
|
+
$stderr.puts sub_merchant.inspect
|
132
|
+
rescue
|
133
|
+
$stderr.puts 'oops'
|
134
|
+
raise
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'should update limited company sub merchant' do
|
139
|
+
request = {
|
140
|
+
locale: Iyzipay::Model::Locale::TR,
|
141
|
+
conversationId: '123456789',
|
142
|
+
subMerchantKey: 'sub merchant key',
|
143
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
144
|
+
taxOffice: 'Tax office',
|
145
|
+
taxNumber: '9261877',
|
146
|
+
legalCompanyTitle: 'ABC inc',
|
147
|
+
email: 'email@submerchantemail.com',
|
148
|
+
gsmNumber: '+905350000000',
|
149
|
+
name: 'Jane\'s market',
|
150
|
+
iban: 'TR180006200119000006672315',
|
151
|
+
currency: Iyzipay::Model::Currency::TRY
|
152
|
+
}
|
153
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.update(request, @options)
|
154
|
+
begin
|
155
|
+
$stderr.puts sub_merchant.inspect
|
156
|
+
rescue
|
157
|
+
$stderr.puts 'oops'
|
158
|
+
raise
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'should retrieve sub merchant' do
|
163
|
+
request = {
|
164
|
+
locale: Iyzipay::Model::Locale::TR,
|
165
|
+
conversationId: '123456789',
|
166
|
+
subMerchantExternalId: 'AS49224'
|
167
|
+
}
|
168
|
+
sub_merchant = Iyzipay::Model::SubMerchant.new.retrieve(request, @options)
|
169
|
+
begin
|
170
|
+
$stderr.puts sub_merchant.inspect
|
171
|
+
rescue
|
172
|
+
$stderr.puts 'oops'
|
173
|
+
raise
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
after :each do
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,226 @@
|
|
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: Iyzipay::Model::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 = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
|
87
|
+
begin
|
88
|
+
$stderr.puts threeds_initialize.inspect
|
89
|
+
threeds_initialize_dict = JSON.parse(threeds_initialize)
|
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: Iyzipay::Model::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 = Iyzipay::Model::ThreedsInitialize.new.create(request, @options)
|
179
|
+
begin
|
180
|
+
$stderr.puts threeds_initialize.inspect
|
181
|
+
|
182
|
+
threeds_initialize_dict = JSON.parse(threeds_initialize)
|
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: Iyzipay::Model::Locale::TR,
|
195
|
+
conversationId: '123456789',
|
196
|
+
paymentId: '1',
|
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: Iyzipay::Model::Locale::TR,
|
211
|
+
conversationId: '123456789',
|
212
|
+
paymentId: '9',
|
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
|