yukon 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +7 -2
- data/bin/console +7 -0
- data/config/paypal-sample.yml +3 -3
- data/config/paypal.yml +3 -3
- data/fixtures/vcr_cassettes/payments.yml +88 -0
- data/fixtures/vcr_cassettes/purchase.yml +78 -0
- data/fixtures/vcr_cassettes/step2.yml +171 -0
- data/lib/yukon/payment_gateway.rb +5 -0
- data/lib/yukon/payment_processor.rb +32 -4
- data/lib/yukon/version.rb +1 -1
- data/yukon.gemspec +2 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05faf8ee84fe24ecf2976509d6185131261f5050
|
4
|
+
data.tar.gz: d65b2936bc9bba5c9cc79c49acb5776c9e2ac6cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c9d223ac079a5cb37c3b0c65f41c2533673b9266acc617c41456d65b75fb274f05e9ee60b527474a19558e79df5383cd387fa47964ee1dfded915a973fbbb7
|
7
|
+
data.tar.gz: 0e5faca7b71745640f3a1fa2082bff7770981faa153ea4725852c9af361866d16e592b038b81b40904498c481972ac00ccd710e9644cbb9a535d362e060088db
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.3
|
data/README.md
CHANGED
@@ -5,7 +5,12 @@ This Micro Gem encapsulates Express Checkout Paypal API. To experiment with that
|
|
5
5
|
```ruby
|
6
6
|
require_relative './lib/yukon/cart.rb'
|
7
7
|
```
|
8
|
-
|
8
|
+
|
9
|
+
## Versions
|
10
|
+
|
11
|
+
Ruby : 2.2.2 and 2.2.3
|
12
|
+
ActiveMerchant : 1.52
|
13
|
+
|
9
14
|
## Installation
|
10
15
|
|
11
16
|
Add this line to your application's Gemfile:
|
@@ -56,7 +61,7 @@ development:
|
|
56
61
|
mode: :test
|
57
62
|
```
|
58
63
|
|
59
|
-
The mode value is :test for development and test environments and :live only for production. For a sample Rails 4.2.
|
64
|
+
The mode value is :test for development and test environments and :live only for production. For a sample Rails 4.2.4 app using Ruby 2.2.3, check out : https://bitbucket.org/bparanj/paypalexpress
|
60
65
|
|
61
66
|
## Test Credentials
|
62
67
|
|
data/bin/console
CHANGED
@@ -10,5 +10,12 @@ require "yukon"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
+
Yukon.configuration do |config|
|
14
|
+
config.login = 'jb-us-seller_api1.paypal.com'
|
15
|
+
config.password = 'WX4WTU3S8MY44S7F'
|
16
|
+
config.signature = 'AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy'
|
17
|
+
config.mode = :test
|
18
|
+
end
|
19
|
+
|
13
20
|
require "irb"
|
14
21
|
IRB.start
|
data/config/paypal-sample.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
development: &default
|
2
|
-
username:
|
3
|
-
password:
|
4
|
-
signature:
|
2
|
+
username: bparan_1360459336_biz_api1.gmail.com
|
3
|
+
password: 1360459362
|
4
|
+
signature: AiPC9BjkCyDFQXbSkoZcgqH3hpacARbNPHYwGcAEv3pAorm.KuIxgJw8
|
5
5
|
app_id: APP-80W284485P519543T
|
6
6
|
http_timeout: 30
|
7
7
|
mode: sandbox
|
data/config/paypal.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
development: &default
|
2
|
-
username:
|
3
|
-
password:
|
4
|
-
signature:
|
2
|
+
username: jb-us-seller_api1.paypal.com
|
3
|
+
password: WX4WTU3S8MY44S7F
|
4
|
+
signature: AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
|
5
5
|
app_id: APP-80W284485P519543T
|
6
6
|
http_timeout: 30
|
7
7
|
mode: sandbox
|
@@ -76,4 +76,92 @@ http_interactions:
|
|
76
76
|
xsi:type="ebl:ExpressCheckoutTokenType">EC-5TC81926SR152035B</Token></SetExpressCheckoutResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
77
77
|
http_version:
|
78
78
|
recorded_at: Sat, 22 Aug 2015 19:10:00 GMT
|
79
|
+
- request:
|
80
|
+
method: post
|
81
|
+
uri: https://api-3t.sandbox.paypal.com/2.0/
|
82
|
+
body:
|
83
|
+
encoding: UTF-8
|
84
|
+
string: |-
|
85
|
+
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xmlns:n1="urn:ebay:apis:eBLBaseComponents" env:mustUnderstand="0"><n1:Credentials><n1:Username>jb-us-seller_api1.paypal.com</n1:Username><n1:Password>WX4WTU3S8MY44S7F</n1:Password><n1:Subject>sell_1342421142_biz@gmail.com</n1:Subject><n1:Signature>AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy</n1:Signature></n1:Credentials></RequesterCredentials></env:Header><env:Body><GetExpressCheckoutDetailsReq xmlns="urn:ebay:api:PayPalAPI">
|
86
|
+
<GetExpressCheckoutDetailsRequest xmlns:n2="urn:ebay:apis:eBLBaseComponents">
|
87
|
+
<n2:Version>72</n2:Version>
|
88
|
+
<Token>EC-5TC81926SR152035B</Token>
|
89
|
+
</GetExpressCheckoutDetailsRequest>
|
90
|
+
</GetExpressCheckoutDetailsReq>
|
91
|
+
</env:Body></env:Envelope>
|
92
|
+
headers:
|
93
|
+
Content-Type:
|
94
|
+
- application/x-www-form-urlencoded
|
95
|
+
Accept-Encoding:
|
96
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
97
|
+
Accept:
|
98
|
+
- "*/*"
|
99
|
+
User-Agent:
|
100
|
+
- Ruby
|
101
|
+
response:
|
102
|
+
status:
|
103
|
+
code: 200
|
104
|
+
message: OK
|
105
|
+
headers:
|
106
|
+
Date:
|
107
|
+
- Tue, 25 Aug 2015 02:43:57 GMT
|
108
|
+
Server:
|
109
|
+
- Apache
|
110
|
+
Connection:
|
111
|
+
- close
|
112
|
+
Content-Length:
|
113
|
+
- '4486'
|
114
|
+
Set-Cookie:
|
115
|
+
- X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
|
116
|
+
- X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D1842797397;
|
117
|
+
domain=.paypal.com; path=/; Secure; HttpOnly
|
118
|
+
Content-Type:
|
119
|
+
- text/xml; charset=utf-8
|
120
|
+
body:
|
121
|
+
encoding: UTF-8
|
122
|
+
string: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
123
|
+
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
124
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
125
|
+
xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
|
126
|
+
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
|
127
|
+
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes"
|
128
|
+
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security
|
129
|
+
xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials
|
130
|
+
xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials
|
131
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username
|
132
|
+
xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature
|
133
|
+
xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body
|
134
|
+
id="_0"><GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp
|
135
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">2015-08-25T02:43:57Z</Timestamp><Ack
|
136
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">8652fe4a9c9f6</CorrelationID><Errors
|
137
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"><ShortMessage
|
138
|
+
xsi:type="xs:string">This Express Checkout session has expired.</ShortMessage><LongMessage
|
139
|
+
xsi:type="xs:string">This Express Checkout session has expired. Token value
|
140
|
+
is no longer valid.</LongMessage><ErrorCode xsi:type="xs:token">10411</ErrorCode><SeverityCode
|
141
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode></Errors><Version
|
142
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">72</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build><GetExpressCheckoutDetailsResponseDetails
|
143
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:GetExpressCheckoutDetailsResponseDetailsType"><PayerInfo
|
144
|
+
xsi:type="ebl:PayerInfoType"><Payer xsi:type="ebl:EmailAddressType"></Payer><PayerID
|
145
|
+
xsi:type="ebl:UserIDType"></PayerID><PayerStatus xsi:type="ebl:PayPalUserStatusCodeType">unverified</PayerStatus><PayerName
|
146
|
+
xsi:type="ebl:PersonNameType"><Salutation xmlns="urn:ebay:apis:eBLBaseComponents"></Salutation><FirstName
|
147
|
+
xmlns="urn:ebay:apis:eBLBaseComponents"></FirstName><MiddleName xmlns="urn:ebay:apis:eBLBaseComponents"></MiddleName><LastName
|
148
|
+
xmlns="urn:ebay:apis:eBLBaseComponents"></LastName><Suffix xmlns="urn:ebay:apis:eBLBaseComponents"></Suffix></PayerName><PayerBusiness
|
149
|
+
xsi:type="xs:string"></PayerBusiness><Address xsi:type="ebl:AddressType"><Name
|
150
|
+
xsi:type="xs:string"></Name><Street1 xsi:type="xs:string"></Street1><Street2
|
151
|
+
xsi:type="xs:string"></Street2><CityName xsi:type="xs:string"></CityName><StateOrProvince
|
152
|
+
xsi:type="xs:string"></StateOrProvince><CountryName></CountryName><PostalCode
|
153
|
+
xsi:type="xs:string"></PostalCode><AddressOwner xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner><AddressStatus
|
154
|
+
xsi:type="ebl:AddressStatusCodeType">None</AddressStatus></Address></PayerInfo><PaymentDetails
|
155
|
+
xsi:type="ebl:PaymentDetailsType"><ShipToAddress xsi:type="ebl:AddressType"><Name
|
156
|
+
xsi:type="xs:string"></Name><Street1 xsi:type="xs:string"></Street1><Street2
|
157
|
+
xsi:type="xs:string"></Street2><CityName xsi:type="xs:string"></CityName><StateOrProvince
|
158
|
+
xsi:type="xs:string"></StateOrProvince><CountryName></CountryName><Phone xsi:type="xs:string"></Phone><PostalCode
|
159
|
+
xsi:type="xs:string"></PostalCode><AddressID xsi:type="xs:string"></AddressID><AddressOwner
|
160
|
+
xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner><ExternalAddressID
|
161
|
+
xsi:type="xs:string"></ExternalAddressID><AddressStatus xsi:type="ebl:AddressStatusCodeType">None</AddressStatus></ShipToAddress><SellerDetails
|
162
|
+
xsi:type="ebl:SellerDetailsType"></SellerDetails><PaymentRequestID xsi:type="xs:string"></PaymentRequestID><OrderURL
|
163
|
+
xsi:type="xs:string"></OrderURL><SoftDescriptor xsi:type="xs:string"></SoftDescriptor></PaymentDetails><CheckoutStatus
|
164
|
+
xsi:type="xs:string"></CheckoutStatus><PaymentRequestInfo xsi:type="ebl:PaymentRequestInfoType"></PaymentRequestInfo></GetExpressCheckoutDetailsResponseDetails></GetExpressCheckoutDetailsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
165
|
+
http_version:
|
166
|
+
recorded_at: Tue, 25 Aug 2015 02:43:58 GMT
|
79
167
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,78 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-3t.sandbox.paypal.com/2.0/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |-
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xmlns:n1="urn:ebay:apis:eBLBaseComponents" env:mustUnderstand="0"><n1:Credentials><n1:Username>secret.gmail.com</n1:Username><n1:Password>1234</n1:Password><n1:Subject>sell_1342421142_biz@gmail.com</n1:Subject><n1:Signature>uIxgJw8</n1:Signature></n1:Credentials></RequesterCredentials></env:Header><env:Body><DoExpressCheckoutPaymentReq xmlns="urn:ebay:api:PayPalAPI">
|
10
|
+
<DoExpressCheckoutPaymentRequest xmlns:n2="urn:ebay:apis:eBLBaseComponents">
|
11
|
+
<n2:Version>72</n2:Version>
|
12
|
+
<n2:DoExpressCheckoutPaymentRequestDetails>
|
13
|
+
<n2:PaymentAction>Sale</n2:PaymentAction>
|
14
|
+
<n2:Token>EC-1V3899965N3430404</n2:Token>
|
15
|
+
<n2:PayerID>U5NT2CMSQKGYS</n2:PayerID>
|
16
|
+
<n2:PaymentDetails>
|
17
|
+
<n2:OrderTotal currencyID="USD">2.00</n2:OrderTotal>
|
18
|
+
<n2:ButtonSource>ActiveMerchant</n2:ButtonSource>
|
19
|
+
<n2:NotifyURL>https://paypal-sdk-samples.herokuapp.com/merchant/ipn_notify</n2:NotifyURL>
|
20
|
+
</n2:PaymentDetails>
|
21
|
+
</n2:DoExpressCheckoutPaymentRequestDetails>
|
22
|
+
</DoExpressCheckoutPaymentRequest>
|
23
|
+
</DoExpressCheckoutPaymentReq>
|
24
|
+
</env:Body></env:Envelope>
|
25
|
+
headers:
|
26
|
+
Content-Type:
|
27
|
+
- application/x-www-form-urlencoded
|
28
|
+
Accept-Encoding:
|
29
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
30
|
+
Accept:
|
31
|
+
- "*/*"
|
32
|
+
User-Agent:
|
33
|
+
- Ruby
|
34
|
+
response:
|
35
|
+
status:
|
36
|
+
code: 200
|
37
|
+
message: OK
|
38
|
+
headers:
|
39
|
+
Date:
|
40
|
+
- Tue, 25 Aug 2015 02:09:50 GMT
|
41
|
+
Server:
|
42
|
+
- Apache
|
43
|
+
Connection:
|
44
|
+
- close
|
45
|
+
Content-Length:
|
46
|
+
- '2251'
|
47
|
+
Set-Cookie:
|
48
|
+
- X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
|
49
|
+
- X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D1859050325;
|
50
|
+
domain=.paypal.com; path=/; Secure; HttpOnly
|
51
|
+
Content-Type:
|
52
|
+
- text/xml; charset=utf-8
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
56
|
+
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
57
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
58
|
+
xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
|
59
|
+
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
|
60
|
+
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes"
|
61
|
+
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security
|
62
|
+
xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials
|
63
|
+
xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials
|
64
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username
|
65
|
+
xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature
|
66
|
+
xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body
|
67
|
+
id="_0"><DoExpressCheckoutPaymentResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp
|
68
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">2015-08-25T02:09:50Z</Timestamp><Ack
|
69
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">96e0cc8972f94</CorrelationID><Errors
|
70
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"><ShortMessage
|
71
|
+
xsi:type="xs:string">Security error</ShortMessage><LongMessage xsi:type="xs:string">Security
|
72
|
+
header is not valid</LongMessage><ErrorCode xsi:type="xs:token">10002</ErrorCode><SeverityCode
|
73
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode></Errors><Version
|
74
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">72</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build><DoExpressCheckoutPaymentResponseDetails
|
75
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:DoExpressCheckoutPaymentResponseDetailsType"></DoExpressCheckoutPaymentResponseDetails></DoExpressCheckoutPaymentResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
76
|
+
http_version:
|
77
|
+
recorded_at: Tue, 25 Aug 2015 02:09:50 GMT
|
78
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,171 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-3t.sandbox.paypal.com/2.0/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |-
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xmlns:n1="urn:ebay:apis:eBLBaseComponents" env:mustUnderstand="0"><n1:Credentials><n1:Username>jb-us-seller_api1.paypal.com</n1:Username><n1:Password>WX4WTU3S8MY44S7F</n1:Password><n1:Subject>sell_1342421142_biz@gmail.com</n1:Subject><n1:Signature>AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy</n1:Signature></n1:Credentials></RequesterCredentials></env:Header><env:Body><SetExpressCheckoutReq xmlns="urn:ebay:api:PayPalAPI">
|
10
|
+
<SetExpressCheckoutRequest xmlns:n2="urn:ebay:apis:eBLBaseComponents">
|
11
|
+
<n2:Version>72</n2:Version>
|
12
|
+
<n2:SetExpressCheckoutRequestDetails>
|
13
|
+
<n2:ReturnURL>http://www.rubyplus.com</n2:ReturnURL>
|
14
|
+
<n2:CancelURL>http://www.rubyplus.com/about</n2:CancelURL>
|
15
|
+
<n2:ReqBillingAddress>0</n2:ReqBillingAddress>
|
16
|
+
<n2:NoShipping>0</n2:NoShipping>
|
17
|
+
<n2:AddressOverride>0</n2:AddressOverride>
|
18
|
+
<n2:SolutionType>Sole</n2:SolutionType>
|
19
|
+
<n2:LandingPage>Billing</n2:LandingPage>
|
20
|
+
<n2:PaymentDetails>
|
21
|
+
<n2:OrderTotal currencyID="USD">2.00</n2:OrderTotal>
|
22
|
+
<n2:Custom>custom</n2:Custom>
|
23
|
+
<n2:ButtonSource>ActiveMerchant</n2:ButtonSource>
|
24
|
+
<n2:PaymentAction>Sale</n2:PaymentAction>
|
25
|
+
</n2:PaymentDetails>
|
26
|
+
</n2:SetExpressCheckoutRequestDetails>
|
27
|
+
</SetExpressCheckoutRequest>
|
28
|
+
</SetExpressCheckoutReq>
|
29
|
+
</env:Body></env:Envelope>
|
30
|
+
headers:
|
31
|
+
Content-Type:
|
32
|
+
- application/x-www-form-urlencoded
|
33
|
+
Accept-Encoding:
|
34
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
35
|
+
Accept:
|
36
|
+
- "*/*"
|
37
|
+
User-Agent:
|
38
|
+
- Ruby
|
39
|
+
response:
|
40
|
+
status:
|
41
|
+
code: 200
|
42
|
+
message: OK
|
43
|
+
headers:
|
44
|
+
Date:
|
45
|
+
- Tue, 25 Aug 2015 02:45:13 GMT
|
46
|
+
Server:
|
47
|
+
- Apache
|
48
|
+
Connection:
|
49
|
+
- close
|
50
|
+
Content-Length:
|
51
|
+
- '1788'
|
52
|
+
Set-Cookie:
|
53
|
+
- X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
|
54
|
+
- X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D3117865813;
|
55
|
+
domain=.paypal.com; path=/; Secure; HttpOnly
|
56
|
+
Content-Type:
|
57
|
+
- text/xml; charset=utf-8
|
58
|
+
body:
|
59
|
+
encoding: UTF-8
|
60
|
+
string: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
61
|
+
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
62
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
63
|
+
xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
|
64
|
+
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
|
65
|
+
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes"
|
66
|
+
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security
|
67
|
+
xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials
|
68
|
+
xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials
|
69
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username
|
70
|
+
xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature
|
71
|
+
xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body
|
72
|
+
id="_0"><SetExpressCheckoutResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp
|
73
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">2015-08-25T02:45:13Z</Timestamp><Ack
|
74
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">840d2f6d192f3</CorrelationID><Version
|
75
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">72</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build><Token
|
76
|
+
xsi:type="ebl:ExpressCheckoutTokenType">EC-8B9247840P4755359</Token></SetExpressCheckoutResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
77
|
+
http_version:
|
78
|
+
recorded_at: Tue, 25 Aug 2015 02:45:13 GMT
|
79
|
+
- request:
|
80
|
+
method: post
|
81
|
+
uri: https://api-3t.sandbox.paypal.com/2.0/
|
82
|
+
body:
|
83
|
+
encoding: UTF-8
|
84
|
+
string: |-
|
85
|
+
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xmlns:n1="urn:ebay:apis:eBLBaseComponents" env:mustUnderstand="0"><n1:Credentials><n1:Username>jb-us-seller_api1.paypal.com</n1:Username><n1:Password>WX4WTU3S8MY44S7F</n1:Password><n1:Subject>sell_1342421142_biz@gmail.com</n1:Subject><n1:Signature>AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy</n1:Signature></n1:Credentials></RequesterCredentials></env:Header><env:Body><GetExpressCheckoutDetailsReq xmlns="urn:ebay:api:PayPalAPI">
|
86
|
+
<GetExpressCheckoutDetailsRequest xmlns:n2="urn:ebay:apis:eBLBaseComponents">
|
87
|
+
<n2:Version>72</n2:Version>
|
88
|
+
<Token>EC-8B9247840P4755359</Token>
|
89
|
+
</GetExpressCheckoutDetailsRequest>
|
90
|
+
</GetExpressCheckoutDetailsReq>
|
91
|
+
</env:Body></env:Envelope>
|
92
|
+
headers:
|
93
|
+
Content-Type:
|
94
|
+
- application/x-www-form-urlencoded
|
95
|
+
Accept-Encoding:
|
96
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
97
|
+
Accept:
|
98
|
+
- "*/*"
|
99
|
+
User-Agent:
|
100
|
+
- Ruby
|
101
|
+
response:
|
102
|
+
status:
|
103
|
+
code: 200
|
104
|
+
message: OK
|
105
|
+
headers:
|
106
|
+
Date:
|
107
|
+
- Tue, 25 Aug 2015 02:45:13 GMT
|
108
|
+
Server:
|
109
|
+
- Apache
|
110
|
+
Connection:
|
111
|
+
- close
|
112
|
+
Content-Length:
|
113
|
+
- '4884'
|
114
|
+
Set-Cookie:
|
115
|
+
- X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
|
116
|
+
- X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D3117865813;
|
117
|
+
domain=.paypal.com; path=/; Secure; HttpOnly
|
118
|
+
Content-Type:
|
119
|
+
- text/xml; charset=utf-8
|
120
|
+
body:
|
121
|
+
encoding: UTF-8
|
122
|
+
string: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
|
123
|
+
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
124
|
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
125
|
+
xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"
|
126
|
+
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
|
127
|
+
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes"
|
128
|
+
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security
|
129
|
+
xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials
|
130
|
+
xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials
|
131
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username
|
132
|
+
xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature
|
133
|
+
xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body
|
134
|
+
id="_0"><GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp
|
135
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">2015-08-25T02:45:13Z</Timestamp><Ack
|
136
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">ad5aa76187289</CorrelationID><Version
|
137
|
+
xmlns="urn:ebay:apis:eBLBaseComponents">72</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build><GetExpressCheckoutDetailsResponseDetails
|
138
|
+
xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:GetExpressCheckoutDetailsResponseDetailsType"><Token
|
139
|
+
xsi:type="ebl:ExpressCheckoutTokenType">EC-8B9247840P4755359</Token><PayerInfo
|
140
|
+
xsi:type="ebl:PayerInfoType"><Payer xsi:type="ebl:EmailAddressType"></Payer><PayerID
|
141
|
+
xsi:type="ebl:UserIDType"></PayerID><PayerStatus xsi:type="ebl:PayPalUserStatusCodeType">unverified</PayerStatus><PayerName
|
142
|
+
xsi:type="ebl:PersonNameType"><Salutation xmlns="urn:ebay:apis:eBLBaseComponents"></Salutation><FirstName
|
143
|
+
xmlns="urn:ebay:apis:eBLBaseComponents"></FirstName><MiddleName xmlns="urn:ebay:apis:eBLBaseComponents"></MiddleName><LastName
|
144
|
+
xmlns="urn:ebay:apis:eBLBaseComponents"></LastName><Suffix xmlns="urn:ebay:apis:eBLBaseComponents"></Suffix></PayerName><PayerBusiness
|
145
|
+
xsi:type="xs:string"></PayerBusiness><Address xsi:type="ebl:AddressType"><Name
|
146
|
+
xsi:type="xs:string"></Name><Street1 xsi:type="xs:string"></Street1><Street2
|
147
|
+
xsi:type="xs:string"></Street2><CityName xsi:type="xs:string"></CityName><StateOrProvince
|
148
|
+
xsi:type="xs:string"></StateOrProvince><CountryName></CountryName><PostalCode
|
149
|
+
xsi:type="xs:string"></PostalCode><AddressOwner xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner><AddressStatus
|
150
|
+
xsi:type="ebl:AddressStatusCodeType">None</AddressStatus></Address></PayerInfo><Custom
|
151
|
+
xsi:type="xs:string">custom</Custom><BillingAgreementAcceptedStatus>false</BillingAgreementAcceptedStatus><PaymentDetails
|
152
|
+
xsi:type="ebl:PaymentDetailsType"><OrderTotal xsi:type="cc:BasicAmountType"
|
153
|
+
currencyID="USD">2.00</OrderTotal><ShippingTotal xsi:type="cc:BasicAmountType"
|
154
|
+
currencyID="USD">0.00</ShippingTotal><HandlingTotal xsi:type="cc:BasicAmountType"
|
155
|
+
currencyID="USD">0.00</HandlingTotal><TaxTotal xsi:type="cc:BasicAmountType"
|
156
|
+
currencyID="USD">0.00</TaxTotal><Custom xsi:type="xs:string">custom</Custom><ShipToAddress
|
157
|
+
xsi:type="ebl:AddressType"><Name xsi:type="xs:string"></Name><Street1 xsi:type="xs:string"></Street1><Street2
|
158
|
+
xsi:type="xs:string"></Street2><CityName xsi:type="xs:string"></CityName><StateOrProvince
|
159
|
+
xsi:type="xs:string"></StateOrProvince><CountryName></CountryName><Phone xsi:type="xs:string"></Phone><PostalCode
|
160
|
+
xsi:type="xs:string"></PostalCode><AddressID xsi:type="xs:string"></AddressID><AddressOwner
|
161
|
+
xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner><ExternalAddressID
|
162
|
+
xsi:type="xs:string"></ExternalAddressID><AddressStatus xsi:type="ebl:AddressStatusCodeType">None</AddressStatus></ShipToAddress><InsuranceTotal
|
163
|
+
xsi:type="cc:BasicAmountType" currencyID="USD">0.00</InsuranceTotal><ShippingDiscount
|
164
|
+
xsi:type="cc:BasicAmountType" currencyID="USD">0.00</ShippingDiscount><InsuranceOptionOffered
|
165
|
+
xsi:type="xs:string">false</InsuranceOptionOffered><SellerDetails xsi:type="ebl:SellerDetailsType"></SellerDetails><PaymentRequestID
|
166
|
+
xsi:type="xs:string"></PaymentRequestID><OrderURL xsi:type="xs:string"></OrderURL><SoftDescriptor
|
167
|
+
xsi:type="xs:string"></SoftDescriptor></PaymentDetails><CheckoutStatus xsi:type="xs:string">PaymentActionNotInitiated</CheckoutStatus><PaymentRequestInfo
|
168
|
+
xsi:type="ebl:PaymentRequestInfoType"></PaymentRequestInfo></GetExpressCheckoutDetailsResponseDetails></GetExpressCheckoutDetailsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
169
|
+
http_version:
|
170
|
+
recorded_at: Tue, 25 Aug 2015 02:45:13 GMT
|
171
|
+
recorded_with: VCR 2.9.3
|
@@ -4,6 +4,11 @@ module Yukon
|
|
4
4
|
|
5
5
|
class PaymentGateway
|
6
6
|
|
7
|
+
# Pre-requisite - Rails app must configure the login, password and signature in config/initializers/yukon.rb
|
8
|
+
#
|
9
|
+
# Argument : seller's email address
|
10
|
+
#
|
11
|
+
# Returns ActiveMerchant::Billing::PaypalExpressGateway object
|
7
12
|
def self.create(seller_email)
|
8
13
|
options = {
|
9
14
|
login: Yukon.login,
|
@@ -4,11 +4,22 @@ module Yukon
|
|
4
4
|
def initialize(seller_email)
|
5
5
|
@gateway = PaymentGateway.create(seller_email)
|
6
6
|
end
|
7
|
+
|
7
8
|
#
|
8
9
|
# Part of Web Request 1
|
9
10
|
#
|
10
11
|
# Step 1 : SetExpressCheckout
|
11
|
-
#
|
12
|
+
#
|
13
|
+
# price : Amount to be charged in cents
|
14
|
+
# ip : Buyer IP address
|
15
|
+
# return_url : URL to return after completing the purchase
|
16
|
+
# cancel_return_url : URL to return if purchase is cancelled
|
17
|
+
# seller_email : Email address of the seller
|
18
|
+
# notify_url : IPN notification URL (optional)
|
19
|
+
# custom : custom variable
|
20
|
+
#
|
21
|
+
# Returns : PaypalExpressResponse object
|
22
|
+
#
|
12
23
|
def set_express_checkout(price, ip, return_url, cancel_return_url, custom)
|
13
24
|
response = @gateway.setup_purchase(price,
|
14
25
|
ip: ip,
|
@@ -23,6 +34,10 @@ module Yukon
|
|
23
34
|
# Part of Web Request 1
|
24
35
|
#
|
25
36
|
# End of Step 1 : Redirect to Paypal URL : args - response
|
37
|
+
#
|
38
|
+
# Argument : PaypalExpressResponse
|
39
|
+
#
|
40
|
+
# Returns URL : https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-5TC81926SR152035B
|
26
41
|
def redirect_url_for(response)
|
27
42
|
@gateway.redirect_url_for(response.token)
|
28
43
|
end
|
@@ -30,7 +45,11 @@ module Yukon
|
|
30
45
|
#
|
31
46
|
# Part of Web Request 2
|
32
47
|
#
|
33
|
-
# Step 2 : GetExpressCheckoutDetails
|
48
|
+
# Step 2 : GetExpressCheckoutDetails
|
49
|
+
#
|
50
|
+
# Argument - token in string format
|
51
|
+
#
|
52
|
+
# Returns : details
|
34
53
|
def get_express_checkout_details(token)
|
35
54
|
@gateway.details_for(token)
|
36
55
|
end
|
@@ -39,8 +58,17 @@ module Yukon
|
|
39
58
|
# Part of Web Request 2
|
40
59
|
#
|
41
60
|
# Step 3 : DoExpressCheckoutPayment
|
42
|
-
|
43
|
-
|
61
|
+
#
|
62
|
+
# Arguments
|
63
|
+
#
|
64
|
+
# price : Amount to be charged in cents
|
65
|
+
# ip, token and payer_id
|
66
|
+
# Returns PaypalExpressResponse object
|
67
|
+
def do_express_checkout_payment(price, ip, token, payer_id)
|
68
|
+
@gateway.purchase(price,
|
69
|
+
ip: ip,
|
70
|
+
token: token,
|
71
|
+
payer_id: payer_id)
|
44
72
|
end
|
45
73
|
|
46
74
|
end
|
data/lib/yukon/version.rb
CHANGED
data/yukon.gemspec
CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
+
spec.required_ruby_version = '>= 2.2.2'
|
23
|
+
|
22
24
|
spec.add_dependency 'activemerchant', "~> 1.52"
|
23
25
|
spec.add_dependency 'lyon', "~> 0.1"
|
24
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yukon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bala Paranj
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -129,6 +129,8 @@ files:
|
|
129
129
|
- config/paypal-sample.yml
|
130
130
|
- config/paypal.yml
|
131
131
|
- fixtures/vcr_cassettes/payments.yml
|
132
|
+
- fixtures/vcr_cassettes/purchase.yml
|
133
|
+
- fixtures/vcr_cassettes/step2.yml
|
132
134
|
- lib/yukon.rb
|
133
135
|
- lib/yukon/payment_gateway.rb
|
134
136
|
- lib/yukon/payment_processor.rb
|
@@ -146,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
148
|
requirements:
|
147
149
|
- - ">="
|
148
150
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
151
|
+
version: 2.2.2
|
150
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
153
|
requirements:
|
152
154
|
- - ">="
|
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
158
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.4.
|
159
|
+
rubygems_version: 2.4.5.1
|
158
160
|
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: Payment processing using Paypal.
|