iyzi 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf1e310505128560d353de7ef2ce5ba012a5c7e9
4
- data.tar.gz: b371845099f999768459d033cd2ffcb79edc3081
3
+ metadata.gz: fd13521b57d2d962340bb49d6b30e222fd59879e
4
+ data.tar.gz: 25acdd5ef6ff9352bf73e8c49f87c9d0820e4f06
5
5
  SHA512:
6
- metadata.gz: 584d09f76e2b8bcee08a85ca680ba52e7ac7e01146aa4e5c24b756070aed650aa1e15c284efa162e03cdf25a963c8e102ec82102a0021b49d4639023c5a119cf
7
- data.tar.gz: 7243d0300d52c75d9370c624b53065a6e00fccc480312850defb8875392f4b1877ebe9087cabfca3011947a4ffc5944100f37b9f4bfe25864fc32c80e8511f46
6
+ metadata.gz: 59985179aabdeb626d74c732df0098c20d4f512dd9cc5d4d13e9c853f78e58c8805dc9e8ea9557e7b7a5ac254134cc3106cf40d18d966128a7a4160ca0518aa6
7
+ data.tar.gz: 7edf2081356e0be99bbc488e9d037bedcc331fe5953be4f43df382d066df2bbd81fca7a80ff8a1607b69ad9a0103ab5704a5283c4694d2ef4d9d5f504da53ec6
data/.codeclimate.yml ADDED
@@ -0,0 +1,10 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ - javascript
9
+ exclude_paths:
10
+ - spec/**/*
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
data/.travis.yml CHANGED
@@ -1,4 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
3
+ - 2.2.3
4
4
  before_install: gem install bundler -v 1.11.2
5
+ deploy:
6
+ provider: rubygems
7
+ api_key:
8
+ secure: RPl3sI541nNa1U+XZJ2u5rRyKYG+MbAXHBrQWjyCqqspa5NsVzNXodtp2s3oun9zLtR6ZrDA/c/Zqt7yGoGlWD9ELE541cJOUlIFZwUYX5HuXQPSuGWq1vTFw2lBQg6et/6H7JqdTgqbr0rVMvtziDNKmaqMdDhUB4SjFmJbA5I3dffATpiltN+aJCvbCS3V0uuEkQPhAiMFbBz04bEL0dE/F086FRdcBFwI+Imp7EzSZQjZFjxVwta7NnBF+/z6OZIqRAX+77Y8Jz0UtXMqQ2UmMBaEjnKcMbgwSEiQDHFhkPxxdoUQsBoAlQaxgGEiLQTpISv3qQDZNe2qI7gVV4AP+4+/uEYJcrnlPrHtkB2ZnsF7953V+RyM3xGj6UoG92XvWmCmfGsfnx8CTzBInC2FZBQJ4ZpXieASJZld1lzXnNkhCtl/6v8K1d39asz4LlzBUIJ9LoLmywBZv7O3ViKRsIeteNl1tlyLWRHEVwo1p4Dl+sM7dzeS0NqFGyRZA872ZO0+0gfUy8YVT5tFyHCYpvwMPey0yVZrw/zzjxwfSXlm0ltpckRSOSzAqu29LCH5OqaynEwWPJ0Qr6l0A/eoZSKy2Qxr1p3fCYon62n6tIw2GdmVKnMi2N8oKrhh4sp8Tu2y+YTL2f+fQSuXfxBcZr6aCoJky57guZc5tpo=
9
+ on:
10
+ tags: true
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Iyzi
2
2
 
