iyzipay 1.0.36 → 1.0.39
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 +4 -4
- data/.travis.yml +1 -0
- data/Gemfile +1 -0
- data/VERSION +1 -1
- data/gemfiles/Gemfile.nokogiri-1.6.8.1 +7 -0
- data/iyzipay.gemspec +3 -3
- data/lib/{Iyzipay.rb → iyzipay.rb} +0 -0
- data/lib/iyzipay/iyzipay_resource.rb +1 -1
- data/lib/iyzipay/model/bkm_initialize.rb +1 -0
- data/spec/api_test_spec.rb +7 -4
- data/spec/approval_spec.rb +26 -15
- data/spec/bin_number_spec.rb +16 -4
- data/spec/bkm_spec.rb +6 -21
- data/spec/builder.rb +9 -0
- data/spec/builder/approval_builder.rb +18 -0
- data/spec/builder/card_builder.rb +27 -0
- data/spec/builder/checkout_form_builder.rb +75 -0
- data/spec/builder/payment_builder.rb +167 -0
- data/spec/builder/pecco_initialize_builder.rb +74 -0
- data/spec/builder/sub_merchant_builder.rb +91 -0
- data/spec/cancel_spec.rb +17 -5
- data/spec/card_storage_spec.rb +71 -12
- data/spec/checkout_form_spec.rb +18 -8
- data/spec/disapproval_spec.rb +22 -5
- data/spec/installment_spec.rb +19 -4
- data/spec/payment_spec.rb +62 -18
- data/spec/pecco_spec.rb +20 -9
- data/spec/refund_spec.rb +18 -6
- data/spec/retrieve_transactions_spec.rb +17 -7
- data/spec/spec_helper.rb +2 -1
- data/spec/spec_options.rb +5 -0
- data/spec/sub_merchant_spec.rb +68 -20
- data/spec/threeds_payment_spec.rb +22 -19
- metadata +12 -16
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7da83efe7b119315d9780b9f7a80fe8facffb31
|
4
|
+
data.tar.gz: e5e38f3bef8e9dcd40a45fed6e51a535bd07a974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06381d9aa36de50d330365f3d922cea4a88ce9cf139e72e002a6d687135306b14280fa3dbb5d1b25b1e3766cc71f8654b869ace9fd9c6138c45225cf1d14d15a
|
7
|
+
data.tar.gz: 127ac5d58081bda38c5a4458fcd121ccabb5815a494b9c40c0aca5b91179f673538d38b082a689d76a05144711cb701c3da9f432ea1dfb79ca46475afe0da600
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.39
|
data/iyzipay.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'iyzipay'
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.39'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.required_ruby_version = '>= 1.9.3'
|
9
9
|
s.summary = %q{iyzipay api ruby client}
|
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.license = 'MIT'
|
17
17
|
|
18
18
|
s.add_runtime_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
|
19
|
-
s.add_development_dependency 'rspec', '~> 3.3
|
20
|
-
s.add_development_dependency 'rspec-rails', '~> 3.3
|
19
|
+
s.add_development_dependency 'rspec', '~> 3.3.0'
|
20
|
+
s.add_development_dependency 'rspec-rails', '~> 3.3.0'
|
21
21
|
|
22
22
|
s.require_paths = ['lib']
|
23
23
|
end
|
File without changes
|
@@ -15,7 +15,7 @@ module Iyzipay
|
|
15
15
|
random_header_value = random_string(RANDOM_STRING_SIZE)
|
16
16
|
header[:'Authorization'] = "#{prepare_authorization_string(pki_string, random_header_value, options)}"
|
17
17
|
header[:'x-iyzi-rnd'] = "#{random_header_value}"
|
18
|
-
header[:'x-iyzi-client-version'] = 'iyzipay-ruby-1.0.
|
18
|
+
header[:'x-iyzi-client-version'] = 'iyzipay-ruby-1.0.39'
|
19
19
|
end
|
20
20
|
|
21
21
|
header
|
@@ -17,6 +17,7 @@ module Iyzipay
|
|
17
17
|
append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
|
18
18
|
append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
|
19
19
|
append(:callbackUrl, request[:callbackUrl]).
|
20
|
+
append(:paymentSource, request[:paymentSource]).
|
20
21
|
append_array(:enabledInstallments, request[:enabledInstallments]).
|
21
22
|
get_request_string
|
22
23
|
end
|
data/spec/api_test_spec.rb
CHANGED
@@ -5,15 +5,18 @@ 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 =
|
9
|
-
@options.secret_key =
|
10
|
-
@options.base_url =
|
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 test api' do
|
14
14
|
api_test = Iyzipay::Model::ApiTest.new.retrieve(@options)
|
15
15
|
begin
|
16
|
-
|
16
|
+
api_test = JSON.parse(api_test)
|
17
|
+
expect(api_test['status']).to eq('success')
|
18
|
+
expect(api_test['locale']).to eq('tr')
|
19
|
+
expect(api_test['systemTime']).not_to be_nil
|
17
20
|
rescue
|
18
21
|
$stderr.puts 'oops'
|
19
22
|
raise
|
data/spec/approval_spec.rb
CHANGED
@@ -1,27 +1,38 @@
|
|
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 =
|
9
|
-
@options.secret_key =
|
10
|
-
@options.base_url =
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
context 'when create a payment for market place and then approve payment' do
|
15
|
+
it 'should approve payment item' do
|
16
|
+
sub_merchant = Builder::SubMerchantBuilder.new.create_personal_sub_merchant(@options)
|
17
|
+
payment = Builder::PaymentBuilder.new.create_marketplace_payment(@options, sub_merchant['subMerchantKey'])
|
18
|
+
|
19
|
+
request = {
|
20
|
+
locale: Iyzipay::Model::Locale::TR,
|
21
|
+
conversationId: '123456789',
|
22
|
+
paymentTransactionId: payment['itemTransactions'][0]['paymentTransactionId']
|
23
|
+
}
|
24
|
+
approval = Iyzipay::Model::Approval.new.create(request, @options)
|
25
|
+
|
26
|
+
begin
|
27
|
+
approval = JSON.parse(approval)
|
28
|
+
expect(approval['status']).to eq('success')
|
29
|
+
expect(approval['locale']).to eq('tr')
|
30
|
+
expect(approval['systemTime']).not_to be_nil
|
31
|
+
expect(approval['paymentTransactionId']).to eq(payment['itemTransactions'][0]['paymentTransactionId'])
|
32
|
+
rescue
|
33
|
+
$stderr.puts 'oops'
|
34
|
+
raise
|
35
|
+
end
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
data/spec/bin_number_spec.rb
CHANGED
@@ -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 =
|
9
|
-
@options.secret_key =
|
10
|
-
@options.base_url =
|
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 bin number' do
|
@@ -18,7 +18,19 @@ RSpec.describe 'Iyzipay' do
|
|
18
18
|
}
|
19
19
|
bin_number = Iyzipay::Model::BinNumber.new.retrieve(request, @options)
|
20
20
|
begin
|
21
|
-
|
21
|
+
#$stderr.puts bin_number.inspect
|
22
|
+
bin_number = JSON.parse(bin_number)
|
23
|
+
expect(bin_number['status']).to eq('success')
|
24
|
+
expect(bin_number['locale']).to eq('tr')
|
25
|
+
expect(bin_number['systemTime']).not_to be_nil
|
26
|
+
expect(bin_number['conversationId']).to eq('123456789')
|
27
|
+
expect(bin_number['binNumber']).to eq('554960')
|
28
|
+
expect(bin_number['cardType']).to eq('CREDIT_CARD')
|
29
|
+
expect(bin_number['cardAssociation']).to eq('MASTER_CARD')
|
30
|
+
expect(bin_number['cardFamily']).to eq('Bonus')
|
31
|
+
expect(bin_number['bankName']).to eq('Garanti Bankası')
|
32
|
+
expect(bin_number['bankCode']).to eq(62)
|
33
|
+
expect(bin_number['commercial']).to eq(0)
|
22
34
|
rescue
|
23
35
|
$stderr.puts 'oops'
|
24
36
|
raise
|
data/spec/bkm_spec.rb
CHANGED
@@ -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 =
|
9
|
-
@options.secret_key =
|
10
|
-
@options.base_url =
|
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 initialize bkm' do
|
@@ -63,7 +63,7 @@ RSpec.describe 'Iyzipay' do
|
|
63
63
|
conversationId: '123456789',
|
64
64
|
price: '1',
|
65
65
|
basketId: 'B67832',
|
66
|
-
paymentGroup: Iyzipay::Model::PaymentGroup::
|
66
|
+
paymentGroup: Iyzipay::Model::PaymentGroup::LISTING,
|
67
67
|
callbackUrl: 'https://www.merchant.com/callback',
|
68
68
|
enabledInstallments: [2, 3, 6, 9],
|
69
69
|
buyer: buyer,
|
@@ -74,11 +74,10 @@ RSpec.describe 'Iyzipay' do
|
|
74
74
|
bkm_initialize = Iyzipay::Model::BkmInitialize.new.create(request, @options)
|
75
75
|
|
76
76
|
begin
|
77
|
-
$stderr.puts bkm_initialize.inspect
|
78
|
-
|
79
77
|
bkm_initialize_dict = JSON.parse(bkm_initialize)
|
78
|
+
|
80
79
|
unless bkm_initialize_dict['htmlContent'].nil?
|
81
|
-
|
80
|
+
expect(Base64.decode64(bkm_initialize_dict['htmlContent'])).not_to be_nil
|
82
81
|
end
|
83
82
|
rescue
|
84
83
|
$stderr.puts 'oops'
|
@@ -86,20 +85,6 @@ RSpec.describe 'Iyzipay' do
|
|
86
85
|
end
|
87
86
|
end
|
88
87
|
|
89
|
-
it 'should retrieve bkm result' do
|
90
|
-
request = {
|
91
|
-
locale: Iyzipay::Model::Locale::TR,
|
92
|
-
conversationId: '123456789',
|
93
|
-
token: 'token'
|
94
|
-
}
|
95
|
-
bkm = Iyzipay::Model::Bkm.new.retrieve(request, @options)
|
96
|
-
begin
|
97
|
-
$stderr.puts bkm.inspect
|
98
|
-
rescue
|
99
|
-
$stderr.puts 'oops'
|
100
|
-
raise
|
101
|
-
end
|
102
|
-
end
|
103
88
|
|
104
89
|
after :each do
|
105
90
|
end
|
data/spec/builder.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
module Builder
|
2
|
+
end
|
3
|
+
|
4
|
+
require_relative 'builder/payment_builder'
|
5
|
+
require_relative 'builder/sub_merchant_builder'
|
6
|
+
require_relative 'builder/checkout_form_builder'
|
7
|
+
require_relative 'builder/approval_builder'
|
8
|
+
require_relative 'builder/card_builder'
|
9
|
+
require_relative 'builder/pecco_initialize_builder'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Builder
|
6
|
+
class ApprovalBuilder
|
7
|
+
|
8
|
+
def create_approval(options, payment_transaction_id)
|
9
|
+
request = {
|
10
|
+
locale: Iyzipay::Model::Locale::TR,
|
11
|
+
conversationId: '123456789',
|
12
|
+
paymentTransactionId: payment_transaction_id
|
13
|
+
}
|
14
|
+
approval = Iyzipay::Model::Approval.new.create(request, options)
|
15
|
+
JSON.parse(approval)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Builder
|
6
|
+
class CardBuilder
|
7
|
+
|
8
|
+
def create_card(options)
|
9
|
+
card_information = {
|
10
|
+
cardAlias: 'card alias',
|
11
|
+
cardHolderName: 'John Doe',
|
12
|
+
cardNumber: '5528790000000008',
|
13
|
+
expireYear: '2030',
|
14
|
+
expireMonth: '12'
|
15
|
+
}
|
16
|
+
request = {
|
17
|
+
locale: Iyzipay::Model::Locale::TR,
|
18
|
+
conversationId: '123456789',
|
19
|
+
email: 'email@email.com',
|
20
|
+
externalId: 'external id',
|
21
|
+
card: card_information
|
22
|
+
}
|
23
|
+
card = Iyzipay::Model::Card.new.create(request, options)
|
24
|
+
JSON.parse(card)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Builder
|
6
|
+
class CheckoutFormBuilder
|
7
|
+
|
8
|
+
def create_checkout_form_initialize(options)
|
9
|
+
buyer = {
|
10
|
+
id: 'BY789',
|
11
|
+
name: 'John',
|
12
|
+
surname: 'Doe',
|
13
|
+
gsmNumber: '+905350000000',
|
14
|
+
email: 'email@email.com',
|
15
|
+
identityNumber: '74300864791',
|
16
|
+
lastLoginDate: '2015-10-05 12:43:35',
|
17
|
+
registrationDate: '2013-04-21 15:12:09',
|
18
|
+
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
19
|
+
ip: '85.34.78.112',
|
20
|
+
city: 'Istanbul',
|
21
|
+
country: 'Turkey',
|
22
|
+
zipCode: '34732'
|
23
|
+
}
|
24
|
+
address = {
|
25
|
+
contactName: 'Jane Doe',
|
26
|
+
city: 'Istanbul',
|
27
|
+
country: 'Turkey',
|
28
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
29
|
+
zipCode: '34732'
|
30
|
+
}
|
31
|
+
|
32
|
+
item1 = {
|
33
|
+
id: 'BI101',
|
34
|
+
name: 'Binocular',
|
35
|
+
category1: 'Collectibles',
|
36
|
+
category2: 'Accessories',
|
37
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
38
|
+
price: '0.3'
|
39
|
+
}
|
40
|
+
item2 = {
|
41
|
+
id: 'BI102',
|
42
|
+
name: 'Game code',
|
43
|
+
category1: 'Game',
|
44
|
+
category2: 'Online Game Items',
|
45
|
+
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
46
|
+
price: '0.5'
|
47
|
+
}
|
48
|
+
item3 = {
|
49
|
+
id: 'BI103',
|
50
|
+
name: 'Usb',
|
51
|
+
category1: 'Electronics',
|
52
|
+
category2: 'Usb / Cable',
|
53
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
54
|
+
price: '0.2'
|
55
|
+
}
|
56
|
+
request = {
|
57
|
+
locale: Iyzipay::Model::Locale::TR,
|
58
|
+
conversationId: '123456789',
|
59
|
+
price: '1',
|
60
|
+
paidPrice: '1.2',
|
61
|
+
currency: Iyzipay::Model::Currency::TRY,
|
62
|
+
basketId: 'B67832',
|
63
|
+
paymentGroup: Iyzipay::Model::PaymentGroup::LISTING,
|
64
|
+
callbackUrl: 'https://www.merchant.com/callback',
|
65
|
+
enabledInstallments: [2, 3, 6, 9],
|
66
|
+
buyer: buyer,
|
67
|
+
billingAddress: address,
|
68
|
+
shippingAddress: address,
|
69
|
+
basketItems: [item1, item2, item3]
|
70
|
+
}
|
71
|
+
checkout_form_initialize = Iyzipay::Model::CheckoutFormInitialize.new.create(request, options)
|
72
|
+
JSON.parse(checkout_form_initialize)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
|
5
|
+
module Builder
|
6
|
+
class PaymentBuilder
|
7
|
+
|
8
|
+
def create_marketplace_payment(options, sub_merchant_key)
|
9
|
+
payment_card = {
|
10
|
+
cardHolderName: 'John Doe',
|
11
|
+
cardNumber: '5528790000000008',
|
12
|
+
expireYear: '2030',
|
13
|
+
expireMonth: '12',
|
14
|
+
cvc: '123',
|
15
|
+
registerCard: 0
|
16
|
+
}
|
17
|
+
buyer = {
|
18
|
+
id: 'BY789',
|
19
|
+
name: 'John',
|
20
|
+
surname: 'Doe',
|
21
|
+
gsmNumber: '+905350000000',
|
22
|
+
email: 'email@email.com',
|
23
|
+
identityNumber: '74300864791',
|
24
|
+
lastLoginDate: '2015-10-05 12:43:35',
|
25
|
+
registrationDate: '2013-04-21 15:12:09',
|
26
|
+
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
27
|
+
ip: '85.34.78.112',
|
28
|
+
city: 'Istanbul',
|
29
|
+
country: 'Turkey',
|
30
|
+
zipCode: '34732'
|
31
|
+
}
|
32
|
+
address = {
|
33
|
+
contactName: 'Jane Doe',
|
34
|
+
city: 'Istanbul',
|
35
|
+
country: 'Turkey',
|
36
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
37
|
+
zipCode: '34732'
|
38
|
+
}
|
39
|
+
|
40
|
+
item1 = {
|
41
|
+
id: 'BI101',
|
42
|
+
name: 'Binocular',
|
43
|
+
category1: 'Collectibles',
|
44
|
+
category2: 'Accessories',
|
45
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
46
|
+
subMerchantKey: sub_merchant_key,
|
47
|
+
subMerchantPrice: '0.27',
|
48
|
+
price: '0.3'
|
49
|
+
}
|
50
|
+
item2 = {
|
51
|
+
id: 'BI102',
|
52
|
+
name: 'Game code',
|
53
|
+
category1: 'Game',
|
54
|
+
category2: 'Online Game Items',
|
55
|
+
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
56
|
+
subMerchantKey: sub_merchant_key,
|
57
|
+
subMerchantPrice: '0.42',
|
58
|
+
price: '0.5'
|
59
|
+
}
|
60
|
+
item3 = {
|
61
|
+
id: 'BI103',
|
62
|
+
name: 'Usb',
|
63
|
+
category1: 'Electronics',
|
64
|
+
category2: 'Usb / Cable',
|
65
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
66
|
+
subMerchantKey: sub_merchant_key,
|
67
|
+
subMerchantPrice: '0.18',
|
68
|
+
price: '0.2'
|
69
|
+
}
|
70
|
+
request = {
|
71
|
+
locale: Iyzipay::Model::Locale::TR,
|
72
|
+
conversationId: '123456789',
|
73
|
+
price: '1',
|
74
|
+
paidPrice: '1.1',
|
75
|
+
currency: Iyzipay::Model::Currency::TRY,
|
76
|
+
installment: 1,
|
77
|
+
basketId: 'B67832',
|
78
|
+
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
79
|
+
paymentGroup: Iyzipay::Model::PaymentGroup::PRODUCT,
|
80
|
+
paymentCard: payment_card,
|
81
|
+
buyer: buyer,
|
82
|
+
billingAddress: address,
|
83
|
+
shippingAddress: address,
|
84
|
+
basketItems: [item1, item2, item3]
|
85
|
+
}
|
86
|
+
payment = Iyzipay::Model::Payment.new.create(request, options)
|
87
|
+
JSON.parse(payment)
|
88
|
+
end
|
89
|
+
|
90
|
+
def create_standard_listing_payment(options)
|
91
|
+
payment_card = {
|
92
|
+
cardHolderName: 'John Doe',
|
93
|
+
cardNumber: '5528790000000008',
|
94
|
+
expireYear: '2030',
|
95
|
+
expireMonth: '12',
|
96
|
+
cvc: '123',
|
97
|
+
registerCard: 0
|
98
|
+
}
|
99
|
+
buyer = {
|
100
|
+
id: 'BY789',
|
101
|
+
name: 'John',
|
102
|
+
surname: 'Doe',
|
103
|
+
gsmNumber: '+905350000000',
|
104
|
+
email: 'email@email.com',
|
105
|
+
identityNumber: '74300864791',
|
106
|
+
lastLoginDate: '2015-10-05 12:43:35',
|
107
|
+
registrationDate: '2013-04-21 15:12:09',
|
108
|
+
registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
109
|
+
ip: '85.34.78.112',
|
110
|
+
city: 'Istanbul',
|
111
|
+
country: 'Turkey',
|
112
|
+
zipCode: '34732'
|
113
|
+
}
|
114
|
+
address = {
|
115
|
+
contactName: 'Jane Doe',
|
116
|
+
city: 'Istanbul',
|
117
|
+
country: 'Turkey',
|
118
|
+
address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
|
119
|
+
zipCode: '34732'
|
120
|
+
}
|
121
|
+
|
122
|
+
item1 = {
|
123
|
+
id: 'BI101',
|
124
|
+
name: 'Binocular',
|
125
|
+
category1: 'Collectibles',
|
126
|
+
category2: 'Accessories',
|
127
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
128
|
+
price: '0.3'
|
129
|
+
}
|
130
|
+
item2 = {
|
131
|
+
id: 'BI102',
|
132
|
+
name: 'Game code',
|
133
|
+
category1: 'Game',
|
134
|
+
category2: 'Online Game Items',
|
135
|
+
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
136
|
+
price: '0.5'
|
137
|
+
}
|
138
|
+
item3 = {
|
139
|
+
id: 'BI103',
|
140
|
+
name: 'Usb',
|
141
|
+
category1: 'Electronics',
|
142
|
+
category2: 'Usb / Cable',
|
143
|
+
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
144
|
+
price: '0.2'
|
145
|
+
}
|
146
|
+
request = {
|
147
|
+
locale: Iyzipay::Model::Locale::TR,
|
148
|
+
conversationId: '123456789',
|
149
|
+
price: '1',
|
150
|
+
paidPrice: '1.1',
|
151
|
+
currency: Iyzipay::Model::Currency::TRY,
|
152
|
+
installment: 1,
|
153
|
+
basketId: 'B67832',
|
154
|
+
paymentChannel: Iyzipay::Model::PaymentChannel::WEB,
|
155
|
+
paymentGroup: Iyzipay::Model::PaymentGroup::LISTING,
|
156
|
+
paymentCard: payment_card,
|
157
|
+
buyer: buyer,
|
158
|
+
billingAddress: address,
|
159
|
+
shippingAddress: address,
|
160
|
+
basketItems: [item1, item2, item3]
|
161
|
+
}
|
162
|
+
payment = Iyzipay::Model::Payment.new.create(request, options)
|
163
|
+
JSON.parse(payment)
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|