irankish 0.0.2 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/irankish.rb +2 -2
- data/lib/irankish/get_transaction.rb +52 -0
- data/lib/irankish/validate_verify.rb +30 -0
- data/lib/irankish/verify.rb +10 -6
- data/lib/irankish/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '00911a81e72e11b738b8819d127a84fb1b07dcfa'
|
4
|
+
data.tar.gz: 58450bebce38b294a8e8739e41dccdb18bd020e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe4121670a77f12b81669a59d1f1cfdefa077cf33ffebb004ba6c1cf8aa48f8432d3cd6381f485cb4f164779606317ead4200ff03dd764f3e7868b664c48a65
|
7
|
+
data.tar.gz: c988b0162e4f97f345813ef61da88fa6a3f994816502fe6912c8264e423190fc24be6bbb8a70e55dfac170f19692bf75baa7819d08a62b7a244659a032183ae5
|
data/lib/irankish.rb
CHANGED
@@ -28,6 +28,6 @@ module Irankish
|
|
28
28
|
end
|
29
29
|
|
30
30
|
|
31
|
-
%w(version validate_token_response get_token).each do |identify|
|
32
|
-
|
31
|
+
%w(version get_transaction validate_verify verify validate_token_response get_token).each do |identify|
|
32
|
+
require_relative "irankish/#{identify}.rb"
|
33
33
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "savon"
|
2
|
+
|
3
|
+
module Irankish
|
4
|
+
class GetTransaction
|
5
|
+
include Validatable
|
6
|
+
attr_accessor :amount,:merchantId,:referenceNumber,:sha1Key
|
7
|
+
attr_reader :response
|
8
|
+
|
9
|
+
validates_presence_of :amount
|
10
|
+
validates_presence_of :merchantId
|
11
|
+
validates_presence_of :referenceNumber
|
12
|
+
validates_presence_of :sha1Key
|
13
|
+
|
14
|
+
def initialize(args = {})
|
15
|
+
@getTokenWSDL = Savon.client(wsdl: args.fetch(:verfiyWSDL,Irankish.configuration.getTokenWSDL),namespaces: {
|
16
|
+
"xmlns:tem" => "http://tempuri.org/",
|
17
|
+
"xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/"
|
18
|
+
},
|
19
|
+
namespace_identifier: :tem,
|
20
|
+
env_namespace: :soapenv,
|
21
|
+
log: true, # set true to switch on logging
|
22
|
+
log_level: :debug,
|
23
|
+
element_form_default: :qualified,
|
24
|
+
pretty_print_xml: true,
|
25
|
+
open_timeout: 3000000,
|
26
|
+
read_timeout: 3000000,
|
27
|
+
encoding: "UTF-8"
|
28
|
+
)
|
29
|
+
@sha1Key = args.fetch(:sha1Key, Irankish.configuration.sha1Key)
|
30
|
+
@merchantId = args.fetch(:merchantId, Irankish.configuration.merchantId)
|
31
|
+
@amount = args.fetch(:amount)
|
32
|
+
@referenceNumber = args.fetch(:referenceNumber)
|
33
|
+
@response = ValidateVerify.new()
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def call
|
38
|
+
response = @getTokenWSDL.call :get_limited_transacction, message: {
|
39
|
+
'merchantId' => @merchantId,
|
40
|
+
'invoiceNo' => @referenceNumber,
|
41
|
+
'amount' => @amount
|
42
|
+
}
|
43
|
+
@response.validate(response.body)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Irankish
|
2
|
+
class ValidateVerify
|
3
|
+
attr_reader :response, :status,:statusmessage
|
4
|
+
|
5
|
+
def validate(response = nil)
|
6
|
+
@response = response
|
7
|
+
perform_validation
|
8
|
+
return self
|
9
|
+
end
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
@valid
|
13
|
+
end
|
14
|
+
def get_price
|
15
|
+
return @response[:kiccc_payments_verification_response][:kiccc_payments_verification_result]
|
16
|
+
end
|
17
|
+
def get_code
|
18
|
+
get_price()
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def perform_validation
|
24
|
+
raise ArgumentError, 'not a valid response' if @response.nil?
|
25
|
+
@valid = (!['-51', '-50', '-20','-30','-80','-81','-90','513','512','511','510','509','508','507','506','505','504','503','502','501','500','499','203','202','201','200','167','166','160','150','140','133','132','131','130','121','120','110','100'].include? @response[:kiccc_payments_verification_response][:kiccc_payments_verification_result].to_s)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/irankish/verify.rb
CHANGED
@@ -3,7 +3,7 @@ require "savon"
|
|
3
3
|
module Irankish
|
4
4
|
class Verify
|
5
5
|
include Validatable
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :merchantId,:referenceNumber,:sha1Key,:token
|
7
7
|
attr_reader :response
|
8
8
|
|
9
9
|
validates_presence_of :token
|
@@ -11,8 +11,9 @@ module Irankish
|
|
11
11
|
validates_presence_of :referenceNumber
|
12
12
|
validates_presence_of :sha1Key
|
13
13
|
|
14
|
+
|
14
15
|
def initialize(args = {})
|
15
|
-
@getTokenWSDL = Savon.client(wsdl: args.fetch(:verfiyWSDL, Irankish.configuration.
|
16
|
+
@getTokenWSDL = Savon.client(wsdl: args.fetch(:verfiyWSDL, Irankish.configuration.verifyWSDL),namespaces: {
|
16
17
|
"xmlns:tem" => "http://tempuri.org/",
|
17
18
|
"xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/"
|
18
19
|
},
|
@@ -28,15 +29,18 @@ module Irankish
|
|
28
29
|
)
|
29
30
|
@sha1Key = args.fetch(:sha1Key, Irankish.configuration.sha1Key)
|
30
31
|
@merchantId = args.fetch(:merchantId, Irankish.configuration.merchantId)
|
31
|
-
@
|
32
|
+
@amount = args.fetch(:amount)
|
32
33
|
@referenceNumber = args.fetch(:referenceNumber)
|
33
|
-
@
|
34
|
+
@token = args.fetch(:token)
|
35
|
+
@response = ValidateVerify.new()
|
34
36
|
end
|
35
37
|
|
36
38
|
|
37
39
|
def call
|
38
|
-
|
39
|
-
|
40
|
+
|
41
|
+
|
42
|
+
response = @getTokenWSDL.call :kiccc_payments_verification, message: {
|
43
|
+
'token' => @token,
|
40
44
|
'merchantId' => @merchantId,
|
41
45
|
'referenceNumber' => @referenceNumber,
|
42
46
|
'sha1Key' => @sha1Key
|
data/lib/irankish/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irankish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mohammad mahmoodi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -100,7 +100,9 @@ files:
|
|
100
100
|
- irankish.gemspec
|
101
101
|
- lib/irankish.rb
|
102
102
|
- lib/irankish/get_token.rb
|
103
|
+
- lib/irankish/get_transaction.rb
|
103
104
|
- lib/irankish/validate_token_response.rb
|
105
|
+
- lib/irankish/validate_verify.rb
|
104
106
|
- lib/irankish/verify.rb
|
105
107
|
- lib/irankish/version.rb
|
106
108
|
homepage: https://github.com/mm580486/irankish
|