solidus_gateway_checkout_v2 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4553466121a1142278574daa84f17c3b9e2b35c
4
- data.tar.gz: d843f8152afe2d8fe4de2a5fbd7c95ccb91ad122
3
+ metadata.gz: 899816cdb1e5deeba7742b33b3e002b8b1a88ce0
4
+ data.tar.gz: ac2b6bb60beb93c96d34ff43e89fdbb4db36a7df
5
5
  SHA512:
6
- metadata.gz: 4322ff8f704df7d0d735331aa68c511013d97875f5e8be9778630bbf7ff40e3b4d7990900dd0eaea929ecf684550840066722099f18a81b1398b0c60316a8be2
7
- data.tar.gz: d738d9ce3b724bfcb71dc3403661e82ffdf2a70b4cf967c588fd86eab5b5cffe8fe1f2d7ff7dbb16215bce098d214d59b3d81d7ebeebf3f1807e690d9f5d9488
6
+ metadata.gz: e7306a9b8415501fcf247569643a59fda745ebdb172ae2f1d84626fbf2c13b62c987bf779720d71b8714eddc16d870045c9dc258449edaa48a83896a600ffcce
7
+ data.tar.gz: 0e8e34bddafe5e72fbe8ed775e494e58c7ff9df10c0276efda96b2a7372e37916985ab5ee9f9f68d983ad0b441609c923d4eaafcdc13b1029da30fc69c181ee6
@@ -4,6 +4,7 @@
4
4
  <!-- Using Card Tokenisation For Checkout V2 Gateway -->
5
5
  <script type="text/javascript" src="https://<%= payment_method.preferences[:test_mode] ? 'sandbox.checkout.com/js/v1/checkoutkit.js' : 'cdn.checkout.com/js/checkoutkit.js' %>"></script>
6
6
  <script type="text/javascript">
7
+
7
8
  // Payment Method Element & Id
8
9
  Spree.checkoutV2PaymentMethod = $('#payment_method_' + <%= payment_method.id %>);
9
10
  Spree.checkoutV2PaymentMethodId = Spree.checkoutV2PaymentMethod.prop('id').split("_")[2];
@@ -32,12 +33,16 @@
32
33
  Spree.checkoutV2PaymentMethod.find('#card_number, #card_expiry, #card_code').prop("disabled", true);
33
34
  // Enable Name Input
34
35
  Spree.checkoutV2PaymentMethod.find('#name_on_card_'+Spree.checkoutV2PaymentMethodId).prop("disabled", false);
35
- // Create Hidden Inputs With Data From API
36
+ // Create Hidden Inputs With Data Validated By The API
37
+ var last_4_digits, expiration, payment_method;
38
+ last_4_digits = $('.cardNumber:visible').val().slice(-4);
39
+ expiration = $('.cardExpiry:visible').payment('cardExpiryVal');
40
+ payment_method = 'card token';
36
41
  Spree.checkoutV2PaymentMethod.append("<input type='hidden' id='checkout_v2_token' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][gateway_payment_profile_id]' value='" + response.id + "'/>");
37
- Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][paymentMethod]' value='" + response.card.paymentMethod + "'/>");
38
- Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][last_digits]' value='" + response.card.last4 + "'/>");
39
- Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][month]' value='" + response.card.expiryMonth + "'/>");
40
- Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][year]' value='" + response.card.expiryYear + "'/>");
42
+ Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][paymentMethod]' value='" + payment_method + "'/>");
43
+ Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][last_digits]' value='" + last_4_digits + "'/>");
44
+ Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][month]' value='" + expiration.month + "'/>");
45
+ Spree.checkoutV2PaymentMethod.append("<input type='hidden' name='payment_source[" + Spree.checkoutV2PaymentMethodId + "][year]' value='" + expiration.year + "'/>");
41
46
  // Submit
42
47
  return Spree.checkoutV2PaymentMethod.parents("form").trigger('submit');
43
48
  };
@@ -72,7 +77,7 @@
72
77
  CheckoutKit.createCardToken(card, function(response){
73
78
  // If response has a card and id and not of type error, call the response handler.
74
79
  // If it is an error, the added error handler above will pick it up
75
- if (('id' in response) && ('card' in response) && !(response.type == 'error')) {
80
+ if (('id' in response) && !(response.type == 'error')) {
76
81
  checkoutV2ResponseHandler(response);
77
82
  }
78
83
  });
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = "solidus_gateway_checkout_v2"
6
- s.version = "1.0.1"
6
+ s.version = "1.0.2"
7
7
  s.summary = "Checkout V2 Payment Gateway for Solidus"
8
8
  s.description = s.summary
9
9
  s.required_ruby_version = ">= 2.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_gateway_checkout_v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Whelton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-20 00:00:00.000000000 Z
11
+ date: 2016-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
195
  - none
196
196
  rubyforge_project:
197
- rubygems_version: 2.4.5
197
+ rubygems_version: 2.4.8
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: Checkout V2 Payment Gateway for Solidus