forked from Voog/ipizza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded providers to support new Ipizza implementation.
* Added support for iPizza services (`1011`, `1012`, `4011` and `4012`). Read more form [Estonian Banking Association webpage](http://pangaliit.ee/et/arveldused/pangalingi-spetsifikatsioon) * Changed MAC calculation in case of UTF-8 encoding to support new iPizza protocol. * Added supported encodings to Provider model * Added 'transaction_time' attribute to `Ipizza::Payment` object (parsed value of the `VK_T_DATETIME` field). * Removed support for iPizza services (`1001`, `1002`, `4001` and `4002`). * Added new provider: LHV Bank. * Authentication request response method `authentication_info` returns now `Ipizza::Authentication` object instead of string. * Bump version to 2.0.0 Closes Voog#6
- Loading branch information
Showing
70 changed files
with
1,081 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.DS_Store | ||
pkg | ||
pkg | ||
.ruby-gemset | ||
.ruby-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## v2.0.0 | ||
|
||
* Added support for iPizza services (`1011`, `1012`, `4011` and `4012`). Read more form [Estonian Banking Association webpage](http://pangaliit.ee/et/arveldused/pangalingi-spetsifikatsioon) | ||
* Changed MAC calculation in case of UTF-8 encoding to support new iPizza protocol. | ||
* Added supported encodings to Provider model (`UTF-8` (default), `ISO-8859-1` and `WINDOWS-1257`). | ||
* Added 'transaction_time' attribute to `Ipizza::Payment` object (parsed value of the `VK_T_DATETIME` field). | ||
* Removed support for iPizza services (`1001`, `1002`, `4001` and `4002`). | ||
* Added new provider: LHV Bank. | ||
* Authentication request response method `authentication_info` returns now `Ipizza::Authentication` object instead of string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
source "http://rubygems.org" | ||
source 'http://rubygems.org' | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
guard 'rspec', :version => 2, :cli => "--color", :bundler => true, :all_on_start => false, :all_after_pass => false, :keep_failed => true, :notification => false do | ||
watch('spec/spec_helper.rb') { "spec" } | ||
guard 'rspec', version: 2, cli: '--color', bundler: true, all_on_start: false, all_after_pass: false, keep_failed: true, notification: false do | ||
watch('spec/spec_helper.rb') { 'spec' } | ||
watch(%r{^spec/.+_spec\.rb}) | ||
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ Bundler::GemHelper.install_tasks | |
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "ipizza/version" | ||
$:.push File.expand_path('../lib', __FILE__) | ||
require 'ipizza/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "ipizza" | ||
s.name = 'ipizza' | ||
s.version = Ipizza::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ["Priit Haamer"] | ||
s.email = ["[email protected]"] | ||
s.homepage = "http://github.com/priithaamer/ipizza" | ||
s.summary = %q{Implements iPizza protocol to communicate with Estonian Banks} | ||
s.description = %q{Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.} | ||
s.authors = ['Priit Haamer'] | ||
s.email = ['[email protected]'] | ||
s.homepage = 'https://github.com/Voog/ipizza' | ||
s.summary = 'Implements iPizza protocol to communicate with Estonian Banks' | ||
s.description = 'Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.' | ||
|
||
s.add_development_dependency 'rspec', '~> 2.9.0' | ||
s.add_development_dependency 'guard-rspec' | ||
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |s| | |
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
s.require_paths = ['lib'] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Ipizza | ||
class Authentication | ||
|
||
attr_accessor :provider, :user, :message_time, :sender_id, :receiver_id, :user_name, :user_id, :country, :other, :authentication_identifier, :request_identifier | ||
|
||
def initialize(attribs = {}) | ||
attribs.each do |key, value| | ||
if self.respond_to?("#{key.to_s}=".to_sym) | ||
v = key.to_sym == :message_time && value.is_a?(String) ? Time.parse(value) : value | ||
self.send("#{key.to_s}=".to_sym, v) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Ipizza | ||
class AuthenticationRequest < Ipizza::Request | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
module Ipizza | ||
class Payment | ||
|
||
attr_accessor :stamp, :amount, :currency, :refnum, :receiver_account, :receiver_name, :sender_account, :sender_name, :message, :transaction_id | ||
attr_accessor :provider, :stamp, :amount, :currency, :refnum, :receiver_account, :receiver_name, :sender_account, :sender_name, :message, :transaction_id, :transaction_time | ||
|
||
def initialize(attribs = {}) | ||
attribs.each do |key, value| | ||
if self.respond_to?("#{key.to_s}=".to_sym) | ||
self.send("#{key.to_s}=".to_sym, value) | ||
v = key.to_sym == :transaction_time && value.is_a?(String) ? Time.parse(value) : value | ||
self.send("#{key.to_s}=".to_sym, v) | ||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Ipizza | ||
class PaymentRequest < Ipizza::Request | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
class Ipizza::PaymentResponse < Ipizza::Response | ||
|
||
def success? | ||
return ['1101'].include?(@params['VK_SERVICE']) | ||
%w(1111).include?(@params['VK_SERVICE']) | ||
end | ||
|
||
def valid? | ||
return @valid | ||
@valid | ||
end | ||
|
||
def automatic_message? | ||
@params['VK_AUTO'] and @params['VK_AUTO'] == 'Y' | ||
@params['VK_AUTO'] == 'Y' | ||
end | ||
|
||
def payment_info | ||
@payment_info ||= Ipizza::Payment.new( | ||
:stamp => @params['VK_STAMP'], :amount => @params['VK_AMOUNT'], :currency => @params['VK_CURR'], | ||
:refnum => @params['VK_REF'], :message => @params['VK_MSG'], :transaction_id => @params['VK_T_NO'], | ||
:receiver_account => @params['VK_REC_ACC'], :receiver_name => @params['VK_REC_NAME'], | ||
:sender_account => @params['VK_SND_ACC'], :sender_name => @params['VK_SND_NAME'] | ||
provider: @params['VK_SND_ID'], | ||
stamp: @params['VK_STAMP'], | ||
amount: @params['VK_AMOUNT'], | ||
currency: @params['VK_CURR'], | ||
refnum: @params['VK_REF'], | ||
message: @params['VK_MSG'], | ||
transaction_id: @params['VK_T_NO'], | ||
receiver_account: @params['VK_REC_ACC'], | ||
receiver_name: @params['VK_REC_NAME'], | ||
sender_account: @params['VK_SND_ACC'], | ||
sender_name: @params['VK_SND_NAME'], | ||
transaction_time: @params['VK_T_DATETIME'] | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.