3
3
  [![Build Status](https://travis-ci.org/parasutcom/iyzi.svg?branch=master)](https://travis-ci.org/parasutcom/iyzi)
4
+ [![Code Climate](https://codeclimate.com/github/parasutcom/iyzi/badges/gpa.svg)](https://codeclimate.com/github/parasutcom/iyzi)
5
+ [![Test Coverage](https://codeclimate.com/github/parasutcom/iyzi/badges/coverage.svg)](https://codeclimate.com/github/parasutcom/iyzi/coverage)
4
6
 
5
7
  Iyzico ruby client
6
8
 
@@ -49,7 +51,7 @@ Checked items are supported
49
51
 
50
52
  - [x] Yeni Alt Üye İşyeri Ekleme Servisi /onboarding/submerchant POST
51
53
  - [x] Alt Üye İşyeri Güncelleme Servisi /onboarding/submerchant PUT
52
- - [ ] Ödeme (Auth) Servisi /payment/iyzipos/auth/ecom POST
54
+ - [x] Ödeme (Auth) Servisi /payment/iyzipos/auth/ecom POST
53
55
  - [ ] 3D Secure Ödeme (initialize 3DS) Başlatma Servisi /payment/iyzipos/initialize3ds/ecom POST
54
56
  - [ ] 3D Secure Ödeme (Auth 3DS) Servisi /payment/iyzipos/auth3ds/ecom POST
55
57
  - [ ] Ön Otorizasyon (PreAuth) Servisi /payment/iyzipos/preauth/ecom POST
data/iyzi.gemspec CHANGED
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "awesome_print", '~> 1.6'
30
30
  spec.add_development_dependency "webmock", "~> 1.2"
31
31
  spec.add_development_dependency "vcr", "~> 3.0"
32
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 0.5"
32
33
  end
data/lib/iyzi.rb CHANGED
@@ -4,6 +4,7 @@ require 'iyzi/resources'
4
4
  require 'iyzi/endpoints'
5
5
  require 'iyzi/api_error'
6
6
  require 'iyzi/utils'
7
+ require 'iyzi/currency'
7
8
 
8
9
  # PKI Builders
9
10
  require 'iyzi/pki_builder'
@@ -1,7 +1,7 @@
1
1
  module Iyzi
2
2
  class Configuration
3
3
  BASE_URL = 'https://api.iyzipay.com/'.freeze
4
- REQUIRED_CONFIG = %i(base_url api_key secret)
4
+ REQUIRED_CONFIG = %i(base_url api_key secret).freeze
5
5
  attr_accessor :base_url, :api_key, :secret
6
6
 
7
7
  def initialize(options = {})
@@ -0,0 +1,16 @@
1
+ module Iyzi
2
+ module Currency
3
+ TRY = 'TRY'.freeze
4
+ USD = 'USD'.freeze
5
+ EUR = 'EUR'.freeze
6
+ GBP = 'GBP'.freeze
7
+ IRR = 'IRR'.freeze
8
+
9
+ VALID_CURRENCIES = [TRY, USD, EUR, GBP, IRR].freeze
10
+
11
+ def self.find(symbol)
12
+ currency = VALID_CURRENCIES.select { |c| c == symbol.to_s.upcase }.first
13
+ currency.present? ? currency : raise("currency must be one of these: #{VALID_CURRENCIES}")
14
+ end
15
+ end
16
+ end
@@ -13,6 +13,7 @@ module Iyzi
13
13
  basketItems
14
14
  callbackUrl
15
15
  paymentSource
16
+ currency
16
17
  posOrderId
17
18
  paidPrice
18
19
  forceThreeDS
data/lib/iyzi/request.rb CHANGED
@@ -8,31 +8,31 @@ module Iyzi
8
8
  AUTHORIZATION_HEADER_STRING = 'IYZWS %s:%s'.freeze
9
9
  DEFAULT_LOCALE = 'tr'.freeze
10
10
 
11
- attr_accessor :config, :method, :path, :conversation_id, :locale, :random_string, :pki, :options
11
+ attr_accessor :config, :method, :path, :random_string, :pki, :options
12
12
 
13
13
  def initialize(method, path, options = {})
14
14
  @method = method
15
15
  @path = path
16
16
  # use default config which comes from initial setup
17
17
  # you can also send custom config object which you'd like to use
18
- @config = options.delete(:config) || Iyzi.configuration
19
- @options = options
20
- @locale = options[:locale] || DEFAULT_LOCALE
21
- @conversation_id = options[:conversation_id]
22
- @pki = to_pki
23
- @random_string = secure_random_string
18
+ @config = options.delete(:config) || Iyzi.configuration
19
+ @options = options
20
+ @options[:locale] = options[:locale] || DEFAULT_LOCALE
21
+ @options[:currency] = Currency.find(options[:currency]) if options[:currency].present?
22
+ @pki = to_pki
23
+ @random_string = secure_random_string
24
24
  # config must have all required params
25
25
  config.validate if has_pki?
26
26
  end
27
27
 
28
28
  def iyzi_options
29
- Utils.hash_to_properties(options)
29
+ Utils.hash_to_properties(options.compact)
30
30
  end
31
31
 
32
32
  def connection
33
33
  @conn ||= Faraday.new(url: config.base_url) do |faraday|
34
34
  faraday.request :json
35
- faraday.response :logger # log requests to STDOUT
35
+ faraday.response :logger if ENV['DEBUG']
36
36
  faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
37
37
  faraday.response :json, content_type: /\bjson$/
38
38
  end
data/lib/iyzi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iyzi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iyzi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demirhan Aydin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: codeclimate-test-reporter
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.5'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.5'
139
153
  description: Iyzico ruby client for api v1.0
140
154
  email:
141
155
  - demirhanaydin@gmail.com
@@ -143,6 +157,7 @@ executables: []
143
157
  extensions: []
144
158
  extra_rdoc_files: []
145
159
  files:
160
+ - ".codeclimate.yml"
146
161
  - ".gitignore"
147
162
  - ".rspec"
148
163
  - ".ruby-version"
@@ -158,6 +173,7 @@ files:
158
173
  - lib/iyzi.rb
159
174
  - lib/iyzi/api_error.rb
160
175
  - lib/iyzi/configuration.rb
176
+ - lib/iyzi/currency.rb
161
177
  - lib/iyzi/endpoints.rb
162
178
  - lib/iyzi/pki_builder.rb
163
179
  - lib/iyzi/pki_builders/address.rb