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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a50371cdb348785506ff61ef88aba02f119e99aa
4
- data.tar.gz: d84d2eb117fca72ff6f50ac299cadaa1f8585331
3
+ metadata.gz: f04d12b13e7fb2d4cd7e4e012215179974d4f1d1
4
+ data.tar.gz: af54b5283da0d7a5fabd00bf40f03512ffa7a5a3
5
5
  SHA512:
6
- metadata.gz: dfd06b69e27819ab06fc612695e0ac1967cf50566866a759f64eab4cb046c35776b5d37eb383ca06c00c7deccbc82a155cf57b5a4fd5a42a834d700e77b47b4b
7
- data.tar.gz: c34219a3a6436564f26910c22399807e45d4a7b3bba0babe851a2c6f9c4b8ab562b62c750794ebb762eca1ab074c6f27188498f7b640a7eb96e8f45196f37edf
6
+ metadata.gz: ebbfc7141e43cc3411282a94f53837cd4ac3e4f12347a6e8a5d9952dcc2613dffec006206a80ab1bd4e1469b4b1e34345fa806d0b3047fae965ab4713224be69
7
+ data.tar.gz: 503e3e9442897700820cec9817aab210426ff6abce81d7b03ca69b5d999a74dbdb28f7cf26981591ca07b716d602a4f6c52d28fc0c5e35242dc7925a905d640d
@@ -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
@@ -1,7 +1,7 @@
1
1
  module PayPal
2
2
  module SDK
3
3
  module REST
4
- VERSION = "1.4.2"
4
+ VERSION = "1.4.3"
5
5
  end
6
6
  end
7
7
  end
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.2
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-10 00:00:00.000000000 Z
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