zaakpay_ruby 0.1.1

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: a2a454f79ed5c0454630d9f9efc31947a1e798b6
4
+ data.tar.gz: cf0ad787d4c1552f1fbd89db8ceeefab0810cbd4
5
+ SHA512:
6
+ metadata.gz: 602d8e03c804110d908711a3bb19d4ffe52d8a48b2a6a802ab9b40d55ad239165c28c32bb72aff48d330be6fda8f4007faba28cfa138be6c03bcf06271dc5d4c
7
+ data.tar.gz: 9b403271a8be7f9ebcfff00185161d9ed43f40d42cfe45e789b7e5bb4dc7cd78fb4b0f268b61dc3dc7dcbfe0b1a6d3297122652a9e557515224388f5aa395454
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zaakpay_ruby.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ankur jain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # ZaakpayRuby
2
+ zaakpay_ruby is a ruby gem that demonstrates the integration of a ruby-on-rails application with Zaakpay's api.
3
+
4
+ A payment Gateway gem with easy installation and integration with rails 3, 4
5
+ -Payment Gateway Services.
6
+ -More than you want payment options with.
7
+ -major credit cards, debit cards and 52 netbanking banks.
8
+ -Fastest Merchant Approval.
9
+ -Smooth integration across 22 platforms.
10
+ -Start in minutes.
11
+ -Multi-Currency Processing Service with 13 currencies.
12
+
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ ```ruby
19
+ gem 'zaakpay_ruby'
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ And run this command to create initializer file
27
+
28
+ $ rails generate zaakpay_ruby:install
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install zaakpay_ruby
33
+
34
+ ## Usage
35
+ First and foremost, you have to signup on the https://zaakpay.com for getting merchant_id and secret_key
36
+
37
+ For setting your account, go to https://www.zaakpay.com/developers#view3
38
+ Save your settings as per your requirements.
39
+
40
+ For transaction by buyer
41
+
42
+ First you have to make a request to the zaakpay by:
43
+ request = ZaakpayRuby::Request.new(params)
44
+
45
+ Params would be the hash of parameters. Below are the required and optional parameters to pass in the request.
46
+ For more information about the request parameters, go through the link provided below.
47
+
48
+ https://www.zaakpay.com/developers#viewA
49
+
50
+ Get response by using this method
51
+ response = ZaakpayRuby::Response.new(request.raw_post)
52
+
53
+ For response parameters, go to the
54
+
55
+ https://www.zaakpay.com/developers#viewA_1
56
+
57
+
58
+ ## Development
59
+
60
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
61
+
62
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
63
+
64
+ ## Contributing
65
+
66
+ 1. Fork it ( https://github.com/[my-github-username]/zaakpay_ruby/fork )
67
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
68
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
69
+ 4. Push to the branch (`git push origin my-new-feature`)
70
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "zaakpay_ruby"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ ZaakpayRuby.configure do |config|
2
+ config.secret_key = 'Your zaakpay secret key here'
3
+ end
@@ -0,0 +1,16 @@
1
+ require 'securerandom'
2
+
3
+ module ZaakpayRuby
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path("../../templates", __FILE__)
7
+ desc "Creates zaakpay initializer for the application"
8
+
9
+ def copy_initializer
10
+ template "zaakpay_initializer.rb", "config/initializers/zaakpay.rb"
11
+
12
+ puts "Install complete! Truly Outrageous!"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module ZaakpayRuby
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,82 @@
1
+ require "zaakpay_ruby/version"
2
+
3
+ module ZaakpayRuby
4
+
5
+ # This is class for initialize the secret key
6
+ class Configuration
7
+ attr_accessor :secret_key, :log_level
8
+
9
+ def initialize
10
+ self.secret_key = nil
11
+ self.log_level = 'info'
12
+ end
13
+ end
14
+
15
+ class << self
16
+ attr_accessor :configuration
17
+ end
18
+
19
+ def self.configuration
20
+ @configuration ||= Configuration.new
21
+ end
22
+
23
+ def self.configure
24
+ yield(configuration) if block_given?
25
+ end
26
+
27
+ # This is where the checksum generation happens
28
+ # arguements: a parameters hash.
29
+ # return value: HMAC-SHA-256 checksum usign the Key
30
+ def self.generate_checksum(params_hash)
31
+ #sorted_params = self.sort_params(params_hash)
32
+ paramsstring = ""
33
+ params_hash.each {|key, value|
34
+ paramsstring += "'" + value.to_s + "'"
35
+ }
36
+ checksum = OpenSSL::HMAC.hexdigest('sha256', ZaakpayRuby.configuration.secret_key, paramsstring)
37
+ end
38
+
39
+
40
+ # This is a helper method for generating ZaakpayRuby checksum
41
+ # It sorts the parameters hash in ascending order of the keys
42
+ # arguments: a parameters hash
43
+ # return value: a hash with sorted in ascending order of keys
44
+ # It is not using now but would keep for the future
45
+ def self.sort_params(params_hash)
46
+ sorted_params_hash = {}
47
+ sorted_keys = params_hash.keys.sort{|x,y| x <=> y}
48
+ sorted_keys.each do |k|
49
+ sorted_params_hash[k] = params_hash[k]
50
+ end
51
+ sorted_params_hash
52
+ end
53
+
54
+ # This class is for wrappers around the ZaakpayRuby request.
55
+ class Request
56
+ attr_reader :params, :all_params, :checksum
57
+
58
+ def initialize(args_hash)
59
+ @params = args_hash
60
+ @checksum = ZaakpayRuby.generate_checksum(@params)
61
+ @all_params = {}.merge(@params).merge({'checksum' => @checksum })
62
+ end
63
+
64
+ end
65
+
66
+ # This class creates wrappers around the Zaakpay response
67
+ class Response
68
+ attr_reader :params, :all_params, :posted_checksum, :checksum
69
+
70
+ def initialize(args_str)
71
+ @all_params = Rack::Utils.parse_query(args_str)
72
+ @posted_checksum = @all_params['checksum']
73
+ @params = @all_params.reject{|k,v| k=='checksum'}
74
+ end
75
+
76
+ def valid?
77
+ @checksum = ZaakpayRuby.generate_checksum(@params)
78
+ @posted_checksum == @checksum
79
+ end
80
+
81
+ end
82
+ end
Binary file
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zaakpay_ruby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "zaakpay_ruby"
8
+ spec.version = ZaakpayRuby::VERSION
9
+ spec.authors = ["Shoaib Malik"]
10
+ spec.email = ["shoaib2109@gmail.com"]
11
+
12
+ if spec.respond_to?(:metadata)
13
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
14
+ end
15
+
16
+ spec.summary = %q{Zaakpay payment gateway gem for ruby}
17
+ spec.description = %q{zaakpay_ruby is a ruby gem that demonstrates the integration of a ruby-on-rails application with Zaakpay's api.}
18
+ spec.homepage = "https://github.com/shoaibmalik786/zaakpay_ruby"
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zaakpay_ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Shoaib Malik
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-08 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: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: zaakpay_ruby is a ruby gem that demonstrates the integration of a ruby-on-rails
42
+ application with Zaakpay's api.
43
+ email:
44
+ - shoaib2109@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - lib/generators/templates/zaakpay_initializer.rb
58
+ - lib/generators/zaakpay_ruby/install_generator.rb
59
+ - lib/zaakpay_ruby.rb
60
+ - lib/zaakpay_ruby/version.rb
61
+ - zaakpay_ruby-0.1.0.gem
62
+ - zaakpay_ruby.gemspec
63
+ homepage: https://github.com/shoaibmalik786/zaakpay_ruby
64
+ licenses:
65
+ - MIT
66
+ metadata:
67
+ allowed_push_host: https://rubygems.org
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.2.2
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Zaakpay payment gateway gem for ruby
88
+ test_files: []
89
+ has_rdoc: