paypal-sdk-buttonmanager 1.98.1 → 1.98.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTVkOWUwM2FhNjU0M2JiM2NmYTRhYTgyZDNkNGU3MDc5MzUwYmY5Zg==
4
+ NmZmMjE1NjhlOGY0NzIyNzkzYmYzNzllYzZiZGI4YTllOTc2Yjc1Mw==
5
5
  data.tar.gz: !binary |-
6
- MDdhNjk2Mjc3MzZlZGE5MmI3ZjEwZTVjMGQwYTkyY2ExOWQxMmVhMA==
6
+ YzExNzA5N2Y1MGIwMzE1MzYyMDQ2YWQzNTEyMTcwMmI4ZDRlMGQ4YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2VjZDgxZjIxNzQ2MDRkN2VkM2M1MGQ1N2JjYjkzODk2MDE1NzNiY2ZlNzNl
10
- MmYzNzBiYjE1Mzk3NjA1MmRhNDk2ZTE3YWI5ZmU3ZjQ1NzU0MWU2YzM5YzY0
11
- MjI2MDMxMGY4MzViZjdkMDg4MmUxZGM3MTVhMGIxMGY5ZTlmOTc=
9
+ YWJjMTAzMTE4ODQzMWZiZTk4NWQ4M2JhOWVmOGI1YzFmYjZhNzA0Mjk5NzUy
10
+ MTIyZjZiYTAyODFiNjRhNjA5YzBkNjMyN2YxNDY3ZGY0Mjg3OTc4NTA1YTdj
11
+ Yjc1YzYwOWJmYWI4ZjZjM2EwMjU4YjExN2E5NWVjODMxYjE4Y2M=
12
12
  data.tar.gz: !binary |-
