shoppe-paypal 1.2.1 → 1.2.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: a33cb06a9ad3857a382b1684c9b1be0ae24a278e
4
- data.tar.gz: 2e99557c36798258d7f197ff3d19475b45ee0f34
3
+ metadata.gz: 1abe7676170fb2270a84a179f2d1f6d04686d4d4
4
+ data.tar.gz: 6466edc49d10585513fc60df4eeb04543d2f181b
5
5
  SHA512:
6
- metadata.gz: 6c699cd83f4db247bc6d50e2c1be5a428510aae36fbcac25f04ba9d6737b06576620acbc22dc89ee1ff707c92c7c0c177d48f83e6a430e15de0bd228e8d632d9
7
- data.tar.gz: bc063e585c6fb72862088ff578546ff9783e1f95a80c0a6a2f9b70560be21aae5d6c2238cc8ad88faaa1faaca0fc3945f45a5a70f9f933a9d12fee65a53d7d04
6
+ metadata.gz: c10ff7b09c6a0209f61b753457eea7a91e42d9628c7fc7d950908231eb4058923a2eaaf6c109a2fcb2bd8e6d6b341b3167d3e992f899836a706feab096b67f2c
7
+ data.tar.gz: b47db73dc85024ba0d1803dcadf4ef3b8391cf843c6e84d5c172a1ed682c43afe22cb42a8b4e6eb82c791aaffb633fb3cb914fbb9e8bb31a26afc61a93a610d3
@@ -8,9 +8,7 @@ require 'shoppe/paypal/payment_extensions'
8
8
 
9
9
  module Shoppe
10
10
  module Paypal
11
-
12
11
  class << self
13
-
14
12
  def client_id
15
13
  Shoppe.settings.paypal_client_id
16
14
  end
@@ -22,10 +20,14 @@ module Shoppe
22
20
  def currency
23
21
  Shoppe.settings.paypal_currency
24
22
  end
25
-
23
+
24
+ def mode
25
+ Shoppe.settings.paypal_mode == 'live' ? 'live' : 'sandbox'
26
+ end
27
+
26
28
  def setup
27
29
  # Set the configuration
28
- Shoppe.add_settings_group :paypal, [:paypal_client_id, :paypal_client_secret, :paypal_currency]
30
+ Shoppe.add_settings_group :paypal, [:paypal_client_id, :paypal_client_secret, :paypal_currency, :paypal_mode]
29
31
 
30
32
  # When an order is accepted, attempt to capture/execute the payment
31
33
  Shoppe::Order.before_acceptance do
@@ -57,22 +59,20 @@ module Shoppe
57
59
  :currency => Shoppe::Paypal.currency,
58
60
  :total => "#{'%.2f' % self.refundable_amount}"}
59
61
  })
60
-
62
+
61
63
  # Check refund status
62
64
  if @refund.success?
63
65
  true
64
66
  else
65
- raise Shoppe::Errors::RefundFailed, message: "Unable to Refund"
67
+ raise Shoppe::Errors::RefundFailed, message: "Unable to Refund"
66
68
  logger.error "Unable to Refund"
67
69
  logger.error @refund.error.inspect
68
70
  end
69
71
  rescue
70
- raise Shoppe::Errors::RefundFailed, message: "PayPal Sale '#{self.reference}' Not Found"
71
-
72
+ raise Shoppe::Errors::RefundFailed, message: "PayPal Sale '#{self.reference}' Not Found"
72
73
  end
73
74
  end
74
75
  end
75
-
76
76
  end
77
77
 
78
78
  # Setup the PayPal configuration
@@ -80,12 +80,11 @@ module Shoppe
80
80
  include PayPal::SDK::REST
81
81
 
82
82
  PayPal::SDK.configure({
83
- mode: (Rails.env.production? ? "live" : "sandbox"),
83
+ mode: mode,
84
84
  client_id: client_id,
85
85
  client_secret: client_secret
86
86
  })
87
87
  end
88
-
89
88
  end
90
89
  end
91
90
  end
@@ -1,5 +1,5 @@
1
1
  module Shoppe
2
2
  module Paypal
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoppe-paypal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoppe