iyzipay 1.0.42 → 1.0.43

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2e711367ebf19b6a6f7ffced82142dee4a017c9f
4
- data.tar.gz: 9fd10f2d29e9867f99fae7657f4c52d25922693e
2
+ SHA256:
3
+ metadata.gz: 1f69247a2b8c5db2ad3461572c026f51ea40ab8e78f31c052ee1fef35db4f361
4
+ data.tar.gz: b92f6e94ad012c09f95c04d07411497190600434dbc168032f47d2f4def798b1
5
5
  SHA512:
6
- metadata.gz: f123ab13f45956c521a5dfe5ac6cb3255bdb7274a3177c7a0add2739c4074edfd3a32f702fb41db16030b928780264ba668b4009f2e81524850410f01b44d89c
7
- data.tar.gz: abef9415f542caf8aa553c6b1296f71dcd95166a434a8cbc449655751925e18ba24a974e663edb2e143e4ab014786fbc76a7c3173542eb26af11fcf2d01cea0d
6
+ metadata.gz: cb94b25502775f23f3ad0237855249372c2a0df3e0531e9248a91b2475f1c1f8cb97bf99f86f7c50ae71ffb3d80ea7c1729d27f8c38b35ed383e19b41063e922
7
+ data.tar.gz: 8ea27b332ef6701fb5b21ac7d4340932d51547447e27ae7a42b57898efc636964161652033101fc154b3f92395dd9c027557ec3e0be0904dbaaea24e189c3edc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.42
1
+ 1.0.43
@@ -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.42'
6
+ s.version = '1.0.43'
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}
@@ -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.42'
18
+ header[:'x-iyzi-client-version'] = 'iyzipay-ruby-1.0.43'
19
19
  end
20
20
 
21
21
  header
@@ -49,4 +49,5 @@ require_relative 'model/sub_merchant_type'
49
49
  require_relative 'model/threeds_initialize'
50
50
  require_relative 'model/threeds_initialize_pre_auth'
51
51
  require_relative 'model/threeds_payment'
52
- require_relative 'model/currency'
52
+ require_relative 'model/currency'
53
+ require_relative 'model/refund_reason'
@@ -11,6 +11,8 @@ module Iyzipay
11
11
  PkiBuilder.new.append_super(super).
12
12
  append(:paymentId, request[:paymentId]).
13
13
  append(:ip, request[:ip]).
14
+ append(:reason, request[:reason]).
15
+ append(:description, request[:description]).
14
16
  get_request_string
15
17
  end
16
18
  end
@@ -13,6 +13,8 @@ module Iyzipay
13
13
  append_price(:price, request[:price]).
14
14
  append(:ip, request[:ip]).
15
15
  append(:currency, request[:currency]).
16
+ append(:reason, request[:reason]).
17
+ append(:description, request[:description]).
16
18
  get_request_string
17
19
  end
18
20
  end
@@ -0,0 +1,10 @@
1
+ module Iyzipay
2
+ module Model
3
+ module RefundReason
4
+ DOUBLE_PAYMENT = 'double_payment'
5
+ BUYER_REQUEST = 'buyer_request'
6
+ FRAUD = 'fraud'
7
+ OTHER = 'other'
8
+ end
9
+ end
10
+ end
@@ -38,6 +38,35 @@ RSpec.describe 'Iyzipay' do
38
38
  end
39
39
  end
40
40
 
41
+ it 'should cancel payment with reason and description' do
42
+ payment = Builder::PaymentBuilder.new.create_standard_listing_payment(@options)
43
+
44
+ request = {
45
+ locale: Iyzipay::Model::Locale::TR,
46
+ conversationId: '123456789',
47
+ paymentId: payment['paymentId'],
48
+ ip: '85.34.78.112',
49
+ reason: Iyzipay::Model::RefundReason::OTHER,
50
+ description: 'customer requested for default sample'
51
+ }
52
+ cancel = Iyzipay::Model::Cancel.new.create(request, @options)
53
+ begin
54
+ $stdout.puts cancel.inspect
55
+ cancel = JSON.parse(cancel)
56
+ expect(cancel['status']).to eq('success')
57
+ expect(cancel['locale']).to eq('tr')
58
+ expect(cancel['systemTime']).not_to be_nil
59
+ expect(cancel['conversationId']).to eq('123456789')
60
+ expect(cancel['paymentId']).to eq(payment['paymentId'])
61
+ expect(cancel['price']).to eq(1.10000000)
62
+ expect(cancel['currency']).to eq('TRY')
63
+ expect(cancel['authCode']).not_to be_nil
64
+ rescue
65
+ $stderr.puts 'oops'
66
+ raise
67
+ end
68
+ end
69
+
41
70
  after :each do
42
71
  end
43
72
  end
@@ -40,6 +40,37 @@ RSpec.describe 'Iyzipay' do
40
40
  end
41
41
  end
42
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)
68
+ rescue
69
+ $stderr.puts 'oops'
70
+ raise
71
+ end
72
+ end
73
+
43
74
  after :each do
44
75
  end
45
76
  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.42
4
+ version: 1.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iyzico
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 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
@@ -124,6 +124,7 @@ files:
124
124
  - lib/iyzipay/model/pecco_payment.rb
125
125
  - lib/iyzipay/model/refund.rb
126
126
  - lib/iyzipay/model/refund_charged_from_merchant.rb
127
+ - lib/iyzipay/model/refund_reason.rb
127
128
  - lib/iyzipay/model/sub_merchant.rb
128
129
  - lib/iyzipay/model/sub_merchant_type.rb
129
130
  - lib/iyzipay/model/threeds_initialize.rb
@@ -176,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  version: '0'
177
178
  requirements: []
178
179
  rubyforge_project:
179
- rubygems_version: 2.6.14
180
+ rubygems_version: 2.7.3
180
181
  signing_key:
181
182
  specification_version: 4
182
183
  summary: iyzipay api ruby client