solidus_conekta_card 1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1bd4bbcc46de05990f4b23e740bab754f60b6c084f6ded864f776db04ae8b65c
4
+ data.tar.gz: 0c08c78bb6ce13a2de98dd709ef7a1c72257a61fa3e5847b0eada3fc0cbe4a9e
5
+ SHA512:
6
+ metadata.gz: 1e1adfe0414afb5b68944eb77b659fdf03db136283ea8171e9013fdc811797e42e082d9f1d542aef40ce61a101a3ffba96aa8067fd3cf009db6c1c45d32e6dc8
7
+ data.tar.gz: 9270386d3cad28c86380b59108effbf7463bd17c8ea4247ca1bb37278a1916efda35ef152d277a79883ba8ef52b5afc4edb07c46ed1da6aa725743c69f9f5414
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2018 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ SolidusConektaCard
2
+ ==================
3
+
4
+ Solidus extension for processing credit card payments using Conekta API.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ Add solidus_conekta_card to your Gemfile:
10
+
11
+ ```ruby
12
+ gem 'solidus_conekta_card'
13
+ ```
14
+
15
+ Bundle your dependencies and run the installation generator:
16
+
17
+ ```shell
18
+ bundle
19
+ bundle exec rails g solidus_conekta_card:install
20
+ ```
21
+
22
+ Testing
23
+ -------
24
+
25
+ First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs, and [Rubocop](https://github.com/bbatsov/rubocop) static code analysis. The dummy app can be regenerated by using `rake test_app`.
26
+
27
+ ```shell
28
+ bundle
29
+ bundle exec rake
30
+ ```
31
+
32
+ When testing your applications integration with this extension you may use it's factories.
33
+ Simply add this require statement to your spec_helper:
34
+
35
+ ```ruby
36
+ require 'solidus_conekta_card/factories'
37
+ ```
38
+
39
+ Copyright (c) 2018 Magmalabs, released under the New BSD License
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ require 'spree/testing_support/common_rake'
8
+
9
+ RSpec::Core::RakeTask.new
10
+
11
+ task :default do
12
+ if Dir['spec/dummy'].empty?
13
+ Rake::Task[:test_app].invoke
14
+ Dir.chdir('../../')
15
+ end
16
+ Rake::Task[:spec].invoke
17
+ end
18
+
19
+ desc 'Generates a dummy app for testing'
20
+ task :test_app do
21
+ ENV['LIB_NAME'] = 'solidus_conekta_card'
22
+ Rake::Task['common:test_app'].invoke
23
+ end
@@ -0,0 +1,24 @@
1
+ $(document).ready(function() {
2
+ var conektaSuccessResponseHandler = function(token) {
3
+ var $form = $("#new_payment");
4
+ //Add the token_id in the form
5
+ $form.append($('<input type="hidden" name="conektaTokenId" id="conektaTokenId">').val(token.id));
6
+ $form.get(0).submit(); //Submit
7
+ };
8
+ var conektaErrorResponseHandler = function(response) {
9
+ var $form = $("#new_payment");
10
+ $form.find(".card-errors").text(response.message_to_purchaser);
11
+ $form.find("button").prop("disabled", false);
12
+ };
13
+
14
+ //jQuery generate the token on submit.
15
+ $(function () {
16
+ $("#new_payment").submit(function(event) {
17
+ var $form = $(this);
18
+ // Prevents double clic
19
+ $form.find("button").prop("disabled", true);
20
+ Conekta.Token.create($form, conektaSuccessResponseHandler, conektaErrorResponseHandler);
21
+ return false;
22
+ });
23
+ });
24
+ });