parsley-payment-rails 1.0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/lib/parsley-payment-rails.rb +8 -0
- data/lib/parsley-payment-rails/version.rb +5 -0
- data/parsley-payment-rails.gemspec +20 -0
- data/update.sh +25 -0
- data/vendor/assets/javascripts/parsley-payment.js +56 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3449533ee4969d0c33e456911ebc44f0f8822e5e
|
4
|
+
data.tar.gz: 3e5991899162db5158d042bd56344001f26119af
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9dca74d3153cffd0bb04959ae4e5df7e524e46321a6cdfd4b385e8f4eda89b4c41bc9e7a00f53870b9944e24bd78cb797c13e7c2bc8740016e6b84504a71f93c
|
7
|
+
data.tar.gz: 36a0a650b29d757b57a1a94fbbd093740932390c16de06a6264d101114ec0661ad0428c7ed15f540be2b2a82169c4d92d128d70567bcfd8b4da49cc1ec362d66
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Carl Mercier
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Parsley-Payment for Rails Asset Pipeline
|
2
|
+
|
3
|
+
[Parsley-Payment](https://github.com/cmer/parsley-payment) is a credit card validation library for [Parsley.js](http://parsleyjs.org/). This gem makes it easy to use it with Rails Asset Pipeline.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem "parsley-payment-rails"
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Add the following to your `app/assets/javascripts/application.js`:
|
18
|
+
|
19
|
+
//= require parsley-payment
|
20
|
+
|
21
|
+
## Versions
|
22
|
+
|
23
|
+
The gem follows Parsley-Payment's versions. If the gem's version is `1.0.0.0`, then `1.0.0` is a version of Parsley-Payment and `0`
|
24
|
+
is a patch level of the gem itself.
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'parsley-payment-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "parsley-payment-rails"
|
8
|
+
gem.version = ParsleyPayment::Rails::VERSION
|
9
|
+
gem.authors = ["Carl Mercier"]
|
10
|
+
gem.email = ["carl@carlmercier.com"]
|
11
|
+
gem.description = %q{Parsley-Payment.js bundled for Rails Asset Pipeline}
|
12
|
+
gem.summary = %q{Parsley-Payment.js bundled for Rails Asset Pipeline}
|
13
|
+
gem.homepage = "https://github.com/cmer/parsley-payment-rails"
|
14
|
+
gem.license = "MIT"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_dependency("railties", ">= 3.0.0")
|
20
|
+
end
|
data/update.sh
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
if [ $# -eq 0 ]; then
|
6
|
+
echo "No tag supplied. Usage: ./update.sh v2.0.0-rc5"
|
7
|
+
exit 1
|
8
|
+
fi
|
9
|
+
|
10
|
+
TAG=$1
|
11
|
+
EXTRACT_DIRECTORY="/tmp/$$$(date "+%Y%m%d%H%M%S")"
|
12
|
+
FILE_NAME="$EXTRACT_DIRECTORY.tar.gz"
|
13
|
+
RELEASE_URL="https://github.com/cmer/parsley-payment/archive/$TAG.tar.gz"
|
14
|
+
RELEASE_PATH="$EXTRACT_DIRECTORY/parsley-payment-$TAG"
|
15
|
+
|
16
|
+
VENDOR_JS_PATH="vendor/assets/javascripts"
|
17
|
+
VENDOR_CSS_PATH="vendor/assets/stylesheets"
|
18
|
+
|
19
|
+
wget -O $FILE_NAME $RELEASE_URL
|
20
|
+
mkdir $EXTRACT_DIRECTORY
|
21
|
+
tar xfz $FILE_NAME -C $EXTRACT_DIRECTORY
|
22
|
+
|
23
|
+
cp "$RELEASE_PATH/dist/parsley-payment.js" $VENDOR_JS_PATH
|
24
|
+
|
25
|
+
rm -rf $FILE_NAME $EXTRACT_DIRECTORY
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*!
|
2
|
+
* Parsley-Payment.js
|
3
|
+
* Version 1.0.0
|
4
|
+
* http://github.com/cmer/parsley-payment
|
5
|
+
* Carl Mercier - <carl@carlmercier.com>
|
6
|
+
* MIT Licensed
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function () {
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
window.Parsley.addValidator('creditcard',
|
13
|
+
function (value, requirement) {
|
14
|
+
var valid = jQuery.payment.validateCardNumber(value);
|
15
|
+
|
16
|
+
// Checks for specific brands
|
17
|
+
if(valid && requirement.length){
|
18
|
+
var valid_cards = requirement.split(','),
|
19
|
+
valid = false,
|
20
|
+
card = jQuery.payment.cardType(value);
|
21
|
+
|
22
|
+
if(requirement.indexOf(card) > -1) {
|
23
|
+
valid = true;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return valid;
|
27
|
+
},32)
|
28
|
+
.addMessage('en', 'creditcard', 'This credit card number is invalid or this brand is not supported.')
|
29
|
+
.addMessage('fr', 'creditcard', 'Ce numéro de carte de crédit est invalide ou ce type de carte n\'est pas supporté');
|
30
|
+
|
31
|
+
|
32
|
+
window.Parsley.addValidator('cvv',
|
33
|
+
function (value) {
|
34
|
+
var valid = jQuery.payment.validateCardCVC(value);
|
35
|
+
return valid;
|
36
|
+
}, 32)
|
37
|
+
.addMessage('en', 'cvv', 'This value should be a valid CVV number')
|
38
|
+
.addMessage('fr', 'cvv', 'Cette valeur doit être un code de vérification CVV valide');
|
39
|
+
|
40
|
+
|
41
|
+
window.Parsley.addValidator('cardexpiry',
|
42
|
+
function (value) {
|
43
|
+
if(value.indexOf('/') === -1) {
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
|
47
|
+
var date = $.payment.cardExpiryVal(value),
|
48
|
+
month = date.month,
|
49
|
+
year = date.year;
|
50
|
+
|
51
|
+
var valid = jQuery.payment.validateCardExpiry(month, year);
|
52
|
+
return valid;
|
53
|
+
}, 32)
|
54
|
+
.addMessage('en', 'cardexpiry', 'This value should be a valid date')
|
55
|
+
.addMessage('fr', 'cardexpiry', 'Cette valeur doit être une date valide');
|
56
|
+
}());
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: parsley-payment-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carl Mercier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
description: Parsley-Payment.js bundled for Rails Asset Pipeline
|
28
|
+
email:
|
29
|
+
- carl@carlmercier.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- lib/parsley-payment-rails.rb
|
40
|
+
- lib/parsley-payment-rails/version.rb
|
41
|
+
- parsley-payment-rails.gemspec
|
42
|
+
- update.sh
|
43
|
+
- vendor/assets/javascripts/parsley-payment.js
|
44
|
+
homepage: https://github.com/cmer/parsley-payment-rails
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.5.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Parsley-Payment.js bundled for Rails Asset Pipeline
|
68
|
+
test_files: []
|