13
- YWM5NDFiMDQ3NTJlMzlkZTcwN2JlZGRhYWZhNGIxOGU3ZGVhMTc5Y2M0Njhm
14
- ZGIyNTFmN2NmMTRkYmVmYjQxN2YxMmVkMWExMDQ5MGI3MTI5YTcwOGQwNWJm
15
- MDBkYzg4ZmQwNDBkMTRjNzg3NmU0N2JlMDBmNWM5YjBhYTAyYTc=
13
+ NGMzYTUxYTQ1MzdhYzgyN2IxNzA3OTA4NTk1ZDQ2NTNjN2M2ZDQ5MTY0MGU5
14
+ YjgxM2YzZjVlM2I5NjhjMjYzNTYyNjUxMDA0M2FkZGY0ODkwNDY1ZDIwODQ4
15
+ MDIwOThlNTVjMDhjOTdiODg2MzJiMDI3MzgxOTQyMjgwMzhhN2E=
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ if File.exist? File.expand_path('../samples/button_manager_samples.gemspec', __F
8
8
  gem 'button_manager_samples', :path => 'samples', :require => false
9
9
  group :test do
10
10
  gem 'rspec-rails', :require => false
11
- gem 'capybara', :require => false
11
+ gem 'capybara', '~> 2.0.3', :require => false
12
12
  end
13
13
  end
14
14
 
data/README.md CHANGED
@@ -6,118 +6,62 @@ The PayPal Button Manager SDK provides Ruby APIs to create, and manage PayPal Pa
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'paypal-sdk-buttonmanager'
9
+ ```ruby
10
+ gem 'paypal-sdk-buttonmanager'
11
+ ```
10
12
 
11
13
  And then execute:
12
14
 
13
- $ bundle
15
+ ```sh
16
+ $ bundle
17
+ ```
14
18
 
15
19
  Or install it yourself as:
16
20
 
17
- $ gem install paypal-sdk-buttonmanager
21
+ ```sh
22
+ $ gem install paypal-sdk-buttonmanager
23
+ ```
18
24
 
19
25
  ## Configuration
20
26
 
21
27
  For Rails application:
22
28
 
23
- rails g paypal:sdk:install
29
+ ```sh
30
+ rails g paypal:sdk:install
31
+ ```
24
32
 
25
33
  For other ruby application, create a configuration file(`config/paypal.yml`):
26
34
 
27
- development: &default
28
- username: jb-us-seller_api1.paypal.com
29
- password: WX4WTU3S8MY44S7F
30
- signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
31
- app_id: APP-80W284485P519543T
32
- http_timeout: 30
33
- mode: sandbox
34
- sandbox_email_address: Platform.sdk.seller@gmail.com
35
- # # with certificate
36
- # cert_path: "config/cert_key.pem"
37
- # # with token authentication
38
- # token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
39
- # token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
40
- # # with Proxy
41
- # http_proxy: http://proxy-ipaddress:3129/
42
- # # with device ip address
43
- # device_ipaddress: "127.0.0.1"
44
- test:
45
- <<: *default
46
- production:
47
- <<: *default
48
- mode: live
35
+ ```yaml
36
+ development: &default
37
+ username: jb-us-seller_api1.paypal.com
38
+ password: WX4WTU3S8MY44S7F
39
+ signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
40
+ app_id: APP-80W284485P519543T
41
+ http_timeout: 30
42
+ mode: sandbox
43
+ sandbox_email_address: Platform.sdk.seller@gmail.com
44
+ # # with certificate
45
+ # cert_path: "config/cert_key.pem"
46
+ # # with token authentication
47
+ # token: ESTy2hio5WJQo1iixkH29I53RJxaS0Gvno1A6.YQXZgktxbY4I2Tdg
48
+ # token_secret: ZKPhUYuwJwYsfWdzorozWO2U9pI
49
+ # # with Proxy
50
+ # http_proxy: http://proxy-ipaddress:3129/
51
+ # # with device ip address
52
+ # device_ipaddress: "127.0.0.1"
53
+ test:
54
+ <<: *default
55
+ production:
56
+ <<: *default
57
+ mode: live
58
+ ```
49
59
 
50
60
  Load Configurations from specified file:
51
61
 
52
- PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
53
-
54
- ## Create API object
55
-
56
- Create API object:
57
-
58
- api = PayPal::SDK::ButtonManager::API.new
59
-
60
- Override configuration while creating a object:
61
-
62
- api = PayPal::SDK::ButtonManager::API.new(:development)
63
- api = PayPal::SDK::ButtonManager::API.new(:development, :app_id => "XYZ")
64
- api = PayPal::SDK::ButtonManager::API.new(:app_id => "XYZ") # Take default environment.
65
-
66
- Change configuration:
67
-
68
- api.set_config :testing
69
- api.set_config :testing, app_id => "XYZ"
70
-
71
-
72
- ## Build Request Object
73
-
74
- To make api request, we need to build a request object.
75
-
76
- # To build a empty request object
77
- bm_create_button_request = api.build_bm_create_button()
78
-
79
- # To build a request object with default data
80
- bm_create_button_request = api.build_bm_create_button( :ButtonType => "BUYNOW", :ButtonCode => "HOSTED" )
81
-
82
- # To build a request object with block
83
- bm_create_button_request = api.build_bm_create_button do
84
- self.ButtonType = "BUYNOW"
85
- self.ButtonCode = "HOSTED"
86
- end
87
-
88
- The Build method can be access with camelcase or underscore:
89
-
90
- api = api.build_bm_create_button()
91
- # (or)
92
- api = api.BuildBMCreateButton()
93
-
94
- ## Assign value to members
95
-
96
- Members can be access with camelcase or underscore format.
97
-
98
- bm_create_button_request.ButtonType = "BUYNOW"
99
- # With underscore
100
- bm_create_button_request.button_type = "BUYNOW"
101
-
102
- To Get members list for the given object( For Reference ):
103
-
104
- bm_create_button_request.members
105
-
106
- ## Make API Request
107
-
108
- Make api call with request object:
109
-
110
- bm_create_button_response = api.bm_create_button(bm_create_button_request)
111
-
112
- Make api call with hash:
113
-
114
- bm_create_button_response = api.bm_create_button( :ButtonType => "BUYNOW", :ButtonCode => "HOSTED" )
115
-
116
- ## Access values from response object
117
-
118
- To get response status:
119
-
120
- bm_create_button_response.ack
62
+ ```ruby
63
+ PayPal::SDK::Core::Config.load('config/paypal.yml', ENV['RACK_ENV'] || 'development')
64
+ ```
121
65
 
122
66
  ## Example
123
67
 
@@ -140,30 +84,37 @@ require 'paypal-sdk-buttonmanager'
140
84
  @bm_create_button_response = @api.bm_create_button(@bm_create_button)
141
85
 
142
86
  # Access Response
143
- @bm_create_button_response.Timestamp
144
- @bm_create_button_response.Ack
145
- @bm_create_button_response.CorrelationID
146
- @bm_create_button_response.Version
147
- @bm_create_button_response.Build
148
- @bm_create_button_response.Website
149
- @bm_create_button_response.Email
150
- @bm_create_button_response.HostedButtonID
87
+ if @bm_create_button_response.success?
88
+ @bm_create_button_response.Website
89
+ @bm_create_button_response.Email
90
+ @bm_create_button_response.HostedButtonID
91
+ else
92
+ @bm_create_button_response.Errors
93
+ end
151
94
  ```
152
95
 
153
- ## Samples
96
+ For more samples [paypal-sdk-samples.herokuapp.com/button_manager/](https://paypal-sdk-samples.herokuapp.com/button_manager/)
97
+
98
+ ## Samples App
154
99
 
155
100
  Add following line in rails `Gemfile`:
156
101
 
157
- gem 'paypal-sdk-buttonmanager'
158
- gem 'button_manager_samples', :git => "https://github.com/paypal/buttonmanager-sdk-ruby.git", :group => :development
102
+ ```ruby
103
+ gem 'paypal-sdk-buttonmanager'
104
+ gem 'button_manager_samples', :git => "https://github.com/paypal/buttonmanager-sdk-ruby.git", :group => :development
105
+ ```
159
106
 
160
107
  Configure routes(`config/routes.rb`):
161
108
 
162
- mount ButtonManagerSamples::Engine => "/samples" if Rails.env.development?
109
+ ```ruby
110
+ mount ButtonManagerSamples::Engine => "/samples" if Rails.env.development?
111
+ ```
163
112
 
164
113
  To get default paypal configuration execute:
165
114
 
166
- rails g paypal:sdk:install
115
+ ```sh
116
+ rails g paypal:sdk:install
117
+ ```
167
118
 
168
119
  Run `rails server` and check the samples.
169
120
 
@@ -14,6 +14,11 @@ module PayPal
14
14
  def default_http_header
15
15
  super.merge(ADAPTIVE_PAYMENTS_HTTP_HEADER)
16
16
  end
17
+
18
+ # Validate IPN message
19
+ def ipn_valid?(raw_post_data)
20
+ Core::API::IPN.valid?(raw_post_data, config)
21
+ end
17
22
  end
18
23
  end
19
24
  end
@@ -14,6 +14,22 @@ module PayPal::SDK
14
14
  end
15
15
  end
16
16
 
17
+ module ResponseStatus
18
+ Status = { :success => ["Success", "SuccessWithWarning"],
19
+ :warning => ["Warning", "SuccessWithWarning", "FailureWithWarning"],
20
+ :failure => ["Failure", "FailureWithWarning"] }
21
+
22
+ def response_status
23
+ self.Ack
24
+ end
25
+
26
+ Status.keys.each do |status|
27
+ define_method("#{status}?") do
28
+ Status[status].include?(self.response_status)
29
+ end
30
+ end
31
+ end
32
+
17
33
  class EnumType < Core::API::DataTypes::Enum
18
34
  end
19
35
 
@@ -634,6 +650,7 @@ module PayPal::SDK
634
650
  def self.load_members
635
651
  # This value represents the date and time (GMT) when the response was generated by a service provider (as a result of processing of a request).
636
652
  object_of :Timestamp, DateTime, :namespace => :ebl
653
+ include ResponseStatus
637
654
  # Application level acknowledgement code.
638
655
  object_of :Ack, AckCodeType, :namespace => :ebl
639
656
  # CorrelationID may be used optionally with an application level acknowledgement.
@@ -1,7 +1,7 @@
1
1
  module PayPal
2
2
  module SDK
3
3
  module ButtonManager
4
- VERSION = "1.98.1"
4
+ VERSION = "1.98.2"
5
5
  end
6
6
  end
7
7
  end
@@ -3,25 +3,20 @@ require 'spec_helper'
3
3
  describe "ButtonManager" do
4
4
 
5
5
  before :all do
6
- @client = PayPal::SDK::ButtonManager::API.new
6
+ @api = PayPal::SDK::ButtonManager::API.new
7
7
  end
8
8
 
9
9
  describe "Services" do
10
10
  PayPal::SDK::ButtonManager::Services.instance_methods.select{|s| s =~ /^[A-Z]/ and s !~ /^Build/ }.each do |service_method|
11
11
  it "make empty request to #{service_method}" do
12
- response = @client.send(service_method, {})
12
+ response = @api.send(service_method, {})
13
13
  response.ack.should_not be_nil
14
14
  end
15
15
  end
16
16
  end
17
17
 
18
- describe "DataTypes" do
19
- PayPal::SDK::ButtonManager::DataTypes.constants.each do |const_name|
20
- it "create object for #{const_name}" do
21
- klass = PayPal::SDK::ButtonManager::DataTypes.const_get(const_name)
22
- klass.new.should be_a klass
23
- end
24
- end
18
+ it "Validate ipn message" do
19
+ @api.ipn_valid?("Invalid").should be_false
25
20
  end
26
21
 
27
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-sdk-buttonmanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.98.1
4
+ version: 1.98.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - PayPal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-12 00:00:00.000000000 Z
11
+ date: 2013-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paypal-sdk-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.2.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0
26
+ version: 0.2.3
27
27
  description: The PayPal Button Manager SDK provides Ruby APIs to create, and manage
28
28
  PayPal Payments Standard buttons programmatically.
29
29
  email: