iyzipay 1.0.34 → 1.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +64 -7
- data/VERSION +1 -1
- data/iyzipay.gemspec +1 -2
- data/lib/Iyzipay.rb +1 -2
- data/lib/iyzipay/http_client.rb +1 -1
- data/lib/iyzipay/iyzipay_resource.rb +1 -0
- data/lib/iyzipay/model.rb +8 -1
- data/lib/iyzipay/model/api_test.rb +10 -0
- data/lib/iyzipay/model/bkm_initialize.rb +1 -0
- data/lib/iyzipay/model/card.rb +36 -0
- data/lib/iyzipay/model/card_information.rb +17 -0
- data/lib/iyzipay/model/card_list.rb +17 -0
- data/lib/iyzipay/model/currency.rb +1 -0
- data/lib/iyzipay/model/locale.rb +8 -0
- data/lib/iyzipay/model/pecco_initialize.rb +27 -0
- data/lib/iyzipay/model/pecco_payment.rb +17 -0
- data/spec/{basic_payment_post_auth_spec.rb → api_test_spec.rb} +3 -11
- data/spec/approval_spec.rb +2 -17
- data/spec/bin_number_spec.rb +2 -2
- data/spec/bkm_spec.rb +19 -24
- data/spec/cancel_spec.rb +2 -2
- data/spec/card_storage_spec.rb +94 -0
- data/spec/checkout_form_spec.rb +20 -26
- data/spec/{payment_post_auth_spec.rb → disapproval_spec.rb} +5 -8
- data/spec/installment_spec.rb +5 -5
- data/spec/payment_spec.rb +54 -58
- data/spec/{checkout_form_pre_auth_spec.rb → pecco_spec.rb} +30 -18
- data/spec/refund_spec.rb +5 -23
- data/spec/retrieve_transactions_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/sub_merchant_spec.rb +7 -8
- data/spec/threeds_payment_spec.rb +9 -9
- metadata +33 -34
- data/lib/iyzipay/version.rb +0 -3
- data/spec/basic_bkm_spec.rb +0 -261
- data/spec/basic_payment_pre_auth_spec.rb +0 -73
- data/spec/basic_payment_spec.rb +0 -73
- data/spec/basic_threeds_pre_auth_spec.rb +0 -103
- data/spec/basic_threeds_spec.rb +0 -103
- data/spec/cross_booking_spec.rb +0 -51
- data/spec/payment_pre_auth_spec.rb +0 -280
- data/spec/threeds_pre_auth_spec.rb +0 -226
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmI1NTg0MGQ3OWY2OWI1Nzc1ZGU3NjNjZmI4NmMzODE3ZWJkMTVjNw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 69f646d88d5856aa760d5583c2485a1c856228fb
|
4
|
+
data.tar.gz: c347d212be224b3eba9e4312f7e49a75d7dd0995
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MWYxODJkMDBiMmE3MjgyYWU4MTA5YzcyOTIyNjdkMjcyNTc5MjZjZTg1YWM4
|
11
|
-
NmFkZDUxNzEwYWUyN2I4MzMyNmQ2YjE3YTQ5ODI4MmUxN2ViODc=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzExZTk1MmEzNWJlOGJiYzA5ZWVhNDIzZjFlYzZjM2YxNjY5OGFkOTk3YTU4
|
14
|
-
NmY4MTk1ODk1YjBmZWQxM2YyNGJlZWEzYzE5MGFjODQ0ZDRjYWZjOTVhMDU4
|
15
|
-
OTM1MzE1OWFlODllNGFmMmU1Y2QxODU2NzVlNDZkZjcwMGRhNzQ=
|
6
|
+
metadata.gz: 8f12e3df7375c39ff59c473ee3b627562b1278f2d248ce9e427b46266d4fc22c5fa30b41d0ef2be0df875dd11dfc9edba0c9bc9c3ccfa2aaf4cfa47ece2c7a5a
|
7
|
+
data.tar.gz: 31aa5f35cf533e639cf3eae7fe8c15ea5f1770a9fba02e4ee23414d91e4fe9e8956a39dd3ef2c0f695d31e0a529707301372c5c3a8db968937a2b3586f616cbe
|
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -18,7 +18,6 @@ You can sign up for an iyzico account at https://iyzico.com
|
|
18
18
|
``` ruby
|
19
19
|
source 'https://rubygems.org'
|
20
20
|
|
21
|
-
gem 'rails'
|
22
21
|
gem 'iyzipay'
|
23
22
|
|
24
23
|
```
|
@@ -34,7 +33,7 @@ before :all do
|
|
34
33
|
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
35
34
|
end
|
36
35
|
|
37
|
-
it 'should create payment
|
36
|
+
it 'should create payment' do
|
38
37
|
payment_card = {
|
39
38
|
cardHolderName: 'John Doe',
|
40
39
|
cardNumber: '5528790000000008',
|
@@ -72,7 +71,7 @@ it 'should create payment with physical and virtual item for listing or subscrip
|
|
72
71
|
category1: 'Collectibles',
|
73
72
|
category2: 'Accessories',
|
74
73
|
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
75
|
-
price: '0.3'
|
74
|
+
price: '0.3'
|
76
75
|
}
|
77
76
|
item2 = {
|
78
77
|
id: 'BI102',
|
@@ -80,7 +79,7 @@ it 'should create payment with physical and virtual item for listing or subscrip
|
|
80
79
|
category1: 'Game',
|
81
80
|
category2: 'Online Game Items',
|
82
81
|
itemType: Iyzipay::Model::BasketItemType::VIRTUAL,
|
83
|
-
price: '0.5'
|
82
|
+
price: '0.5'
|
84
83
|
}
|
85
84
|
item3 = {
|
86
85
|
id: 'BI103',
|
@@ -88,10 +87,10 @@ it 'should create payment with physical and virtual item for listing or subscrip
|
|
88
87
|
category1: 'Electronics',
|
89
88
|
category2: 'Usb / Cable',
|
90
89
|
itemType: Iyzipay::Model::BasketItemType::PHYSICAL,
|
91
|
-
price: '0.2'
|
90
|
+
price: '0.2'
|
92
91
|
}
|
93
92
|
request = {
|
94
|
-
locale:
|
93
|
+
locale: Iyzipay::Model::Locale::TR,
|
95
94
|
conversationId: '123456789',
|
96
95
|
price: '1.0',
|
97
96
|
paidPrice: '1.1',
|
@@ -120,4 +119,62 @@ See other samples under iyzipay-ruby/spec module.
|
|
120
119
|
Testing
|
121
120
|
=======
|
122
121
|
|
123
|
-
You can run specs with RSpec under spec module.
|
122
|
+
You can run specs with RSpec under spec module.
|
123
|
+
|
124
|
+
### Mock test cards
|
125
|
+
|
126
|
+
Test cards that can be used to simulate a *successful* payment:
|
127
|
+
|
128
|
+
Card Number | Bank | Card Type
|
129
|
+
----------- | ---- | ---------
|
130
|
+
5890040000000016 | Akbank | Master Card (Debit)
|
131
|
+
5526080000000006 | Akbank | Master Card (Credit)
|
132
|
+
4766620000000001 | Denizbank | Visa (Debit)
|
133
|
+
4603450000000000 | Denizbank | Visa (Credit)
|
134
|
+
4729150000000005 | Denizbank Bonus | Visa (Credit)
|
135
|
+
4987490000000002 | Finansbank | Visa (Debit)
|
136
|
+
5311570000000005 | Finansbank | Master Card (Credit)
|
137
|
+
9792020000000001 | Finansbank | Troy (Debit)
|
138
|
+
9792030000000000 | Finansbank | Troy (Credit)
|
139
|
+
5170410000000004 | Garanti Bankası | Master Card (Debit)
|
140
|
+
5400360000000003 | Garanti Bankası | Master Card (Credit)
|
141
|
+
374427000000003 | Garanti Bankası | American Express
|
142
|
+
4475050000000003 | Halkbank | Visa (Debit)
|
143
|
+
5528790000000008 | Halkbank | Master Card (Credit)
|
144
|
+
4059030000000009 | HSBC Bank | Visa (Debit)
|
145
|
+
5504720000000003 | HSBC Bank | Master Card (Credit)
|
146
|
+
5892830000000000 | Türkiye İş Bankası | Master Card (Debit)
|
147
|
+
4543590000000006 | Türkiye İş Bankası | Visa (Credit)
|
148
|
+
4910050000000006 | Vakıfbank | Visa (Debit)
|
149
|
+
4157920000000002 | Vakıfbank | Visa (Credit)
|
150
|
+
5168880000000002 | Yapı ve Kredi Bankası | Master Card (Debit)
|
151
|
+
5451030000000000 | Yapı ve Kredi Bankası | Master Card (Credit)
|
152
|
+
|
153
|
+
*Cross border* test cards:
|
154
|
+
|
155
|
+
Card Number | Country
|
156
|
+
----------- | -------
|
157
|
+
4054180000000007 | Non-Turkish (Debit)
|
158
|
+
5400010000000004 | Non-Turkish (Credit)
|
159
|
+
6221060000000004 | Iran
|
160
|
+
|
161
|
+
Test cards to get specific *error* codes:
|
162
|
+
|
163
|
+
Card Number | Description
|
164
|
+
----------- | -----------
|
165
|
+
5406670000000009 | Success but cannot be cancelled, refund or post auth
|
166
|
+
4111111111111129 | Not sufficient funds
|
167
|
+
4129111111111111 | Do not honour
|
168
|
+
4128111111111112 | Invalid transaction
|
169
|
+
4127111111111113 | Lost card
|
170
|
+
4126111111111114 | Stolen card
|
171
|
+
4125111111111115 | Expired card
|
172
|
+
4124111111111116 | Invalid cvc2
|
173
|
+
4123111111111117 | Not permitted to card holder
|
174
|
+
4122111111111118 | Not permitted to terminal
|
175
|
+
4121111111111119 | Fraud suspect
|
176
|
+
4120111111111110 | Pickup card
|
177
|
+
4130111111111118 | General error
|
178
|
+
4131111111111117 | Success but mdStatus is 0
|
179
|
+
4141111111111115 | Success but mdStatus is 4
|
180
|
+
4151111111111112 | 3dsecure initialize failed
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.35
|
data/iyzipay.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
lib = File.expand_path('../lib', __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'iyzipay/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = 'iyzipay'
|
7
|
-
s.version =
|
6
|
+
s.version = '1.0.35'
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.required_ruby_version = '>= 1.9.3'
|
10
9
|
s.summary = %q{iyzipay api ruby client}
|
data/lib/Iyzipay.rb
CHANGED
@@ -12,5 +12,4 @@ require_relative 'iyzipay/http_client'
|
|
12
12
|
require_relative 'iyzipay/pki_builder'
|
13
13
|
require_relative 'iyzipay/iyzipay_resource'
|
14
14
|
require_relative 'iyzipay/model'
|
15
|
-
require_relative 'iyzipay/options'
|
16
|
-
require_relative 'iyzipay/version'
|
15
|
+
require_relative 'iyzipay/options'
|
data/lib/iyzipay/http_client.rb
CHANGED
@@ -15,6 +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.35'
|
18
19
|
end
|
19
20
|
|
20
21
|
header
|
data/lib/iyzipay/model.rb
CHANGED
@@ -2,6 +2,7 @@ module Model
|
|
2
2
|
end
|
3
3
|
|
4
4
|
require_relative 'model/address'
|
5
|
+
require_relative 'model/api_test'
|
5
6
|
require_relative 'model/approval'
|
6
7
|
require_relative 'model/basic_bkm'
|
7
8
|
require_relative 'model/basic_bkm_initialize'
|
@@ -18,6 +19,9 @@ require_relative 'model/bkm'
|
|
18
19
|
require_relative 'model/bkm_initialize'
|
19
20
|
require_relative 'model/bounced_bank_transfer_list'
|
20
21
|
require_relative 'model/buyer'
|
22
|
+
require_relative 'model/card'
|
23
|
+
require_relative 'model/card_information'
|
24
|
+
require_relative 'model/card_list'
|
21
25
|
require_relative 'model/cancel'
|
22
26
|
require_relative 'model/checkout_form'
|
23
27
|
require_relative 'model/checkout_form_initialize'
|
@@ -28,6 +32,7 @@ require_relative 'model/disapproval'
|
|
28
32
|
require_relative 'model/installment_details'
|
29
33
|
require_relative 'model/installment_info'
|
30
34
|
require_relative 'model/installment_prices'
|
35
|
+
require_relative 'model/locale'
|
31
36
|
require_relative 'model/payment'
|
32
37
|
require_relative 'model/payment_card'
|
33
38
|
require_relative 'model/payment_channel'
|
@@ -35,6 +40,8 @@ require_relative 'model/payment_group'
|
|
35
40
|
require_relative 'model/payment_post_auth'
|
36
41
|
require_relative 'model/payment_pre_auth'
|
37
42
|
require_relative 'model/payout_completed_transaction_list'
|
43
|
+
require_relative 'model/pecco_initialize'
|
44
|
+
require_relative 'model/pecco_payment'
|
38
45
|
require_relative 'model/refund'
|
39
46
|
require_relative 'model/refund_charged_from_merchant'
|
40
47
|
require_relative 'model/sub_merchant'
|
@@ -42,4 +49,4 @@ require_relative 'model/sub_merchant_type'
|
|
42
49
|
require_relative 'model/threeds_initialize'
|
43
50
|
require_relative 'model/threeds_initialize_pre_auth'
|
44
51
|
require_relative 'model/threeds_payment'
|
45
|
-
require_relative 'model/currency'
|
52
|
+
require_relative 'model/currency'
|
@@ -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_array(:enabledInstallments, request[:enabledInstallments]).
|
20
21
|
get_request_string
|
21
22
|
end
|
22
23
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Iyzipay
|
2
|
+
module Model
|
3
|
+
class Card < IyzipayResource
|
4
|
+
|
5
|
+
def create(request = {}, options)
|
6
|
+
pki_string = to_pki_string_create(request)
|
7
|
+
HttpClient.post("#{options.base_url}/cardstorage/card", get_http_header(pki_string, options), request.to_json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def delete(request = {}, options)
|
11
|
+
pki_string = to_pki_string_delete(request)
|
12
|
+
HttpClient.delete("#{options.base_url}/cardstorage/card", 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]).
|
19
|
+
append(:externalId, request[:externalId]).
|
20
|
+
append(:email, request[:email]).
|
21
|
+
append(:cardUserKey, request[:cardUserKey]).
|
22
|
+
append(:card, CardInformation.to_pki_string(request[:card])).
|
23
|
+
get_request_string
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_pki_string_delete(request)
|
27
|
+
PkiBuilder.new.
|
28
|
+
append(:locale, request[:locale]).
|
29
|
+
append(:conversationId, request[:conversationId]).
|
30
|
+
append(:cardUserKey, request[:cardUserKey]).
|
31
|
+
append(:cardToken, request[:cardToken]).
|
32
|
+
get_request_string
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Iyzipay
|
2
|
+
module Model
|
3
|
+
class CardInformation
|
4
|
+
def self.to_pki_string(request)
|
5
|
+
unless request.nil?
|
6
|
+
PkiBuilder.new.
|
7
|
+
append(:cardAlias, request[:cardAlias]).
|
8
|
+
append(:cardNumber, request[:cardNumber]).
|
9
|
+
append(:expireYear, request[:expireYear]).
|
10
|
+
append(:expireMonth, request[:expireMonth]).
|
11
|
+
append(:cardHolderName, request[:cardHolderName]).
|
12
|
+
get_request_string
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Iyzipay
|
2
|
+
module Model
|
3
|
+
class CardList < IyzipayResource
|
4
|
+
|
5
|
+
def retrieve(request = {}, options)
|
6
|
+
pki_string = to_pki_string(request)
|
7
|
+
HttpClient.post("#{options.base_url}/cardstorage/cards", get_http_header(pki_string, options), request.to_json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_pki_string(request)
|
11
|
+
PkiBuilder.new.append_super(super).
|
12
|
+
append(:cardUserKey, request[:cardUserKey]).
|
13
|
+
get_request_string
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Iyzipay
|
2
|
+
module Model
|
3
|
+
class PeccoInitialize < IyzipayResource
|
4
|
+
|
5
|
+
def create(request = {}, options)
|
6
|
+
pki_string = to_pki_string(request)
|
7
|
+
HttpClient.post("#{options.base_url}/payment/pecco/initialize", get_http_header(pki_string, options), request.to_json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_pki_string(request)
|
11
|
+
PkiBuilder.new.append_super(super).
|
12
|
+
append_price(:price, request[:price]).
|
13
|
+
append(:basketId, request[:basketId]).
|
14
|
+
append(:paymentGroup, request[:paymentGroup]).
|
15
|
+
append(:buyer, Buyer.to_pki_string(request[:buyer])).
|
16
|
+
append(:shippingAddress, Address.to_pki_string(request[:shippingAddress])).
|
17
|
+
append(:billingAddress, Address.to_pki_string(request[:billingAddress])).
|
18
|
+
append_array(:basketItems, Basket.to_pki_string(request[:basketItems])).
|
19
|
+
append(:callbackUrl, request[:callbackUrl]).
|
20
|
+
append(:paymentSource, request[:paymentSource]).
|
21
|
+
append(:currency, request[:currency]).
|
22
|
+
append_price(:paidPrice, request[:paidPrice]).
|
23
|
+
get_request_string
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Iyzipay
|
2
|
+
module Model
|
3
|
+
class PeccoPayment < IyzipayResource
|
4
|
+
|
5
|
+
def create(request = {}, options)
|
6
|
+
pki_string = to_pki_string(request)
|
7
|
+
HttpClient.post("#{options.base_url}/payment/pecco/auth", get_http_header(pki_string, options), request.to_json)
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_pki_string(request)
|
11
|
+
PkiBuilder.new.append_super(super).
|
12
|
+
append(:token, request[:token]).
|
13
|
+
get_request_string
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -10,18 +10,10 @@ RSpec.describe 'Iyzipay' do
|
|
10
10
|
@options.base_url = 'https://sandbox-api.iyzipay.com'
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'should
|
14
|
-
|
15
|
-
locale: 'tr',
|
16
|
-
conversationId: '123456789',
|
17
|
-
paymentId: '252',
|
18
|
-
paidPrice: '1',
|
19
|
-
ip: '85.34.78.112',
|
20
|
-
currency: Iyzipay::Model::Currency::TRY
|
21
|
-
}
|
22
|
-
payment = Iyzipay::Model::BasicPaymentPostAuth.new.create(request, @options)
|
13
|
+
it 'should test api' do
|
14
|
+
api_test = Iyzipay::Model::ApiTest.new.retrieve(@options)
|
23
15
|
begin
|
24
|
-
$stderr.puts
|
16
|
+
$stderr.puts api_test.inspect
|
25
17
|
rescue
|
26
18
|
$stderr.puts 'oops'
|
27
19
|
raise
|
data/spec/approval_spec.rb
CHANGED
@@ -12,9 +12,9 @@ RSpec.describe 'Iyzipay' do
|
|
12
12
|
|
13
13
|
it 'should approve payment item' do
|
14
14
|
request = {
|
15
|
-
locale:
|
15
|
+
locale: Iyzipay::Model::Locale::TR,
|
16
16
|
conversationId: '123456789',
|
17
|
-
paymentTransactionId: '
|
17
|
+
paymentTransactionId: '1'
|
18
18
|
}
|
19
19
|
approval = Iyzipay::Model::Approval.new.create(request, @options)
|
20
20
|
begin
|
@@ -25,21 +25,6 @@ RSpec.describe 'Iyzipay' do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
it 'should disapprove payment item' do
|
29
|
-
request = {
|
30
|
-
locale: 'tr',
|
31
|
-
conversationId: '123456789',
|
32
|
-
paymentTransactionId: '699'
|
33
|
-
}
|
34
|
-
disapproval = Iyzipay::Model::Disapproval.new.create(request, @options)
|
35
|
-
begin
|
36
|
-
$stderr.puts disapproval.inspect
|
37
|
-
rescue
|
38
|
-
$stderr.puts 'oops'
|
39
|
-
raise
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
28
|
after :each do
|
44
29
|
end
|
45
30
|
end
|
data/spec/bin_number_spec.rb
CHANGED
@@ -12,9 +12,9 @@ RSpec.describe 'Iyzipay' do
|
|
12
12
|
|
13
13
|
it 'should retrieve bin number' do
|
14
14
|
request = {
|
15
|
-
locale:
|
15
|
+
locale: Iyzipay::Model::Locale::TR,
|
16
16
|
conversationId: '123456789',
|
17
|
-
binNumber: '
|
17
|
+
binNumber: '554960'
|
18
18
|
}
|
19
19
|
bin_number = Iyzipay::Model::BinNumber.new.retrieve(request, @options)
|
20
20
|
begin
|