paypal-sdk-rest 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +44 -0
  4. data/lib/generators/paypal/sdk/USAGE +3 -0
  5. data/lib/generators/paypal/sdk/install_generator.rb +17 -0
  6. data/lib/generators/paypal/sdk/templates/paypal.rb +2 -0
  7. data/lib/generators/paypal/sdk/templates/paypal.yml +31 -0
  8. data/lib/paypal-sdk-core.rb +38 -0
  9. data/lib/paypal-sdk/core/api.rb +20 -0
  10. data/lib/paypal-sdk/core/api/base.rb +162 -0
  11. data/lib/paypal-sdk/core/api/data_types/array_with_block.rb +44 -0
  12. data/lib/paypal-sdk/core/api/data_types/base.rb +224 -0
  13. data/lib/paypal-sdk/core/api/data_types/enum.rb +26 -0
  14. data/lib/paypal-sdk/core/api/data_types/simple_types.rb +52 -0
  15. data/lib/paypal-sdk/core/api/ipn.rb +66 -0
  16. data/lib/paypal-sdk/core/api/rest.rb +163 -0
  17. data/lib/paypal-sdk/core/authentication.rb +66 -0
  18. data/lib/paypal-sdk/core/config.rb +249 -0
  19. data/lib/paypal-sdk/core/credential.rb +16 -0
  20. data/lib/paypal-sdk/core/credential/base.rb +27 -0
  21. data/lib/paypal-sdk/core/credential/certificate.rb +32 -0
  22. data/lib/paypal-sdk/core/credential/signature.rb +22 -0
  23. data/lib/paypal-sdk/core/credential/third_party/subject.rb +25 -0
  24. data/lib/paypal-sdk/core/credential/third_party/token.rb +39 -0
  25. data/lib/paypal-sdk/core/exceptions.rb +96 -0
  26. data/lib/paypal-sdk/core/logging.rb +45 -0
  27. data/lib/paypal-sdk/core/openid_connect.rb +122 -0
  28. data/lib/paypal-sdk/core/openid_connect/api.rb +49 -0
  29. data/lib/paypal-sdk/core/openid_connect/data_types.rb +73 -0
  30. data/lib/paypal-sdk/core/openid_connect/get_api.rb +28 -0
  31. data/lib/paypal-sdk/core/openid_connect/request_data_type.rb +52 -0
  32. data/lib/paypal-sdk/core/openid_connect/set_api.rb +36 -0
  33. data/lib/paypal-sdk/core/util.rb +11 -0
  34. data/lib/paypal-sdk/core/util/http_helper.rb +159 -0
  35. data/lib/paypal-sdk/core/util/oauth_signature.rb +64 -0
  36. data/lib/paypal-sdk/core/util/ordered_hash.rb +165 -0
  37. data/lib/paypal-sdk/rest/data_types.rb +1 -0
  38. data/lib/paypal-sdk/rest/version.rb +1 -1
  39. data/spec/config/paypal.yml +27 -0
  40. data/spec/config/sample_data.yml +3 -0
  41. data/spec/core/api/data_type_spec.rb +189 -0
  42. data/spec/core/api/rest_spec.rb +147 -0
  43. data/spec/core/config_spec.rb +192 -0
  44. data/spec/core/logging_spec.rb +28 -0
  45. data/spec/core/openid_connect_spec.rb +144 -0
  46. data/spec/log/http.log +71 -32
  47. data/spec/log/rest_http.log +133 -0
  48. data/spec/spec_helper.rb +7 -0
  49. data/spec/support/sample_data.rb +5 -0
  50. metadata +82 -5
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ describe PayPal::SDK::Core::Logging do
5
+ Logging = PayPal::SDK::Core::Logging
6
+
7
+ class TestLogging
8
+ include Logging
9
+ end
10
+
11
+ before :each do
12
+ @logger_file = StringIO.new
13
+ Logging.logger = Logger.new(@logger_file)
14
+ @test_logging = TestLogging.new
15
+ end
16
+
17
+ it "get logger object" do
18
+ @test_logging.logger.should be_a Logger
19
+ end
20
+
21
+ it "write message to logger" do
22
+ test_message = "Example log message!!!"
23
+ @test_logging.logger.info(test_message)
24
+ @logger_file.rewind
25
+ @logger_file.read.should match test_message
26
+ end
27
+
28
+ end
@@ -0,0 +1,144 @@
1
+ require 'spec_helper'
2
+
3
+ describe PayPal::SDK::OpenIDConnect do
4
+ OpenIDConnect = PayPal::SDK::OpenIDConnect
5
+
6
+ before :all do
7
+ OpenIDConnect.set_config( :client_id => "client_id", :openid_redirect_uri => "http://google.com" )
8
+ end
9
+
10
+ it "Validate user_agent" do
11
+ OpenIDConnect::API.user_agent.should match "PayPalSDK/openid-connect-ruby"
12
+ end
13
+
14
+ describe "generate_authorize_url" do
15
+
16
+ it "generate autorize_url" do
17
+ url = OpenIDConnect::Tokeninfo.authorize_url
18
+ url.should match "client_id=client_id"
19
+ url.should match Regexp.escape("redirect_uri=#{CGI.escape("http://google.com")}")
20
+ url.should match "scope=openid"
21
+ end
22
+
23
+ describe "sandbox" do
24
+ before do
25
+ PayPal::SDK.configure(:mode => "sandbox")
26
+ end
27
+
28
+ it "generates a sandbox authorize url" do
29
+ url = OpenIDConnect::Tokeninfo.authorize_url
30
+ url.should match "sandbox.paypal.com"
31
+ end
32
+ end
33
+ end
34
+
35
+ it "Override authorize_url params" do
36
+ url = OpenIDConnect.authorize_url(
37
+ :client_id => "new_client_id",
38
+ :redirect_uri => "http://example.com",
39
+ :scope => "openid profile")
40
+ url.should match "client_id=new_client_id"
41
+ url.should match Regexp.escape("redirect_uri=#{CGI.escape("http://example.com")}")
42
+ url.should match Regexp.escape("scope=#{CGI.escape("openid profile")}")
43
+ end
44
+
45
+ it "Generate logout_url" do
46
+ url = OpenIDConnect.logout_url
47
+ url.should match "logout=true"
48
+ url.should match Regexp.escape("redirect_uri=#{CGI.escape("http://google.com")}")
49
+ url.should_not match "id_token"
50
+ end
51
+
52
+ it "Override logout_url params" do
53
+ url = OpenIDConnect.logout_url({
54
+ :redirect_uri => "http://example.com",
55
+ :id_token => "testing" })
56
+ url.should match Regexp.escape("redirect_uri=#{CGI.escape("http://example.com")}")
57
+ url.should match "id_token=testing"
58
+ end
59
+
60
+ describe "Validation" do
61
+ it "Create token" do
62
+ lambda{
63
+ tokeninfo = OpenIDConnect::Tokeninfo.create("invalid-autorize-code")
64
+ }.should raise_error PayPal::SDK::Core::Exceptions::BadRequest
65
+ end
66
+
67
+ it "Refresh token" do
68
+ lambda{
69
+ tokeninfo = OpenIDConnect::Tokeninfo.refresh("invalid-refresh-token")
70
+ }.should raise_error PayPal::SDK::Core::Exceptions::BadRequest
71
+ end
72
+
73
+ it "Get userinfo" do
74
+ lambda{
75
+ userinfo = OpenIDConnect::Userinfo.get("invalid-access-token")
76
+ }.should raise_error PayPal::SDK::Core::Exceptions::UnauthorizedAccess
77
+ end
78
+ end
79
+
80
+ describe "Tokeninfo" do
81
+ before do
82
+ @tokeninfo = OpenIDConnect::Tokeninfo.new( :access_token => "test_access_token",
83
+ :refresh_token => "test_refresh_token",
84
+ :id_token => "test_id_token" )
85
+ end
86
+
87
+ it "create" do
88
+ OpenIDConnect::Tokeninfo.api.stub( :post => { :access_token => "access_token" } )
89
+ tokeninfo = OpenIDConnect::Tokeninfo.create("authorize_code")
90
+ tokeninfo.should be_a OpenIDConnect::Tokeninfo
91
+ tokeninfo.access_token.should eql "access_token"
92
+ end
93
+
94
+ it "refresh" do
95
+ @tokeninfo.api.stub( :post => { :access_token => "new_access_token" } )
96
+ @tokeninfo.access_token.should eql "test_access_token"
97
+ @tokeninfo.refresh
98
+ @tokeninfo.access_token.should eql "new_access_token"
99
+ end
100
+
101
+ it "userinfo" do
102
+ @tokeninfo.api.stub( :post => { :name => "Testing" } )
103
+ userinfo = @tokeninfo.userinfo
104
+ userinfo.should be_a OpenIDConnect::Userinfo
105
+ userinfo.name.should eql "Testing"
106
+ end
107
+
108
+ describe "logout_url" do
109
+ it "Generate logout_url" do
110
+ url = @tokeninfo.logout_url
111
+ url.should match "id_token=test_id_token"
112
+ url.should match "logout=true"
113
+ url.should match Regexp.escape("redirect_uri=#{CGI.escape("http://google.com")}")
114
+ end
115
+
116
+ describe "sandbox" do
117
+ before do
118
+ PayPal::SDK.configure(:mode => "sandbox")
119
+ end
120
+
121
+ it "generates a sandbox logout url" do
122
+ url = @tokeninfo.logout_url
123
+ url.should match "sandbox.paypal.com"
124
+ end
125
+ end
126
+ end
127
+ end
128
+
129
+ describe "Userinfo" do
130
+ it "get" do
131
+ OpenIDConnect::Userinfo.api.stub( :post => { :name => "Testing" } )
132
+
133
+ userinfo = OpenIDConnect::Userinfo.get("access_token")
134
+ userinfo.should be_a OpenIDConnect::Userinfo
135
+ userinfo.name.should eql "Testing"
136
+
137
+ userinfo = OpenIDConnect::Userinfo.get( :access_token => "access_token" )
138
+ userinfo.should be_a OpenIDConnect::Userinfo
139
+ userinfo.name.should eql "Testing"
140
+ end
141
+ end
142
+
143
+
144
+ end
data/spec/log/http.log CHANGED
@@ -2,55 +2,94 @@ opening connection to api.sandbox.paypal.com:443...
2
2
  opened
3
3
  starting SSL for api.sandbox.paypal.com:443...
4
4
  SSL established
5
- <- "POST /v1/payments/billing-plans/ HTTP/1.1\r\nAuthorization: Bearer A015pRj1TFtRO40ITOYXmzcSuFhGJFlFpTBZqxNM7ivKkqY\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 0.10.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nPaypal-Request-Id: 3274970e-aad1-41d2-bba5-365d204e0919\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 627\r\n\r\n"
6
- <- "{\"name\":\"T-Shirt of the Month Club Plan\",\"description\":\"Template creation.\",\"type\":\"fixed\",\"payment_definitions\":[{\"name\":\"Regular Payments\",\"type\":\"REGULAR\",\"frequency_interval\":\"2\",\"frequency\":\"MONTH\",\"cycles\":\"12\",\"amount\":{\"currency\":\"USD\",\"value\":\"100\"},\"charge_models\":[{\"type\":\"SHIPPING\",\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}},{\"type\":\"TAX\",\"amount\":{\"currency\":\"USD\",\"value\":\"12\"}}]}],\"merchant_preferences\":{\"setup_fee\":{\"currency\":\"USD\",\"value\":\"1\"},\"cancel_url\":\"http://www.cancel.com\",\"return_url\":\"http://www.return.com\",\"max_fail_attempts\":\"0\",\"auto_bill_amount\":\"YES\",\"initial_fail_amount_action\":\"CONTINUE\"}}"
7
- -> "HTTP/1.1 403 Forbidden\r\n"
5
+ <- "POST /v1/vault/credit-card HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015Wzv2g.FBt8R8lMLiC29HZVC3BHrQNHvOJa1fDg9TaIQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 1.0.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nPaypal-Request-Id: d00d5d2b-5f98-4d8d-92f5-5bb0121983a6\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 251\r\n\r\n"
6
+ <- "{\"number\":\"4417119669820331\",\"type\":\"visa\",\"expire_month\":11,\"expire_year\":2018,\"cvv2\":\"874\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Johnstown\",\"country_code\":\"US\",\"postal_code\":\"43210\",\"state\":\"OH\"}}"
7
+ -> "HTTP/1.1 201 Created\r\n"
8
8
  -> "Server: Apache-Coyote/1.1\r\n"
9
- -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=449\r\n"
10
- -> "Paypal-Debug-Id: 6ad98b8748fb9\r\n"
11
- -> "SERVER_INFO: paymentsplatformserv:v1.payments.billing-plans&CalThreadId=92&TopLevelTxnStartTime=14ac5f31156&Host=slcsbpaymentsplatformserv3002.slc.paypal.com&pid=7916\r\n"
12
- -> "Date: Wed, 07 Jan 2015 19:50:48 GMT\r\n"
9
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=374349\r\n"
10
+ -> "Paypal-Debug-Id: abeff599fbb6d\r\n"
11
+ -> "Content-Language: *\r\n"
12
+ -> "Date: Mon, 26 Jan 2015 23:38:22 GMT\r\n"
13
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=144&TopLevelTxnStartTime=14b289c3a3b&Host=slcsbvaultplatformserv501.slc.paypal.com&pid=26863\r\n"
13
14
  -> "Content-Type: application/json\r\n"
14
- -> "Content-Length: 215\r\n"
15
+ -> "Content-Length: 784\r\n"
15
16
  -> "\r\n"
16
- reading 215 bytes...
17
- -> "{\"name\":\"REQUIRED_SCOPE_MISSING\",\"message\":\"Access token does not have required scope\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING\",\"debug_id\":\"6ad98b8748fb9\"}"
18
- read 215 bytes
17
+ reading 784 bytes...
18
+ -> "{\"id\":\"CARD-8EH41211YH683514LKTDM73Q\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Johnstown\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"},\"valid_until\":\"2018-01-25T00:00:00Z\",\"create_time\":\"2015-01-26T23:38:22Z\",\"update_time\":\"2015-01-26T23:38:22Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
19
+ read 784 bytes
19
20
  Conn keep-alive
20
21
  opening connection to api.sandbox.paypal.com:443...
21
22
  opened
22
23
  starting SSL for api.sandbox.paypal.com:443...
23
24
  SSL established
24
- <- "GET /v1/payments/billing-plans/ HTTP/1.1\r\nAuthorization: Bearer A015pRj1TFtRO40ITOYXmzcSuFhGJFlFpTBZqxNM7ivKkqY\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 0.10.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
25
- -> "HTTP/1.1 403 Forbidden\r\n"
25
+ <- "GET /v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015Wzv2g.FBt8R8lMLiC29HZVC3BHrQNHvOJa1fDg9TaIQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 1.0.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
26
+ -> "HTTP/1.1 200 OK\r\n"
26
27
  -> "Server: Apache-Coyote/1.1\r\n"
27
- -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=1029\r\n"
28
- -> "Paypal-Debug-Id: 22a47d7e4553e\r\n"
29
- -> "SERVER_INFO: paymentsplatformserv:v1.payments.billing-plans&CalThreadId=195&TopLevelTxnStartTime=14ac5f3134e&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=10384\r\n"
30
- -> "Date: Wed, 07 Jan 2015 19:50:49 GMT\r\n"
28
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=370412\r\n"
29
+ -> "Paypal-Debug-Id: 9f6e4c66f44ea\r\n"
30
+ -> "Content-Language: *\r\n"
31
+ -> "Date: Mon, 26 Jan 2015 23:38:21 GMT\r\n"
32
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=145&TopLevelTxnStartTime=14b289c3cc5&Host=slcsbvaultplatformserv501.slc.paypal.com&pid=26863\r\n"
31
33
  -> "Content-Type: application/json\r\n"
32
- -> "Content-Length: 215\r\n"
34
+ -> "Content-Length: 784\r\n"
33
35
  -> "\r\n"
34
- reading 215 bytes...
35
- -> "{\"name\":\"REQUIRED_SCOPE_MISSING\",\"message\":\"Access token does not have required scope\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING\",\"debug_id\":\"22a47d7e4553e\"}"
36
- read 215 bytes
36
+ reading 784 bytes...
37
+ -> "{\"id\":\"CARD-8EH41211YH683514LKTDM73Q\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Johnstown\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"},\"valid_until\":\"2018-01-25T00:00:00Z\",\"create_time\":\"2015-01-26T23:38:22Z\",\"update_time\":\"2015-01-26T23:38:22Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-8EH41211YH683514LKTDM73Q\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
38
+ read 784 bytes
37
39
  Conn keep-alive
38
40
  opening connection to api.sandbox.paypal.com:443...
39
41
  opened
40
42
  starting SSL for api.sandbox.paypal.com:443...
41
43
  SSL established
42
- <- "POST /v1/payments/billing-plans/ HTTP/1.1\r\nAuthorization: Bearer A015pRj1TFtRO40ITOYXmzcSuFhGJFlFpTBZqxNM7ivKkqY\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 0.10.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nPaypal-Request-Id: 52864c42-e3be-436a-a075-57124965c2a7\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 627\r\n\r\n"
43
- <- "{\"name\":\"T-Shirt of the Month Club Plan\",\"description\":\"Template creation.\",\"type\":\"fixed\",\"payment_definitions\":[{\"name\":\"Regular Payments\",\"type\":\"REGULAR\",\"frequency_interval\":\"2\",\"frequency\":\"MONTH\",\"cycles\":\"12\",\"amount\":{\"currency\":\"USD\",\"value\":\"100\"},\"charge_models\":[{\"type\":\"SHIPPING\",\"amount\":{\"currency\":\"USD\",\"value\":\"10\"}},{\"type\":\"TAX\",\"amount\":{\"currency\":\"USD\",\"value\":\"12\"}}]}],\"merchant_preferences\":{\"setup_fee\":{\"currency\":\"USD\",\"value\":\"1\"},\"cancel_url\":\"http://www.cancel.com\",\"return_url\":\"http://www.return.com\",\"max_fail_attempts\":\"0\",\"auto_bill_amount\":\"YES\",\"initial_fail_amount_action\":\"CONTINUE\"}}"
44
- -> "HTTP/1.1 403 Forbidden\r\n"
44
+ <- "POST /v1/vault/credit-card HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015Wzv2g.FBt8R8lMLiC29HZVC3BHrQNHvOJa1fDg9TaIQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 1.0.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nPaypal-Request-Id: f038736d-035a-4868-a010-4795d2a63d56\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 80\r\n\r\n"
45
+ <- "{\"number\":\"4417119669820331\",\"type\":\"visa\",\"expire_month\":11,\"expire_year\":2018}"
46
+ -> "HTTP/1.1 201 Created\r\n"
45
47
  -> "Server: Apache-Coyote/1.1\r\n"
46
- -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=3255\r\n"
47
- -> "Paypal-Debug-Id: 9b818f4145084\r\n"
48
- -> "SERVER_INFO: paymentsplatformserv:v1.payments.billing-plans&CalThreadId=849&TopLevelTxnStartTime=14ac5f3170d&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=10384\r\n"
49
- -> "Date: Wed, 07 Jan 2015 19:50:49 GMT\r\n"
48
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=422766\r\n"
49
+ -> "Paypal-Debug-Id: 8329db02fbfc9\r\n"
50
+ -> "Content-Language: *\r\n"
51
+ -> "Date: Mon, 26 Jan 2015 23:38:23 GMT\r\n"
52
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=144&TopLevelTxnStartTime=14b289c3ed1&Host=slcsbvaultplatformserv501.slc.paypal.com&pid=26863\r\n"
50
53
  -> "Content-Type: application/json\r\n"
51
- -> "Content-Length: 215\r\n"
54
+ -> "Content-Length: 626\r\n"
52
55
  -> "\r\n"
53
- reading 215 bytes...
54
- -> "{\"name\":\"REQUIRED_SCOPE_MISSING\",\"message\":\"Access token does not have required scope\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING\",\"debug_id\":\"9b818f4145084\"}"
55
- read 215 bytes
56
+ reading 626 bytes...
57
+ -> "{\"id\":\"CARD-6E9832748Y127633WKTDM73Y\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"valid_until\":\"2018-01-25T00:00:00Z\",\"create_time\":\"2015-01-26T23:38:23Z\",\"update_time\":\"2015-01-26T23:38:23Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6E9832748Y127633WKTDM73Y\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6E9832748Y127633WKTDM73Y\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6E9832748Y127633WKTDM73Y\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
58
+ read 626 bytes
56
59
  Conn keep-alive
60
+ opening connection to api.sandbox.paypal.com:443...
61
+ opened
62
+ starting SSL for api.sandbox.paypal.com:443...
63
+ SSL established
64
+ <- "DELETE /v1/vault/credit-card/CARD-6E9832748Y127633WKTDM73Y HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015Wzv2g.FBt8R8lMLiC29HZVC3BHrQNHvOJa1fDg9TaIQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 1.0.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
65
+ -> "HTTP/1.1 204 No Content\r\n"
66
+ -> "Server: Apache-Coyote/1.1\r\n"
67
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=374349\r\n"
68
+ -> "Paypal-Debug-Id: 9c6c8f0efc077\r\n"
69
+ -> "Content-Language: *\r\n"
70
+ -> "Date: Mon, 26 Jan 2015 23:38:23 GMT\r\n"
71
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=144&TopLevelTxnStartTime=14b289c412f&Host=slcsbvaultplatformserv501.slc.paypal.com&pid=26863\r\n"
72
+ -> "\r\n"
73
+ Conn keep-alive
74
+ opening connection to api.sandbox.paypal.com:443...
75
+ opened
76
+ starting SSL for api.sandbox.paypal.com:443...
77
+ SSL established
78
+ <- "POST /v1/vault/credit-card HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015Wzv2g.FBt8R8lMLiC29HZVC3BHrQNHvOJa1fDg9TaIQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/PayPal-Ruby-SDK 1.0.0 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nPaypal-Request-Id: d74311bb-87da-459a-9781-b41a160e0e63\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 43\r\n\r\n"
79
+ <- "{\"number\":\"4111111111111111\",\"type\":\"visa\"}"
80
+ -> "HTTP/1.1 400 Bad Request\r\n"
81
+ -> "Server: Apache-Coyote/1.1\r\n"
82
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=370896\r\n"
83
+ -> "Paypal-Debug-Id: 9b33f301f3b03\r\n"
84
+ -> "Content-Language: *\r\n"
85
+ -> "Date: Mon, 26 Jan 2015 23:38:24 GMT\r\n"
86
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=145&TopLevelTxnStartTime=14b289c436b&Host=slcsbvaultplatformserv501.slc.paypal.com&pid=26863\r\n"
87
+ -> "Connection: close\r\n"
88
+ -> "Content-Type: application/json\r\n"
89
+ -> "Content-Length: 300\r\n"
90
+ -> "Connection: close\r\n"
91
+ -> "\r\n"
92
+ reading 300 bytes...
93
+ -> "{\"name\":\"VALIDATION_ERROR\",\"details\":[{\"field\":\"expire_year\",\"issue\":\"Required field missing\"},{\"field\":\"expire_month\",\"issue\":\"Required field missing\"}],\"message\":\"Invalid request - see details\",\"information_link\":\"https://developer.paypal.com/docs/api/#VALIDATION_ERROR\",\"debug_id\":\"9b33f301f3b03\"}"
94
+ read 300 bytes
95
+ Conn close
@@ -0,0 +1,133 @@
1
+ opening connection to api.sandbox.paypal.com:443...
2
+ opened
3
+ starting SSL for api.sandbox.paypal.com:443...
4
+ SSL established
5
+ <- "POST /v1/payments/payment HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015sNxcVEuJGuqxbp8gWg5ytHVFjZERr0GRQ7XwNfL5s-c\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 286\r\n\r\n"
6
+ <- "{\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"4417119669820331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"}}]}"
7
+ -> "HTTP/1.1 201 Created\r\n"
8
+ -> "Server: Apache-Coyote/1.1\r\n"
9
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=374562\r\n"
10
+ -> "Paypal-Debug-Id: 99ae834b04c3b\r\n"
11
+ -> "SERVER_INFO: paymentsplatformserv:v1.payments.payment&CalThreadId=206&TopLevelTxnStartTime=14b27d3184b&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=22725\r\n"
12
+ -> "Content-Language: *\r\n"
13
+ -> "Date: Mon, 26 Jan 2015 19:59:05 GMT\r\n"
14
+ -> "Content-Type: application/json\r\n"
15
+ -> "Content-Length: 1176\r\n"
16
+ -> "\r\n"
17
+ reading 1176 bytes...
18
+ -> "{\"id\":\"PAY-0HK26041BK876242NKTDJY4A\",\"create_time\":\"2015-01-26T19:58:40Z\",\"update_time\":\"2015-01-26T19:59:05Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"7.47\"}},\"related_resources\":[{\"sale\":{\"id\":\"99T986810N230144S\",\"create_time\":\"2015-01-26T19:58:40Z\",\"update_time\":\"2015-01-26T19:59:06Z\",\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-0HK26041BK876242NKTDJY4A\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/99T986810N230144S\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/99T986810N230144S/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-0HK26041BK876242NKTDJY4A\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-0HK26041BK876242NKTDJY4A\",\"rel\":\"self\",\"method\":\"GET\"}]}"
19
+ read 1176 bytes
20
+ Conn keep-alive
21
+ opening connection to api.sandbox.paypal.com:443...
22
+ opened
23
+ starting SSL for api.sandbox.paypal.com:443...
24
+ SSL established
25
+ <- "GET /v1/payments/payment?count=10 HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015sNxcVEuJGuqxbp8gWg5ytHVFjZERr0GRQ7XwNfL5s-c\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
26
+ -> "HTTP/1.1 200 OK\r\n"
27
+ -> "Server: Apache-Coyote/1.1\r\n"
28
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=415614\r\n"
29
+ -> "Paypal-Debug-Id: ca8ee0440630d\r\n"
30
+ -> "SERVER_INFO: paymentsplatformserv:v1.payments.payment&CalThreadId=3846&TopLevelTxnStartTime=14b27d37d1d&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=22725\r\n"
31
+ -> "Content-Language: *\r\n"
32
+ -> "Date: Mon, 26 Jan 2015 19:59:19 GMT\r\n"
33
+ -> "Content-Type: application/json\r\n"
34
+ -> "Transfer-Encoding: chunked\r\n"
35
+ -> "\r\n"
36
+ -> "2000\r\n"
37
+ reading 8192 bytes...
38
+ -> "{\"payments\":[{\"id\":\"PAY-0HK26041BK876242NKTDJY4A\",\"create_time\":\"2015-01-26T19:58:40Z\",\"update_time\":\"2015-01-26T19:59:05Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"7.47\"}},\"related_resources\":[{\"sale\":{\"id\":\"99T986810N230144S\",\"create_time\":\"2015-01-26T19:58:40Z\",\"update_time\":\"2015-01-26T19:59:06Z\",\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-0HK26041BK876242NKTDJY4A\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/99T986810N230144S\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/99T986810N230144S/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-0HK26041BK876242NKTDJY4A\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-0HK26041BK876242NKTDJY4A\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-45N073335H301674BKTDJYLQ\",\"create_time\":\"2015-01-26T19:57:34Z\",\"update_time\":\"2015-01-26T19:57:54Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"1\",\"expire_year\":\"2015\",\"first_name\":\"test\",\"last_name\":\"test\"}}]},\"transactions\":[{\"amount\":{\"total\":\"8.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"8.00\"}},\"description\":\"Transaction for South Dakota Tracs Crash Report.\",\"related_resources\":[{\"sale\":{\"id\":\"09C17155GG552854V\",\"create_time\":\"2015-01-26T19:57:34Z\",\"update_time\":\"2015-01-26T19:57:54Z\",\"amount\":{\"total\":\"8.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-45N073335H301674BKTDJYLQ\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/09C17155GG552854V\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/09C17155GG552854V/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-45N073335H301674BKTDJYLQ\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-45N073335H301674BKTDJYLQ\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-92D80148F0212810HKTDI5SY\",\"create_time\":\"2015-01-26T19:00:27Z\",\"update_time\":\"2015-01-26T19:00:52Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"billing_address\":{\"line1\":\"52 N Main ST\",\"city\":\"Johnstown\",\"state\":\"OH\",\"postal_code\":\"43210\",\"country_code\":\"US\"}}}]},\"transactions\":[{\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"7.47\"}},\"description\":\"This is the payment transaction description.\",\"related_resources\":[{\"sale\":{\"id\":\"7LL39319SX4999041\",\"create_time\":\"2015-01-26T19:00:27Z\",\"update_time\":\"2015-01-26T19:00:52Z\",\"amount\":{\"total\":\"7.47\",\"currency\":\"USD\"},\"state\":\"refunded\",\"parent_payment\":\"PAY-92D80148F0212810HKTDI5SY\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/7LL39319SX4999041\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/7LL39319SX4999041/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-92D80148F0212810HKTDI5SY\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}},{\"refund\":{\"id\":\"7BK01278LV509382W\",\"create_time\":\"2015-01-26T19:00:52Z\",\"update_time\":\"2015-01-26T19:00:52Z\",\"state\":\"completed\",\"amount\":{\"total\":\"-7.47\",\"currency\":\"USD\"},\"sale_id\":\"7LL39319SX4999041\",\"parent_payment\":\"PAY-92D80148F0212810HKTDI5SY\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/refund/7BK01278LV509382W\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-92D80148F0212810HKTDI5SY\",\"rel\":\"parent_payment\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/7LL39319SX4999041\",\"rel\":\"sale\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-92D80148F0212810HKTDI5SY\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-10B69903JH1072821KTDIPCY\",\"create_time\":\"2015-01-26T18:29:31Z\",\"update_time\":\"2015-01-26T18:29:58Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"paypal\",\"status\":\"VERIFIED\",\"payer_info\":{\"email\":\"nmehta6@wellpledge.com\",\"first_name\":\"nachiket\",\"last_name\":\"mehta\",\"payer_id\":\"XWDD75FTGHJLN\",\"shipping_address\":{\"line1\":\"1 Main St\",\"city\":\"San Jose\",\"state\":\"CA\",\"postal_code\":\"95131\",\"country_code\":\"US\",\"recipient_name\":\"nachiket mehta\"}}},\"transactions\":[{\"amount\":{\"total\":\"100.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"100.00\"}},\"description\":\"Pledge\",\"related_resources\":[{\"sale\":{\"id\":\"3W375242JL947521F\",\"create_time\":\"2015-01-26T18:29:31Z\",\"update_time\":\"2015-01-26T18:29:58Z\",\"amount\":{\"total\":\"100.00\",\"currency\":\"USD\"},\"payment_mode\":\"INSTANT_TRANSFER\",\"state\":\"completed\",\"protection_eligibility\":\"ELIGIBLE\",\"protection_eligibility_type\":\"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE\",\"parent_payment\":\"PAY-10B69903JH1072821KTDIPCY\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3W375242JL947521F\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/3W375242JL947521F/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-10B69903JH1072821KTDIPCY\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-10B69903JH1072821KTDIPCY\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-41S95619LR639784UKTDIMSQ\",\"create_time\":\"2015-01-26T18:24:10Z\",\"update_time\":\"2015-01-26T18:24:50Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"paypal\",\"status\":\"VERIFIED\",\"payer_info\":{\"email\":\"nmehta6@wellpledge.com\",\"first_name\":\"nachiket\",\"last_name\":\"mehta\",\"payer_id\":\"XWDD75FTGHJLN\",\"shipping_address\":{\"line1\":\"1 Main St\",\"city\":\"San Jose\",\"state\":\"CA\",\"postal_code\":\"95131\",\"country_code\":\"US\",\"recipient_name\":\"nachiket mehta\"}}},\"transactions\":[{\"amount\":{\"total\":\"5.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"5.00\"}},\"description\":\"Pledge\",\"related_resources\":[{\"sale\":{\"id\":\"56V10528UY3057224\",\"create_time\":\"2015-01-26T18:24:10Z\",\"update_time\":\"2015-01-26T18:24:50Z\",\"amount\":{\"total\":\"5.00\",\"currency\":\"USD\"},\"payment_mode\":\"INSTANT_TRANSFER\",\"state\":\"completed\",\"protection_eligibility\":\"ELIGIBLE\",\"protection_eligibility_type\":\"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE\",\"parent_payment\":\"PAY-41S95619LR639784UKTDIMSQ\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/56V10528UY3057224\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/56V10528UY3057224/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-41S95619LR639784UKTDIMSQ\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-41S95619LR639784UKTDIMSQ\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-50P28946RR561462GKTDHK5Y\",\"create_time\":\"2015-01-26T17:12:23Z\",\"update_time\":\"2015-01-26T17:12:25Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx9693\",\"expire_month\":\"1\",\"expire_year\":\"2019\",\"first_name\":\"Test\",\"last_name\":\"Test\"}}]},\"transactions\":[{\"amount\":{\"total\":\"59.15\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"59.15\"}},\"description\":\"Payment for order No. 76EE2502-B26A-46F1-BD50-8BE396D8BD57\",\"related_resources\":[{\"sale\":{\"id\":\"4J494696UH2097506\",\"create_time\":\"2015-01-26T17:12:23Z\",\"update_time\":\"2015-01-26T17:12:25Z\",\"amount\":{\"total\":\"59.15\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-50P28946RR561462GKTDHK5Y\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/4J494696UH2097506\",\"rel\""
39
+ read 8192 bytes
40
+ reading 2 bytes...
41
+ -> "\r\n"
42
+ read 2 bytes
43
+ -> "14e6\r\n"
44
+ reading 5350 bytes...
45
+ -> ":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/4J494696UH2097506/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-50P28946RR561462GKTDHK5Y\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-50P28"
46
+ -> "946RR561462GKTDHK5Y\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-38J73169NH225341CKTDHGDQ\",\"create_time\":\"2015-01-26T17:02:06Z\",\"update_time\":\"2015-01-26T17:02:08Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx9693\",\"expire_month\":\"1\",\"expire_year\":\"2023\",\"first_name\":\"Test\",\"last_name\":\"Test\"}}]},\"transactions\":[{\"amount\":{\"total\":\"111.94\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"111.94\"}},\"description\":\"Payment for order No. 2BC9DB90-BE2B-40D4-A774-52D02DAA9947\",\"related_resources\":[{\"sale\":{\"id\":\"2K6603165A1419111\",\"create_time\":\"2015-01-26T17:02:06Z\",\"update_time\":\"2015-01-26T17:02:08Z\",\"amount\":{\"total\":\"111.94\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-38J73169NH225341CKTDHGDQ\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/2K6603165A1419111\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/2K6603165A1419111/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-38J73169NH225341CKTDHGDQ\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-38J73169NH225341CKTDHGDQ\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-28K34334W8115331HKTDG7VY\",\"create_time\":\"2015-01-26T16:48:23Z\",\"update_time\":\"2015-01-26T16:48:25Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx2709\",\"expire_month\":\"12\",\"expire_year\":\"2018\",\"first_name\":\"Ash\",\"last_name\":\"Williams\"}}]},\"transactions\":[{\"amount\":{\"total\":\"10.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"10.00\"}},\"description\":\"Your Kraken Store Purchase\",\"related_resources\":[{\"sale\":{\"id\":\"07B09156JR787052Y\",\"create_time\":\"2015-01-26T16:48:23Z\",\"update_time\":\"2015-01-26T16:48:25Z\",\"amount\":{\"total\":\"10.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-28K34334W8115331HKTDG7VY\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/07B09156JR787052Y\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/07B09156JR787052Y/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-28K34334W8115331HKTDG7VY\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-28K34334W8115331HKTDG7VY\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-5YC95627DE8872136KTDG3EA\",\"create_time\":\"2015-01-26T16:38:40Z\",\"update_time\":\"2015-01-26T16:38:45Z\",\"state\":\"approved\",\"intent\":\"authorize\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"amex\",\"number\":\"xxxxxxxxxxx5005\",\"expire_month\":\"8\",\"expire_year\":\"2026\",\"first_name\":\"i\",\"last_name\":\"i\"}}]},\"transactions\":[{\"amount\":{\"total\":\"1.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"1.00\"}},\"description\":\"Validation request.\",\"related_resources\":[{\"authorization\":{\"id\":\"1MA07760937486001\",\"create_time\":\"2015-01-26T16:38:40Z\",\"update_time\":\"2015-01-26T16:38:45Z\",\"amount\":{\"total\":\"1.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"1.00\"}},\"state\":\"voided\",\"parent_payment\":\"PAY-5YC95627DE8872136KTDG3EA\",\"valid_until\":\"2015-02-24T16:38:40Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/authorization/1MA07760937486001\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YC95627DE8872136KTDG3EA\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YC95627DE8872136KTDG3EA\",\"rel\":\"self\",\"method\":\"GET\"}]},{\"id\":\"PAY-5JX78789RV369420XKTDGY4Q\",\"create_time\":\"2015-01-26T16:33:54Z\",\"update_time\":\"2015-01-26T16:34:14Z\",\"state\":\"approved\",\"intent\":\"sale\",\"payer\":{\"payment_method\":\"credit_card\",\"funding_instruments\":[{\"credit_card\":{\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx0331\",\"expire_month\":\"1\",\"expire_year\":\"2015\",\"first_name\":\"test\",\"last_name\":\"test\"}}]},\"transactions\":[{\"amount\":{\"total\":\"8.00\",\"currency\":\"USD\",\"details\":{\"subtotal\":\"8.00\"}},\"description\":\"Transaction for South Dakota Tracs Crash Report.\",\"related_resources\":[{\"sale\":{\"id\":\"65N64578SJ086052V\",\"create_time\":\"2015-01-26T16:33:54Z\",\"update_time\":\"2015-01-26T16:34:14Z\",\"amount\":{\"total\":\"8.00\",\"currency\":\"USD\"},\"state\":\"completed\",\"parent_payment\":\"PAY-5JX78789RV369420XKTDGY4Q\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/65N64578SJ086052V\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/sale/65N64578SJ086052V/refund\",\"rel\":\"refund\",\"method\":\"POST\"},{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-5JX78789RV369420XKTDGY4Q\",\"rel\":\"parent_payment\",\"method\":\"GET\"}]}}]}],\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/payments/payment/PAY-5JX78789RV369420XKTDGY4Q\",\"rel\":\"self\",\"method\":\"GET\"}]}],\"count\":10,\"next_id\":\"PAY-10L26665VD0354626KTDGLNI\"}"
47
+ read 5350 bytes
48
+ reading 2 bytes...
49
+ -> "\r\n"
50
+ read 2 bytes
51
+ -> "0\r\n"
52
+ -> "\r\n"
53
+ Conn keep-alive
54
+ opening connection to api.sandbox.paypal.com:443...
55
+ opened
56
+ starting SSL for api.sandbox.paypal.com:443...
57
+ SSL established
58
+ <- "POST /v1/vault/credit-card HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015ATTrEVx4Rv0emNcK5Uh5u-xmHOqmVeQhTfyo1NVtyTQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 138\r\n\r\n"
59
+ <- "{\"type\":\"visa\",\"number\":\"4111111111111111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"cvv2\":\"874\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\"}"
60
+ -> "HTTP/1.1 201 Created\r\n"
61
+ -> "Server: Apache-Coyote/1.1\r\n"
62
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=415614\r\n"
63
+ -> "Paypal-Debug-Id: 38bef0de09756\r\n"
64
+ -> "Content-Language: *\r\n"
65
+ -> "Date: Mon, 26 Jan 2015 19:59:21 GMT\r\n"
66
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=138&TopLevelTxnStartTime=14b27d3b772&Host=slcsbvaultplatformserv502.slc.paypal.com&pid=10462\r\n"
67
+ -> "Content-Type: application/json\r\n"
68
+ -> "Content-Length: 667\r\n"
69
+ -> "\r\n"
70
+ reading 667 bytes...
71
+ -> "{\"id\":\"CARD-6NM00310BP799084BKTDJZGI\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx1111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"valid_until\":\"2018-01-25T00:00:00Z\",\"create_time\":\"2015-01-26T19:59:21Z\",\"update_time\":\"2015-01-26T19:59:21Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
72
+ read 667 bytes
73
+ Conn keep-alive
74
+ opening connection to api.sandbox.paypal.com:443...
75
+ opened
76
+ starting SSL for api.sandbox.paypal.com:443...
77
+ SSL established
78
+ <- "GET /v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015ATTrEVx4Rv0emNcK5Uh5u-xmHOqmVeQhTfyo1NVtyTQ\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
79
+ -> "HTTP/1.1 200 OK\r\n"
80
+ -> "Server: Apache-Coyote/1.1\r\n"
81
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=415614\r\n"
82
+ -> "Paypal-Debug-Id: 9639a1aa09943\r\n"
83
+ -> "Content-Language: *\r\n"
84
+ -> "Date: Mon, 26 Jan 2015 19:59:21 GMT\r\n"
85
+ -> "SERVER_INFO: vaultplatformserv:v1.vault.credit-card&CalThreadId=138&TopLevelTxnStartTime=14b27d3b977&Host=slcsbvaultplatformserv502.slc.paypal.com&pid=10462\r\n"
86
+ -> "Content-Type: application/json\r\n"
87
+ -> "Content-Length: 667\r\n"
88
+ -> "\r\n"
89
+ reading 667 bytes...
90
+ -> "{\"id\":\"CARD-6NM00310BP799084BKTDJZGI\",\"state\":\"ok\",\"type\":\"visa\",\"number\":\"xxxxxxxxxxxx1111\",\"expire_month\":\"11\",\"expire_year\":\"2018\",\"first_name\":\"Joe\",\"last_name\":\"Shopper\",\"valid_until\":\"2018-01-25T00:00:00Z\",\"create_time\":\"2015-01-26T19:59:21Z\",\"update_time\":\"2015-01-26T19:59:21Z\",\"links\":[{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"self\",\"method\":\"GET\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"delete\",\"method\":\"DELETE\"},{\"href\":\"https://api.sandbox.paypal.com/v1/vault/credit-card/CARD-6NM00310BP799084BKTDJZGI\",\"rel\":\"patch\",\"method\":\"PATCH\"}]}"
91
+ read 667 bytes
92
+ Conn keep-alive
93
+ opening connection to api.sandbox.paypal.com:443...
94
+ opened
95
+ starting SSL for api.sandbox.paypal.com:443...
96
+ SSL established
97
+ <- "GET /v1/payments/payment/PAY-1234 HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015sNxcVEuJGuqxbp8gWg5ytHVFjZERr0GRQ7XwNfL5s-c\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\n\r\n"
98
+ -> "HTTP/1.1 404 Not Found\r\n"
99
+ -> "Server: Apache-Coyote/1.1\r\n"
100
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3001.slc.paypal.com;threadId=424366\r\n"
101
+ -> "Paypal-Debug-Id: 275ebe840ef65\r\n"
102
+ -> "SERVER_INFO: paymentsplatformserv:v1.payments.payment&CalThreadId=679&TopLevelTxnStartTime=14b27d3bb76&Host=slcsbpaymentsplatformserv3002.slc.paypal.com&pid=15580\r\n"
103
+ -> "Content-Language: *\r\n"
104
+ -> "Date: Mon, 26 Jan 2015 19:59:21 GMT\r\n"
105
+ -> "Content-Type: application/json\r\n"
106
+ -> "Content-Length: 207\r\n"
107
+ -> "\r\n"
108
+ reading 207 bytes...
109
+ -> "{\"name\":\"INVALID_RESOURCE_ID\",\"message\":\"The requested resource ID was not found\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID\",\"debug_id\":\"275ebe840ef65\"}"
110
+ read 207 bytes
111
+ Conn keep-alive
112
+ opening connection to api.sandbox.paypal.com:443...
113
+ opened
114
+ starting SSL for api.sandbox.paypal.com:443...
115
+ SSL established
116
+ <- "POST /v1/payments/payment HTTP/1.1\r\nX-Paypal-Sandbox-Email-Address: Platform.sdk.seller@gmail.com\r\nAuthorization: Bearer A015sNxcVEuJGuqxbp8gWg5ytHVFjZERr0GRQ7XwNfL5s-c\r\nContent-Type: application/json\r\nUser-Agent: PayPalSDK/sdk-core-ruby 0.3.1 (paypal-sdk-core 0.3.1; ruby 2.1.2p95-x86_64-darwin13.0)\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nHost: api.sandbox.paypal.com\r\nContent-Length: 2\r\n\r\n"
117
+ <- "{}"
118
+ -> "HTTP/1.1 400 Bad Request\r\n"
119
+ -> "Server: Apache-Coyote/1.1\r\n"
120
+ -> "PROXY_SERVER_INFO: host=slcsbplatformapiserv3002.slc.paypal.com;threadId=370782\r\n"
121
+ -> "Paypal-Debug-Id: 1fee815a09cc5\r\n"
122
+ -> "SERVER_INFO: paymentsplatformserv:v1.payments.payment&CalThreadId=90&TopLevelTxnStartTime=14b27d3bd23&Host=slcsbpaymentsplatformserv3001.slc.paypal.com&pid=22725\r\n"
123
+ -> "Content-Language: *\r\n"
124
+ -> "Date: Mon, 26 Jan 2015 19:59:22 GMT\r\n"
125
+ -> "Connection: close\r\n"
126
+ -> "Content-Type: application/json\r\n"
127
+ -> "Content-Length: 306\r\n"
128
+ -> "Connection: close\r\n"
129
+ -> "\r\n"
130
+ reading 306 bytes...
131
+ -> "{\"name\":\"VALIDATION_ERROR\",\"details\":[{\"field\":\"payer\",\"issue\":\"Required field missing\"},{\"field\":\"intent\",\"issue\":\"Required field missing\"}],\"message\":\"Invalid request - see details\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR\",\"debug_id\":\"1fee815a09cc5\"}"
132
+ read 306 bytes
133
+ Conn close
data/spec/spec_helper.rb CHANGED
@@ -15,6 +15,12 @@ require 'paypal-sdk-rest'
15
15
  include PayPal::SDK::REST
16
16
  include PayPal::SDK::Core::Logging
17
17
 
18
+ require 'logger'
19
+ PayPal::SDK.load('spec/config/paypal.yml', 'test')
20
+ PayPal::SDK.logger = Logger.new(STDERR)
21
+
22
+ Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f }
23
+
18
24
  # Set logger for http
19
25
  http_log = File.open(File.expand_path('../log/http.log', __FILE__), "w")
20
26
  Payment.api.http.set_debug_output(http_log)
@@ -22,5 +28,6 @@ Payment.api.http.set_debug_output(http_log)
22
28
  RSpec.configure do |config|
23
29
  config.filter_run_excluding :integration => true
24
30
  config.filter_run_excluding :disabled => true
31
+ config.include SampleData
25
32
  # config.include PayPal::SDK::REST::DataTypes
26
33
  end