infinite_pay 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 43bc736d974ec9a7b7682a52faa71df90ae68aab
4
+ data.tar.gz: 8a3ad1337641c79ceab7f4f7d9d7c48dfedc870a
5
+ SHA512:
6
+ metadata.gz: a53670c568bd5004f60b52e70c5758f59521dacd0296ad0596ee503e1849d7184c96e28fd9a4f3802b325e3ac77ad558b2ea564ec98c7dcad15da86f4edc1177
7
+ data.tar.gz: 013e87587342522fdf3933f7526b568bbb2f2abe3f1b1030e2ea236597f10567c0a531ab535ca291ecfafb9414ea639503d3eafe3c3fae98b740993c1d5375f8
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ out/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'da_funk'
4
+ gem 'cloudwalk'
5
+ gem 'rake'
6
+ gem 'posxml_parser'
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ archive-zip (0.11.0)
5
+ io-like (~> 0.3.0)
6
+ cloudwalk (1.14.0)
7
+ bundler
8
+ rake
9
+ cloudwalk_handshake (0.13.2)
10
+ da_funk (2.3.0)
11
+ archive-zip (~> 0.5)
12
+ bundler
13
+ cloudwalk_handshake
14
+ funky-emv
15
+ posxml_parser
16
+ rake
17
+ funky-emv (0.20.1)
18
+ funky-tlv (~> 0.2)
19
+ funky-tlv (0.2.3)
20
+ io-like (0.3.0)
21
+ posxml_parser (2.10.0)
22
+ funky-emv (~> 0.3)
23
+ rake (12.3.2)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ cloudwalk
30
+ da_funk
31
+ posxml_parser
32
+ rake
33
+
34
+ BUNDLED WITH
35
+ 1.16.1
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Funky Application
2
+
3
+ ## Usage
4
+
5
+ ### Setup
6
+
7
+ With Ruby installed and repository cloned, execute in root of repo:
8
+
9
+ bundle install # Install CloudWalk CLI
10
+
11
+ ### Files and Directories
12
+
13
+ - `lib/` Contain .rb files that will be compiled.
14
+ - `test/` Contain all ruby files for test.
15
+ - `Gemfile/Gemfile.lock` Manage CloudWalk CLI version and any other Ruby gem, do not touch at `Gemfile.lock`
16
+ - `Cwfile.json` Manage Application attributes, application version and application modules versions.
17
+ - `Cwfile.json.lock` Contain the id's for all versions managed by `Cwfile.json`. **DO NOT MODIFY THIS FILE, IT'S AUTOMATICA GENERATED**
18
+ - `Rakefile` Defition of task files.
19
+ - `out` Contain the .mrb files compiled by tasks.
20
+
21
+ ### Compiling
22
+
23
+ Compile all ./lib/**/*.rb files:
24
+
25
+ bundle exec rake cloudwalk:build
26
+ # or
27
+ bundle exec rake
28
+
29
+ ### Deploying
30
+
31
+ Deploying all out files:
32
+
33
+ bundle exec rake cloudwalk:build <lib/path/to/file.xml>
34
+
35
+ ### Testing
36
+
37
+ Execute all tests
38
+
39
+ bundle exec rake test
40
+
41
+ Execute unit tests
42
+
43
+ bundle exec rake test:unit
44
+
45
+ Execute integration tests
46
+
47
+ bundle exec rake test:integration
48
+
49
+ Execute unique test
50
+
51
+ bundle exec rake test </path/to/test/file_test.rb>
data/RELEASE_NOTES.md ADDED
@@ -0,0 +1,5 @@
1
+ # InfinitePay
2
+
3
+ ### 1.0.0 - 2018-09-10
4
+
5
+ - Stable version.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'rake'
4
+ require 'fileutils'
5
+ require 'bundler/setup'
6
+
7
+ Bundler.require(:default)
8
+
9
+ Cloudwalk::Ruby::RakeTask.new do |t|
10
+ t.debug = false
11
+ end
12
+
13
+ DaFunk::RakeTask.new do |t|
14
+ t.mrbc = "cloudwalk compile"
15
+ t.mruby = "cloudwalk run -b"
16
+ t.debug = false
17
+ end
18
+
19
+ desc "Generate infinitepay gem to upload to RubyGems.org. "
20
+ task :gem do
21
+ puts "Be careful this action will move out/cw_infinitepay to out/infinite_pay"
22
+ input = ""
23
+ while (input != "y" && input != "n") do
24
+ puts "Are you sure? (Y/N)"
25
+ input = STDIN.gets.to_s.chomp.downcase
26
+ end
27
+
28
+ if input == "y"
29
+ sh "rake"
30
+ FileUtils.mv("out/cw_infinitepay", "out/infinite_pay")
31
+ sh "gem build infinite_pay.gemspec"
32
+ FileUtils.mv("out/infinite_pay", "out/cw_infinitepay")
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "infinite_pay"
8
+ spec.version = InfinitePay.version
9
+ spec.authors = ["Thiago Scalone"]
10
+ spec.email = ["thiago@cloudwalk.io"]
11
+ spec.summary = "InfinitePay Funky Library"
12
+ spec.description = "InfinitePay payment library to start transaction in DaFunk Runtime"
13
+ spec.homepage = "http://cloudwalk.io"
14
+ spec.license = "MIT"
15
+ spec.files = %w(.gitignore Gemfile Gemfile.lock RELEASE_NOTES.md README.md Rakefile infinite_pay.gemspec lib/main.rb out/infinite_pay/main.mrb)
16
+ spec.extensions = []
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.8"
22
+ spec.add_development_dependency "rake", "~> 12.0"
23
+ spec.add_dependency "da_funk", "~> 2"
24
+ spec.add_dependency "posxml_parser", "~> 2"
25
+ end
data/lib/main.rb ADDED
@@ -0,0 +1,47 @@
1
+ require "da_funk"
2
+ require "posxml_parser"
3
+
4
+ class Main < Device
5
+ def self.call(json = nil)
6
+ PosxmlInterpreter.new(parse(json), nil, false).start
7
+ true
8
+ end
9
+
10
+ def self.parse(json)
11
+ if json && (hash = JSON.parse(json)) && hash["initialize"]
12
+ return hash["initialize"]
13
+ end
14
+ "cw_omni_main.posxml"
15
+ end
16
+
17
+ def self.version
18
+ InfinitePay.version
19
+ end
20
+ end
21
+
22
+ class InfinitePay
23
+ class InfinitePayError < StandardError; end
24
+
25
+ attr_accessor :amount
26
+
27
+ def initialize(amount, api_key = nil)
28
+ @amount = amount
29
+ FileDb.new("./shared/cw_emv_payment.dat")["paAmount"] = data
30
+ if api_key
31
+ @api_key = api_key
32
+ else
33
+ @api_key = DaFunk::ParamsDat.file["infinitepay_api_key"]
34
+ end
35
+ end
36
+
37
+ def start
38
+ raise InfinitePayError.new("InfinitePay API Key missing") if api_key.to_s.empty?
39
+ DaFunk::ParamsDat.file["infinitepay_api_key"] = api_key
40
+
41
+ data = ("%.2f" % amount).sub(".", "").rjust(12, "0")
42
+ FileDb.new("./shared/cw_emv_payment.dat")["paAmount"] = data
43
+ FileDb.new("./shared/cw_emv_payment.dat")["paValue"] = data
44
+ PosxmlInterpreter.new("cw_omni_readcard.posxml", nil, false).start
45
+ end
46
+ end
47
+
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: infinite_pay
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Thiago Scalone
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: da_funk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: posxml_parser
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ description: InfinitePay payment library to start transaction in DaFunk Runtime
70
+ email:
71
+ - thiago@cloudwalk.io
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - README.md
80
+ - RELEASE_NOTES.md
81
+ - Rakefile
82
+ - infinite_pay.gemspec
83
+ - lib/main.rb
84
+ - out/infinite_pay/main.mrb
85
+ homepage: http://cloudwalk.io
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.6.14
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: InfinitePay Funky Library
109
+ test_files: []