paypal-sdk-rest 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paypal-sdk/core/api.rb +3 -0
- data/lib/paypal-sdk/core/api/ipn.rb +66 -0
- data/lib/paypal-sdk/core/config.rb +7 -1
- data/lib/paypal-sdk/rest/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04d12b13e7fb2d4cd7e4e012215179974d4f1d1
|
4
|
+
data.tar.gz: af54b5283da0d7a5fabd00bf40f03512ffa7a5a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebbfc7141e43cc3411282a94f53837cd4ac3e4f12347a6e8a5d9952dcc2613dffec006206a80ab1bd4e1469b4b1e34345fa806d0b3047fae965ab4713224be69
|
7
|
+
data.tar.gz: 503e3e9442897700820cec9817aab210426ff6abce81d7b03ca69b5d999a74dbdb28f7cf26981591ca07b716d602a4f6c52d28fc0c5e35242dc7925a905d640d
|
data/lib/paypal-sdk/core/api.rb
CHANGED
@@ -3,7 +3,10 @@ module PayPal
|
|
3
3
|
module Core
|
4
4
|
module API
|
5
5
|
autoload :Base, "paypal-sdk/core/api/base"
|
6
|
+
autoload :Merchant, "paypal-sdk/core/api/merchant"
|
7
|
+
autoload :Platform, "paypal-sdk/core/api/platform"
|
6
8
|
autoload :REST, "paypal-sdk/core/api/rest"
|
9
|
+
autoload :IPN, "paypal-sdk/core/api/ipn"
|
7
10
|
|
8
11
|
module DataTypes
|
9
12
|
autoload :Base, "paypal-sdk/core/api/data_types/base"
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module PayPal
|
2
|
+
module SDK
|
3
|
+
module Core
|
4
|
+
module API
|
5
|
+
module IPN
|
6
|
+
|
7
|
+
END_POINTS = {
|
8
|
+
:sandbox => "https://www.sandbox.paypal.com/cgi-bin/webscr",
|
9
|
+
:live => "https://ipnpb.paypal.com/cgi-bin/webscr"
|
10
|
+
}
|
11
|
+
VERIFIED = "VERIFIED"
|
12
|
+
INVALID = "INVALID"
|
13
|
+
|
14
|
+
class Message
|
15
|
+
include Util::HTTPHelper
|
16
|
+
|
17
|
+
attr_accessor :message
|
18
|
+
|
19
|
+
def initialize(message, env = nil, options = {})
|
20
|
+
@message = message
|
21
|
+
set_config(env, options)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Fetch end point
|
25
|
+
def ipn_endpoint
|
26
|
+
config.ipn_endpoint || default_ipn_endpoint
|
27
|
+
end
|
28
|
+
|
29
|
+
# Default IPN end point
|
30
|
+
def default_ipn_endpoint
|
31
|
+
endpoint = END_POINTS[(config.mode || :sandbox).to_sym] rescue nil
|
32
|
+
endpoint || END_POINTS[:sandbox]
|
33
|
+
end
|
34
|
+
|
35
|
+
# Request IPN service for validating the content
|
36
|
+
# === Return
|
37
|
+
# return http response object
|
38
|
+
def request
|
39
|
+
uri = URI(ipn_endpoint)
|
40
|
+
query_string = "cmd=_notify-validate&#{message}"
|
41
|
+
http_call(:method => :post, :uri => uri, :body => query_string)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Validate the given content
|
45
|
+
# === Return
|
46
|
+
# return true or false
|
47
|
+
def valid?
|
48
|
+
request.body == VERIFIED
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class << self
|
53
|
+
def valid?(*args)
|
54
|
+
Message.new(*args).valid?
|
55
|
+
end
|
56
|
+
|
57
|
+
def request(*args)
|
58
|
+
Message.new(*args).request
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -72,13 +72,19 @@ module PayPal::SDK::Core
|
|
72
72
|
:token, :token_secret, :subject,
|
73
73
|
:http_timeout, :http_proxy,
|
74
74
|
:device_ipaddress, :sandbox_email_address,
|
75
|
-
:mode, :endpoint,
|
75
|
+
:mode, :endpoint, :merchant_endpoint, :platform_endpoint, :ipn_endpoint,
|
76
76
|
:rest_endpoint, :rest_token_endpoint, :client_id, :client_secret,
|
77
77
|
:openid_endpoint, :openid_redirect_uri, :openid_client_id, :openid_client_secret,
|
78
78
|
:verbose_logging
|
79
79
|
|
80
80
|
alias_method :end_point=, :endpoint=
|
81
81
|
alias_method :end_point, :endpoint
|
82
|
+
alias_method :platform_end_point=, :platform_endpoint=
|
83
|
+
alias_method :platform_end_point, :platform_endpoint
|
84
|
+
alias_method :merchant_end_point=, :merchant_endpoint=
|
85
|
+
alias_method :merchant_end_point, :merchant_endpoint
|
86
|
+
alias_method :ipn_end_point=, :ipn_endpoint=
|
87
|
+
alias_method :ipn_end_point, :ipn_endpoint
|
82
88
|
alias_method :rest_end_point, :rest_endpoint
|
83
89
|
alias_method :rest_end_point=, :rest_endpoint=
|
84
90
|
alias_method :rest_token_end_point, :rest_token_endpoint
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal-sdk-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PayPal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/paypal-sdk/core/api/data_types/base.rb
|
93
93
|
- lib/paypal-sdk/core/api/data_types/enum.rb
|
94
94
|
- lib/paypal-sdk/core/api/data_types/simple_types.rb
|
95
|
+
- lib/paypal-sdk/core/api/ipn.rb
|
95
96
|
- lib/paypal-sdk/core/api/rest.rb
|
96
97
|
- lib/paypal-sdk/core/authentication.rb
|
97
98
|
- lib/paypal-sdk/core/config.rb
|