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 +4 -4
- data/lib/shoppe/paypal.rb +10 -11
- data/lib/shoppe/paypal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1abe7676170fb2270a84a179f2d1f6d04686d4d4
|
4
|
+
data.tar.gz: 6466edc49d10585513fc60df4eeb04543d2f181b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c10ff7b09c6a0209f61b753457eea7a91e42d9628c7fc7d950908231eb4058923a2eaaf6c109a2fcb2bd8e6d6b341b3167d3e992f899836a706feab096b67f2c
|
7
|
+
data.tar.gz: b47db73dc85024ba0d1803dcadf4ef3b8391cf843c6e84d5c172a1ed682c43afe22cb42a8b4e6eb82c791aaffb633fb3cb914fbb9e8bb31a26afc61a93a610d3
|
data/lib/shoppe/paypal.rb
CHANGED
@@ -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:
|
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
|
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.
|
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-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoppe
|