shoppe-stripe 1.2.2 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 799dd0224374522c7ea870976b4208fc51e540b8
4
- data.tar.gz: 5c8c4f53d24a2fe44cb7dc5cde0fc62dfbd221b1
3
+ metadata.gz: 9f7c16c519990fac8b2345678f3f5d1cd417b2b7
4
+ data.tar.gz: 57731aa07f763950f3e70d02ec2e95b1cc20bc45
5
5
  SHA512:
6
- metadata.gz: 26c420bf9427401922b43130f3e7b9b91d6dddc4ff816326a74b8ec894b00deef40fec1e12da59e38110fc75aad763191d5b7464b7090075b1c09f1d87f1862a
7
- data.tar.gz: 90ff1d0645daa42a1e2bddc7f491d0fca935057f7f26b9d57d7a037c8358cb7d143c91acbe04057e970fc380f64354d9e86a7fc3bd915d16ba7c4cda882563d9
6
+ metadata.gz: 2b506aa879c0163669c54c4327ebf5fb5eb18967a1ace2aad3b354289b07ece257618720f14436413d8fb354c03737dfe5e99394c6d5800fd86e83febf366648
7
+ data.tar.gz: 9ef453f237e66317dd9d6888a87c1472ea4893fcebd1450158b4a5acee7345ee1fa4505d3ed7c48991169207610a079e4abba06c220e949cf5037fe4cc690d3a
data/README.md CHANGED
@@ -15,7 +15,7 @@ Shoppe store. If you have any questions, please just
15
15
  To install the Shoppe Stripe module, just add it to your Gemfile and run `bundle`.
16
16
 
17
17
  ```ruby
18
- gem 'shoppe-stripe', :require => 'shoppe/stripe'
18
+ gem "shoppe-stripe", require: "shoppe/stripe"
19
19
  ```
20
20
 
21
- For the latest up to date documentation, please see the [Shoppe tutorial page](http://tryshoppe.com/docs/tutorials/payment-gateways).
21
+ For the latest up to date documentation, please see the [Shoppe tutorial page](http://tryshoppe.com/docs/payment-gateways/stripe).
@@ -10,11 +10,11 @@ module Shoppe
10
10
  class << self
11
11
 
12
12
  def api_key
13
- Shoppe.settings.stripe_api_key
13
+ ENV["STRIPE_API_KEY"] || Shoppe.settings.stripe_api_key
14
14
  end
15
15
 
16
16
  def publishable_key
17
- Shoppe.settings.stripe_publishable_key
17
+ ENV["STRIPE_PUBLISHABLE_KEY"] || Shoppe.settings.stripe_publishable_key
18
18
  end
19
19
 
20
20
  def setup
@@ -26,9 +26,9 @@ module Shoppe
26
26
 
27
27
  # When an order is confirmed, attempt to authorise the payment
28
28
  Shoppe::Order.before_confirmation do
29
- if self.properties['stripe_customer_token']
29
+ if self.properties['stripe_customer_token'] && self.total > 0.0
30
30
  begin
31
- charge = ::Stripe::Charge.create({:customer => self.properties['stripe_customer_token'], :amount => (self.total * BigDecimal(100)).round, :currency => Shoppe.settings.stripe_currency, :capture => false}, Shoppe.settings.stripe_api_key)
31
+ charge = ::Stripe::Charge.create({:customer => self.properties['stripe_customer_token'], :amount => (self.total * BigDecimal(100)).round, :currency => Shoppe.settings.stripe_currency, :capture => false}, Shoppe::Stripe.api_key)
32
32
  self.payments.create(:amount => self.total, :method => 'Stripe', :reference => charge.id, :refundable => true, :confirmed => false)
33
33
  rescue ::Stripe::CardError
34
34
  raise Shoppe::Errors::PaymentDeclined, "Payment was declined by the payment processor."
@@ -4,7 +4,7 @@ module Shoppe
4
4
 
5
5
  def accept_stripe_token(token)
6
6
  if token =~ /\Atok/
7
- customer = ::Stripe::Customer.create({:description => "Customer for order #{number}", :card => token}, Shoppe.settings.stripe_api_key)
7
+ customer = ::Stripe::Customer.create({:description => "Customer for order #{number}", :card => token}, Shoppe::Stripe.api_key)
8
8
  self.properties['stripe_customer_token'] = customer.id
9
9
  self.save
10
10
  elsif token =~ /\Acus/ && self.properties[:stripe_customer_token] != token
@@ -20,7 +20,7 @@ module Shoppe
20
20
  private
21
21
 
22
22
  def stripe_customer
23
- @stripe_customer ||= ::Stripe::Customer.retrieve(self.properties['stripe_customer_token'], Shoppe.settings.stripe_api_key)
23
+ @stripe_customer ||= ::Stripe::Customer.retrieve(self.properties['stripe_customer_token'], Shoppe::Stripe.api_key)
24
24
  end
25
25
 
26
26
  def stripe_card
@@ -4,7 +4,7 @@ module Shoppe
4
4
 
5
5
  def stripe_charge
6
6
  return false unless self.method == 'Stripe'
7
- @stripe_charge ||= ::Stripe::Charge.retrieve(self.reference, Shoppe.settings.stripe_api_key)
7
+ @stripe_charge ||= ::Stripe::Charge.retrieve(self.reference, Shoppe::Stripe.api_key)
8
8
  end
9
9
 
10
10
  def transaction_url
@@ -1,5 +1,5 @@
1
1
  module Shoppe
2
2
  module Stripe
3
- VERSION = '1.2.2'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ $ ->
5
5
 
6
6
  # Build a hash of params which will be sent to Stripe
7
7
  stripeCardParams = {}
8
- $.each ['number', 'exp_month', 'exp_year', 'cvc', 'name', 'address_line1', 'address_line2', 'address_city', 'address_state', 'address_zip', 'address_country'], (i,f)->
8
+ $.each ['number', 'exp-month', 'exp-year', 'cvc', 'name', 'address_line1', 'address_line2', 'address_city', 'address_state', 'address_zip', 'address_country'], (i,f)->
9
9
  stripeCardParams[f] = $("[data-stripe='#{f}']").val()
10
10
 
11
11
  # Send the data to Stripe and define a method to be executed when the response
@@ -20,4 +20,4 @@ $ ->
20
20
  form.get(0).submit()
21
21
 
22
22
  # Return false to ensure that the form doesn't submit on first click
23
- false
23
+ false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoppe-stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2016-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoppe
@@ -78,7 +78,8 @@ files:
78
78
  homepage: http://tryshoppe.com
79
79
  licenses: []
80
80
  metadata: {}
81
- post_install_message:
81
+ post_install_message: Since v1.3.0, the params for exp_month & exp_year have changed
82
+ - https://git.io/vgl3c
82
83
  rdoc_options: []
83
84
  require_paths:
84
85
  - lib
@@ -94,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  requirements: []
96
97
  rubyforge_project:
97
- rubygems_version: 2.2.2
98
+ rubygems_version: 2.5.1
98
99
  signing_key:
99
100
  specification_version: 4
100
101
  summary: A Stripe module for Shoppe.
101
102
  test_files: []
102
- has_rdoc: