killbill-paypal-express 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Jarfile.lock +2 -2
- data/NEWS +5 -0
- data/VERSION +1 -1
- data/db/ddl.sql +3 -1
- data/db/migrate/20161209090000_add_indexes.rb +7 -0
- data/db/schema.rb +2 -0
- data/lib/paypal_express/api.rb +25 -13
- data/lib/paypal_express/application.rb +31 -0
- data/lib/paypal_express/models/response.rb +9 -1
- data/lib/paypal_express/private_api.rb +5 -0
- data/pom.xml +1 -1
- data/spec/fixtures/DoExpressCheckoutPayment-duplicate.xml +54 -0
- data/spec/fixtures/GetExpressCheckoutDetails-success.xml +102 -0
- data/spec/paypal_express/remote/baid_spec.rb +142 -70
- data/spec/paypal_express/remote/hpp_spec.rb +5 -5
- data/spec/paypal_express/remote/hpp_spec_helpers.rb +199 -74
- data/spec/paypal_express/response_spec.rb +79 -0
- metadata +118 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 970b025716dc5389cd01ac25702ce931e3686296
|
4
|
+
data.tar.gz: faf8930e662f33a926a06c8d81c64740aa7c6d3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3fbf7d32ed777c35a0da4d056a0bb2bbb0b328f3551d1381f1d8feb60cb96726051730cadec9321d345ce93f0fc57b52a5ea3ab8dc1eb8867c453454445fa1
|
7
|
+
data.tar.gz: 63c0b6a1eeeb30c105e2200b67394213a5d9f52bffe3e467bfcb2f2efbf3853132853ba01fe9b6ed398a66e9e7f27962bac5147d9e4ef8b1902405204684c1f1
|
data/Gemfile.lock
CHANGED
data/Jarfile.lock
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
- org.kill-bill.commons:killbill-clock:jar:0.20
|
14
14
|
- org.kill-bill.billing:killbill-util:jar:0.18.0
|
15
15
|
- com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.4.5
|
16
|
+
- org.bouncycastle:bcprov-jdk15on:jar:1.55
|
17
|
+
- org.bouncycastle:bcpkix-jdk15on:jar:1.55
|
16
18
|
- org.kill-bill.billing.plugin:killbill-plugin-api-entitlement:jar:0.23
|
17
19
|
- org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4:jar:1.16
|
18
20
|
- com.h2database:h2:jar:1.4.186
|
@@ -33,11 +35,9 @@
|
|
33
35
|
- io.dropwizard.metrics:metrics-ehcache:jar:3.1.1
|
34
36
|
- org.jdbi:jdbi:jar:2.62
|
35
37
|
- com.fasterxml.jackson.core:jackson-core:jar:2.4.5
|
36
|
-
- org.bouncycastle:bcpkix-jdk15on:jar:1.54
|
37
38
|
- org.apache.felix:org.apache.felix.framework:jar:4.4.1
|
38
39
|
- org.joda:joda-money:jar:0.9
|
39
40
|
- org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.23
|
40
|
-
- org.bouncycastle:bcprov-jdk15on:jar:1.54
|
41
41
|
- org.apache.shiro:shiro-core:jar:1.2.3
|
42
42
|
- org.kill-bill.billing:killbill-internal-api:jar:0.18.0
|
43
43
|
- org.kill-bill.billing:killbill-util:jar:tests:0.18.0
|
data/NEWS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.0.
|
1
|
+
5.0.1
|
data/db/ddl.sql
CHANGED
@@ -114,5 +114,7 @@ CREATE TABLE `paypal_express_responses` (
|
|
114
114
|
`kb_account_id` varchar(255) DEFAULT NULL,
|
115
115
|
`kb_tenant_id` varchar(255) DEFAULT NULL,
|
116
116
|
PRIMARY KEY (`id`),
|
117
|
-
KEY `idx_paypal_express_responses_on_kb_payment_id_kb_tenant_id` (`kb_payment_id`, `kb_tenant_id`)
|
117
|
+
KEY `idx_paypal_express_responses_on_kb_payment_id_kb_tenant_id` (`kb_payment_id`, `kb_tenant_id`),
|
118
|
+
KEY `idx_paypal_express_responses_on_kb_account_id` (`kb_account_id`),
|
119
|
+
KEY `idx_paypal_express_responses_on_payer_email` (`payer_email`)
|
118
120
|
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddIndexes < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
add_index(:paypal_express_responses, :kb_account_id, :name => 'idx_paypal_express_responses_on_kb_account_id')
|
5
|
+
add_index(:paypal_express_responses, :payer_email, :name => 'idx_paypal_express_responses_on_payer_email')
|
6
|
+
end
|
7
|
+
end
|
data/db/schema.rb
CHANGED
@@ -117,4 +117,6 @@ ActiveRecord::Schema.define(:version => 20151008153635) do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
add_index(:paypal_express_responses, [:kb_payment_id, :kb_tenant_id], :name => 'idx_paypal_express_responses_on_kb_payment_id_kb_tenant_id')
|
120
|
+
add_index(:paypal_express_responses, :kb_account_id, :name => 'idx_paypal_express_responses_on_kb_account_id')
|
121
|
+
add_index(:paypal_express_responses, :payer_email, :name => 'idx_paypal_express_responses_on_payer_email')
|
120
122
|
end
|
data/lib/paypal_express/api.rb
CHANGED
@@ -131,10 +131,10 @@ module Killbill #:nodoc:
|
|
131
131
|
# Go to Paypal to get the Payer id (GetExpressCheckoutDetails call)
|
132
132
|
payment_processor_account_id = find_value_from_properties(properties, :payment_processor_account_id)
|
133
133
|
payment_processor_account_id ||= find_payment_processor_id_from_initial_call(kb_account_id, context.tenant_id, token)
|
134
|
-
|
134
|
+
payer_info = get_payer_info(token, kb_account_id, context.tenant_id, payment_processor_account_id)
|
135
135
|
options = {
|
136
136
|
:paypal_express_token => token,
|
137
|
-
:paypal_express_payer_id => payer_id,
|
137
|
+
:paypal_express_payer_id => payer_info.payer_id,
|
138
138
|
:payment_processor_account_id => payment_processor_account_id
|
139
139
|
}
|
140
140
|
end
|
@@ -281,19 +281,25 @@ module Killbill #:nodoc:
|
|
281
281
|
@response_model.last_token(kb_account_id, kb_tenant_id)
|
282
282
|
end
|
283
283
|
|
284
|
-
def
|
285
|
-
|
284
|
+
def get_payer_info(token,
|
285
|
+
kb_account_id,
|
286
|
+
kb_tenant_id,
|
287
|
+
payment_processor_account_id,
|
288
|
+
kb_payment_id = nil,
|
289
|
+
kb_payment_transaction_id = nil,
|
290
|
+
transaction_type = nil)
|
291
|
+
raise 'Could not retrieve the payer info: the token is missing' if token.blank?
|
286
292
|
|
287
293
|
# Go to Paypal to get the Payer id (GetExpressCheckoutDetails call)
|
288
294
|
payment_processor_account_id = payment_processor_account_id || :default
|
289
295
|
gateway = lookup_gateway(payment_processor_account_id, kb_tenant_id)
|
290
296
|
gw_response = gateway.details_for(token)
|
291
|
-
response, transaction = save_response_and_transaction(gw_response, :details_for, kb_account_id, kb_tenant_id, payment_processor_account_id)
|
297
|
+
response, transaction = save_response_and_transaction(gw_response, :details_for, kb_account_id, kb_tenant_id, payment_processor_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type)
|
292
298
|
|
293
299
|
raise response.message unless response.success?
|
294
|
-
raise "Could not
|
300
|
+
raise "Could not retrieve the payer info for token #{token}" if response.payer_id.blank?
|
295
301
|
|
296
|
-
response
|
302
|
+
response
|
297
303
|
end
|
298
304
|
|
299
305
|
def add_required_options(kb_payment_transaction_id, kb_payment_method_id, context, options)
|
@@ -396,13 +402,14 @@ module Killbill #:nodoc:
|
|
396
402
|
payment_processor_account_id ||= find_payment_processor_id_from_initial_call(kb_account_id, context.tenant_id, options[:token])
|
397
403
|
options[:payment_processor_account_id] = payment_processor_account_id
|
398
404
|
|
399
|
-
# Populate the Payer id if missing
|
400
|
-
options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
|
401
405
|
begin
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
+
payer_info = get_payer_info(options[:token],
|
407
|
+
kb_account_id,
|
408
|
+
context.tenant_id,
|
409
|
+
payment_processor_account_id,
|
410
|
+
kb_payment_id,
|
411
|
+
kb_payment_transaction_id,
|
412
|
+
transaction_type)
|
406
413
|
rescue => e
|
407
414
|
# Maybe invalid token?
|
408
415
|
response = @response_model.create(:api_call => api_call_type,
|
@@ -419,6 +426,11 @@ module Killbill #:nodoc:
|
|
419
426
|
:message => { :payment_plugin_status => :CANCELED, :exception_class => e.class.to_s, :exception_message => e.message }.to_json)
|
420
427
|
return response.to_transaction_info_plugin(nil)
|
421
428
|
end
|
429
|
+
options[:payer_id] = ::Killbill::Plugin::ActiveMerchant::Utils.normalized(properties_hash, :payer_id)
|
430
|
+
if options[:payer_id].nil?
|
431
|
+
options[:payer_id] = payer_info.payer_id
|
432
|
+
end
|
433
|
+
options[:payer_email] = payer_info.payer_email
|
422
434
|
|
423
435
|
properties = merge_properties(properties, options)
|
424
436
|
dispatch_to_gateways(api_call_type, kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context, gateway_call_proc, nil, {:payer_id => options[:payer_id]})
|
@@ -103,3 +103,34 @@ get '/plugins/killbill-paypal-express/1.0/responses/:id', :provides => 'json' do
|
|
103
103
|
status 404
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
# curl -v http://127.0.0.1:9292/plugins/killbill-paypal-express/1.0/accounts/somebody@example.com
|
108
|
+
get '/plugins/killbill-paypal-express/1.0/accounts/:email', :provides => 'json' do
|
109
|
+
if ids = ::Killbill::PaypalExpress::PaypalExpressResponse.uniq.where(:payer_email => params[:email]).pluck(:kb_account_id)
|
110
|
+
ids.to_json
|
111
|
+
else
|
112
|
+
status 404
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# curl -v http://127.0.0.1:9292/plugins/killbill-paypal-express/1.0/account_external_keys/somebody@example.com?kb_tenant_id=some_uuid
|
117
|
+
get '/plugins/killbill-paypal-express/1.0/account_external_keys/:email', :provides => 'json' do
|
118
|
+
if ids = ::Killbill::PaypalExpress::PaypalExpressResponse.uniq.where(:payer_email => params[:email]).pluck(:kb_account_id)
|
119
|
+
kb_tenant_id = request.GET['kb_tenant_id']
|
120
|
+
kb_tenant = request.env['killbill_tenant']
|
121
|
+
kb_tenant_id ||= kb_tenant.id.to_s unless kb_tenant.nil?
|
122
|
+
|
123
|
+
plugin(session).get_external_keys_for_accounts(ids, kb_tenant_id).to_json
|
124
|
+
else
|
125
|
+
status 404
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# curl -v http://127.0.0.1:9292/plugins/killbill-paypal-express/1.0/payer_emails/41d95965-8213-4434-ac04-0f7dbe51988c
|
130
|
+
get '/plugins/killbill-paypal-express/1.0/payer_emails/:kb_account_id', :provides => 'json' do
|
131
|
+
if emails = ::Killbill::PaypalExpress::PaypalExpressResponse.uniq.where(:kb_account_id => params[:kb_account_id]).where("payer_email IS NOT NULL").pluck(:payer_email)
|
132
|
+
emails.to_json
|
133
|
+
else
|
134
|
+
status 404
|
135
|
+
end
|
136
|
+
end
|
@@ -6,6 +6,10 @@ module Killbill #:nodoc:
|
|
6
6
|
|
7
7
|
has_one :paypal_express_transaction
|
8
8
|
|
9
|
+
def self.ignore_none(value)
|
10
|
+
value == 'none' ? nil : value
|
11
|
+
end
|
12
|
+
|
9
13
|
def self.from_response(api_call, kb_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type, payment_processor_account_id, kb_tenant_id, response, extra_params = {}, model = ::Killbill::PaypalExpress::PaypalExpressResponse)
|
10
14
|
super(api_call,
|
11
15
|
kb_account_id,
|
@@ -47,7 +51,7 @@ module Killbill #:nodoc:
|
|
47
51
|
:payment_info_exchangerate => (extract(response, 'PaymentInfo', 'ExchangeRate') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ExchangeRate')),
|
48
52
|
:payment_info_paymentstatus => (extract(response, 'PaymentInfo', 'PaymentStatus') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'PaymentStatus')),
|
49
53
|
:payment_info_pendingreason => (extract(response, 'PaymentInfo', 'PendingReason') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'PendingReason')),
|
50
|
-
:payment_info_reasoncode => (extract(response, 'PaymentInfo', 'ReasonCode') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ReasonCode')),
|
54
|
+
:payment_info_reasoncode => (ignore_none(extract(response, 'PaymentInfo', 'ReasonCode')) || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ReasonCode') || extract(response, 'error_codes')),
|
51
55
|
:payment_info_protectioneligibility => (extract(response, 'PaymentInfo', 'ProtectionEligibility') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ProtectionEligibility')),
|
52
56
|
:payment_info_protectioneligibilitytype => (extract(response, 'PaymentInfo', 'ProtectionEligibilityType') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ProtectionEligibilityType')),
|
53
57
|
:payment_info_shipamount => (extract(response, 'PaymentInfo', 'ShipAmount') || extract(response, 'PaymentTransactionDetails', 'PaymentInfo', 'ShipAmount')),
|
@@ -85,6 +89,10 @@ module Killbill #:nodoc:
|
|
85
89
|
:message => { :payment_plugin_status => :CANCELED, :exception_message => 'Token expired. Payment Canceled by Janitor.' }.to_json)
|
86
90
|
end
|
87
91
|
|
92
|
+
def gateway_error_code
|
93
|
+
payment_info_reasoncode
|
94
|
+
end
|
95
|
+
|
88
96
|
def to_transaction_info_plugin(transaction=nil)
|
89
97
|
t_info_plugin = super(transaction)
|
90
98
|
|
@@ -36,6 +36,11 @@ module Killbill #:nodoc:
|
|
36
36
|
gateway = gateway(payment_processor_account_id, kb_tenant_id)
|
37
37
|
gateway.redirect_url_for(response.token)
|
38
38
|
end
|
39
|
+
|
40
|
+
def get_external_keys_for_accounts(kb_account_ids, kb_tenant_id)
|
41
|
+
context = kb_apis.create_context(kb_tenant_id)
|
42
|
+
kb_account_ids.map {|id| kb_apis.account_user_api.get_account_by_id(id, context).external_key }
|
43
|
+
end
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
data/pom.xml
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
<groupId>org.kill-bill.billing.plugin.ruby</groupId>
|
27
27
|
<artifactId>paypal-express-plugin</artifactId>
|
28
28
|
<packaging>pom</packaging>
|
29
|
-
<version>5.0.
|
29
|
+
<version>5.0.1</version>
|
30
30
|
<name>paypal-express-plugin</name>
|
31
31
|
<url>http://github.com/killbill/killbill-paypal-express-plugin</url>
|
32
32
|
<description>Plugin for accessing Paypal Express Checkout as a payment gateway</description>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
<SOAP-ENV:Header>
|
4
|
+
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
|
5
|
+
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
|
6
|
+
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
|
7
|
+
<Username xsi:type="xs:string"/>
|
8
|
+
<Password xsi:type="xs:string"/>
|
9
|
+
<Signature xsi:type="xs:string"/>
|
10
|
+
<Subject xsi:type="xs:string"/>
|
11
|
+
</Credentials>
|
12
|
+
</RequesterCredentials>
|
13
|
+
</SOAP-ENV:Header>
|
14
|
+
<SOAP-ENV:Body id="_0">
|
15
|
+
<DoExpressCheckoutPaymentResponse xmlns="urn:ebay:api:PayPalAPI">
|
16
|
+
<Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2016-11-23T01:50:51Z</Timestamp>
|
17
|
+
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">SuccessWithWarning</Ack>
|
18
|
+
<CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">cfce8071e839</CorrelationID>
|
19
|
+
<Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType">
|
20
|
+
<ShortMessage xsi:type="xs:string">Duplicate Request</ShortMessage>
|
21
|
+
<LongMessage xsi:type="xs:string">A successful transaction has already been completed for this token.</LongMessage>
|
22
|
+
<ErrorCode xsi:type="xs:token">11607</ErrorCode>
|
23
|
+
<SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Warning</SeverityCode>
|
24
|
+
</Errors>
|
25
|
+
<Version xmlns="urn:ebay:apis:eBLBaseComponents">124</Version>
|
26
|
+
<Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build>
|
27
|
+
<DoExpressCheckoutPaymentResponseDetails xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:DoExpressCheckoutPaymentResponseDetailsType">
|
28
|
+
<Token xsi:type="ebl:ExpressCheckoutTokenType">EC-MY_TOKEN</Token>
|
29
|
+
<PaymentInfo xsi:type="ebl:PaymentInfoType">
|
30
|
+
<TransactionID>3K289148GS508731G</TransactionID>
|
31
|
+
<ParentTransactionID xsi:type="ebl:TransactionId"/>
|
32
|
+
<ReceiptID/>
|
33
|
+
<TransactionType xsi:type="ebl:PaymentTransactionCodeType">express-checkout</TransactionType>
|
34
|
+
<PaymentType xsi:type="ebl:PaymentCodeType">instant</PaymentType>
|
35
|
+
<PaymentDate xsi:type="xs:dateTime">2016-11-23T01:50:43Z</PaymentDate>
|
36
|
+
<GrossAmount currencyID="USD" xsi:type="cc:BasicAmountType">100.00</GrossAmount>
|
37
|
+
<FeeAmount currencyID="USD" xsi:type="cc:BasicAmountType">3.20</FeeAmount>
|
38
|
+
<TaxAmount currencyID="USD" xsi:type="cc:BasicAmountType">0.00</TaxAmount>
|
39
|
+
<ExchangeRate xsi:type="xs:string"/>
|
40
|
+
<PaymentStatus xsi:type="ebl:PaymentStatusCodeType">Refunded</PaymentStatus>
|
41
|
+
<PendingReason xsi:type="ebl:PendingStatusCodeType">none</PendingReason>
|
42
|
+
<ReasonCode xsi:type="ebl:ReversalReasonCodeType">none</ReasonCode>
|
43
|
+
<ProtectionEligibility xsi:type="xs:string">Eligible</ProtectionEligibility>
|
44
|
+
<ProtectionEligibilityType xsi:type="xs:string">ItemNotReceivedEligible,UnauthorizedPaymentEligible</ProtectionEligibilityType>
|
45
|
+
<SellerDetails xsi:type="ebl:SellerDetailsType">
|
46
|
+
<SecureMerchantAccountID xsi:type="ebl:UserIDType">MY_MERCHANT_ID</SecureMerchantAccountID>
|
47
|
+
</SellerDetails>
|
48
|
+
</PaymentInfo>
|
49
|
+
<SuccessPageRedirectRequested xsi:type="xs:string">false</SuccessPageRedirectRequested>
|
50
|
+
<CoupledPaymentInfo xsi:type="ebl:CoupledPaymentInfoType"/>
|
51
|
+
</DoExpressCheckoutPaymentResponseDetails>
|
52
|
+
</DoExpressCheckoutPaymentResponse>
|
53
|
+
</SOAP-ENV:Body>
|
54
|
+
</SOAP-ENV:Envelope>
|
@@ -0,0 +1,102 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
3
|
+
<SOAP-ENV:Header>
|
4
|
+
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"/>
|
5
|
+
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
|
6
|
+
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
|
7
|
+
<Username xsi:type="xs:string"/>
|
8
|
+
<Password xsi:type="xs:string"/>
|
9
|
+
<Signature xsi:type="xs:string"/>
|
10
|
+
<Subject xsi:type="xs:string"/>
|
11
|
+
</Credentials>
|
12
|
+
</RequesterCredentials>
|
13
|
+
</SOAP-ENV:Header>
|
14
|
+
<SOAP-ENV:Body id="_0">
|
15
|
+
<GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI">
|
16
|
+
<Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2016-11-23T01:50:39Z</Timestamp>
|
17
|
+
<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>
|
18
|
+
<CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">bb9e0ee3a9d12</CorrelationID>
|
19
|
+
<Version xmlns="urn:ebay:apis:eBLBaseComponents">124</Version>
|
20
|
+
<Build xmlns="urn:ebay:apis:eBLBaseComponents">000000</Build>
|
21
|
+
<GetExpressCheckoutDetailsResponseDetails xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:GetExpressCheckoutDetailsResponseDetailsType">
|
22
|
+
<Token xsi:type="ebl:ExpressCheckoutTokenType">EC-MY_TOKEN</Token>
|
23
|
+
<PayerInfo xsi:type="ebl:PayerInfoType">
|
24
|
+
<Payer xsi:type="ebl:EmailAddressType">test@example.com</Payer>
|
25
|
+
<PayerID xsi:type="ebl:UserIDType">MY_PAYER_ID</PayerID>
|
26
|
+
<PayerStatus xsi:type="ebl:PayPalUserStatusCodeType">verified</PayerStatus>
|
27
|
+
<PayerName xsi:type="ebl:PersonNameType">
|
28
|
+
<Salutation xmlns="urn:ebay:apis:eBLBaseComponents"/>
|
29
|
+
<FirstName xmlns="urn:ebay:apis:eBLBaseComponents">test</FirstName>
|
30
|
+
<MiddleName xmlns="urn:ebay:apis:eBLBaseComponents"/>
|
31
|
+
<LastName xmlns="urn:ebay:apis:eBLBaseComponents">buyer</LastName>
|
32
|
+
<Suffix xmlns="urn:ebay:apis:eBLBaseComponents"/>
|
33
|
+
</PayerName>
|
34
|
+
<PayerCountry xsi:type="ebl:CountryCodeType">US</PayerCountry>
|
35
|
+
<PayerBusiness xsi:type="xs:string"/>
|
36
|
+
<Address xsi:type="ebl:AddressType">
|
37
|
+
<Name xsi:type="xs:string">test buyer</Name>
|
38
|
+
<Street1 xsi:type="xs:string">1 Main St</Street1>
|
39
|
+
<Street2 xsi:type="xs:string"/>
|
40
|
+
<CityName xsi:type="xs:string">San Jose</CityName>
|
41
|
+
<StateOrProvince xsi:type="xs:string">CA</StateOrProvince>
|
42
|
+
<Country xsi:type="ebl:CountryCodeType">US</Country>
|
43
|
+
<CountryName>United States</CountryName>
|
44
|
+
<PostalCode xsi:type="xs:string">95131</PostalCode>
|
45
|
+
<AddressOwner xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner>
|
46
|
+
<AddressStatus xsi:type="ebl:AddressStatusCodeType">Confirmed</AddressStatus>
|
47
|
+
</Address>
|
48
|
+
</PayerInfo>
|
49
|
+
<InvoiceID xsi:type="xs:string">1234</InvoiceID>
|
50
|
+
<BillingAgreementAcceptedStatus>false</BillingAgreementAcceptedStatus>
|
51
|
+
<PaymentDetails xsi:type="ebl:PaymentDetailsType">
|
52
|
+
<OrderTotal currencyID="USD" xsi:type="cc:BasicAmountType">100.00</OrderTotal>
|
53
|
+
<ItemTotal currencyID="USD" xsi:type="cc:BasicAmountType">100.00</ItemTotal>
|
54
|
+
<ShippingTotal currencyID="USD" xsi:type="cc:BasicAmountType">0.00</ShippingTotal>
|
55
|
+
<HandlingTotal currencyID="USD" xsi:type="cc:BasicAmountType">0.00</HandlingTotal>
|
56
|
+
<TaxTotal currencyID="USD" xsi:type="cc:BasicAmountType">0.00</TaxTotal>
|
57
|
+
<InvoiceID xsi:type="xs:string">1234</InvoiceID>
|
58
|
+
<ShipToAddress xsi:type="ebl:AddressType">
|
59
|
+
<Name xsi:type="xs:string">test buyer</Name>
|
60
|
+
<Street1 xsi:type="xs:string">1 Main St</Street1>
|
61
|
+
<Street2 xsi:type="xs:string"/>
|
62
|
+
<CityName xsi:type="xs:string">San Jose</CityName>
|
63
|
+
<StateOrProvince xsi:type="xs:string">CA</StateOrProvince>
|
64
|
+
<Country xsi:type="ebl:CountryCodeType">US</Country>
|
65
|
+
<CountryName>United States</CountryName>
|
66
|
+
<Phone xsi:type="xs:string"/>
|
67
|
+
<PostalCode xsi:type="xs:string">95131</PostalCode>
|
68
|
+
<AddressID xsi:type="xs:string"/>
|
69
|
+
<AddressOwner xsi:type="ebl:AddressOwnerCodeType">PayPal</AddressOwner>
|
70
|
+
<ExternalAddressID xsi:type="xs:string"/>
|
71
|
+
<AddressStatus xsi:type="ebl:AddressStatusCodeType">Confirmed</AddressStatus>
|
72
|
+
<AddressNormalizationStatus xsi:type="ebl:AddressNormalizationStatusCodeType">None</AddressNormalizationStatus>
|
73
|
+
</ShipToAddress>
|
74
|
+
<InsuranceTotal currencyID="USD" xsi:type="cc:BasicAmountType">0.00</InsuranceTotal>
|
75
|
+
<ShippingDiscount currencyID="USD" xsi:type="cc:BasicAmountType">0.00</ShippingDiscount>
|
76
|
+
<InsuranceOptionOffered xsi:type="xs:string">false</InsuranceOptionOffered>
|
77
|
+
<SellerDetails xsi:type="ebl:SellerDetailsType">
|
78
|
+
<PayPalAccountID xsi:type="xs:string">test-facilitator@example.com</PayPalAccountID>
|
79
|
+
</SellerDetails>
|
80
|
+
<PaymentRequestID xsi:type="xs:string"/>
|
81
|
+
<OrderURL xsi:type="xs:string"/>
|
82
|
+
<SoftDescriptor xsi:type="xs:string"/>
|
83
|
+
</PaymentDetails>
|
84
|
+
<CheckoutStatus xsi:type="xs:string">PaymentActionNotInitiated</CheckoutStatus>
|
85
|
+
<PaymentRequestInfo xsi:type="ebl:PaymentRequestInfoType"/>
|
86
|
+
<PaymentInfo xsi:type="ebl:PaymentInfoType">
|
87
|
+
<TransactionID/>
|
88
|
+
<ParentTransactionID xsi:type="ebl:TransactionId"/>
|
89
|
+
<ReceiptID/>
|
90
|
+
<TransactionType xsi:type="ebl:PaymentTransactionCodeType">none</TransactionType>
|
91
|
+
<PaymentType xsi:type="ebl:PaymentCodeType">none</PaymentType>
|
92
|
+
<ExchangeRate xsi:type="xs:string"/>
|
93
|
+
<PaymentStatus xsi:type="ebl:PaymentStatusCodeType">None</PaymentStatus>
|
94
|
+
<PendingReason xsi:type="ebl:PendingStatusCodeType">none</PendingReason>
|
95
|
+
<ReasonCode xsi:type="ebl:ReversalReasonCodeType">none</ReasonCode>
|
96
|
+
<SellerDetails xsi:type="ebl:SellerDetailsType"/>
|
97
|
+
</PaymentInfo>
|
98
|
+
<CartChangeTolerance xsi:type="xs:string"/>
|
99
|
+
</GetExpressCheckoutDetailsResponseDetails>
|
100
|
+
</GetExpressCheckoutDetailsResponse>
|
101
|
+
</SOAP-ENV:Body>
|
102
|
+
</SOAP-ENV:Envelope>
|
@@ -23,14 +23,25 @@ shared_examples 'baid_spec_common' do
|
|
23
23
|
|
24
24
|
# Verify GET API
|
25
25
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
26
|
-
payment_infos.size.should ==
|
26
|
+
payment_infos.size.should == 2
|
27
|
+
# details_for
|
27
28
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
28
29
|
payment_infos[0].transaction_type.should == :PURCHASE
|
29
|
-
payment_infos[0].amount.should
|
30
|
-
payment_infos[0].currency.should
|
30
|
+
payment_infos[0].amount.should be_nil
|
31
|
+
payment_infos[0].currency.should be_nil
|
31
32
|
payment_infos[0].status.should == :PROCESSED
|
32
33
|
payment_infos[0].gateway_error.should == 'Success'
|
33
34
|
payment_infos[0].gateway_error_code.should be_nil
|
35
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
36
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
37
|
+
# purchase
|
38
|
+
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
39
|
+
payment_infos[1].transaction_type.should == :PURCHASE
|
40
|
+
payment_infos[1].amount.should == @amount
|
41
|
+
payment_infos[1].currency.should == @currency
|
42
|
+
payment_infos[1].status.should == :PROCESSED
|
43
|
+
payment_infos[1].gateway_error.should == 'Success'
|
44
|
+
payment_infos[1].gateway_error_code.should be_nil
|
34
45
|
find_value_from_properties(payment_infos[0].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
35
46
|
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
36
47
|
|
@@ -42,22 +53,34 @@ shared_examples 'baid_spec_common' do
|
|
42
53
|
|
43
54
|
# Verify GET API
|
44
55
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
45
|
-
payment_infos.size.should ==
|
56
|
+
payment_infos.size.should == 3
|
57
|
+
# details_for
|
46
58
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
47
59
|
payment_infos[0].transaction_type.should == :PURCHASE
|
48
|
-
payment_infos[0].amount.should
|
49
|
-
payment_infos[0].currency.should
|
60
|
+
payment_infos[0].amount.should be_nil
|
61
|
+
payment_infos[0].currency.should be_nil
|
50
62
|
payment_infos[0].status.should == :PROCESSED
|
51
63
|
payment_infos[0].gateway_error.should == 'Success'
|
52
64
|
payment_infos[0].gateway_error_code.should be_nil
|
53
|
-
find_value_from_properties(payment_infos[0].properties, '
|
65
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
66
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
67
|
+
# purchase
|
54
68
|
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
55
|
-
payment_infos[1].transaction_type.should == :
|
69
|
+
payment_infos[1].transaction_type.should == :PURCHASE
|
56
70
|
payment_infos[1].amount.should == @amount
|
57
71
|
payment_infos[1].currency.should == @currency
|
58
72
|
payment_infos[1].status.should == :PROCESSED
|
59
73
|
payment_infos[1].gateway_error.should == 'Success'
|
60
74
|
payment_infos[1].gateway_error_code.should be_nil
|
75
|
+
find_value_from_properties(payment_infos[0].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
76
|
+
# refund
|
77
|
+
payment_infos[2].kb_payment_id.should == @kb_payment.id
|
78
|
+
payment_infos[2].transaction_type.should == :REFUND
|
79
|
+
payment_infos[2].amount.should == @amount
|
80
|
+
payment_infos[2].currency.should == @currency
|
81
|
+
payment_infos[2].status.should == :PROCESSED
|
82
|
+
payment_infos[2].gateway_error.should == 'Success'
|
83
|
+
payment_infos[2].gateway_error_code.should be_nil
|
61
84
|
find_value_from_properties(payment_infos[1].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
62
85
|
end
|
63
86
|
|
@@ -71,14 +94,25 @@ shared_examples 'baid_spec_common' do
|
|
71
94
|
|
72
95
|
# Verify GET API
|
73
96
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
74
|
-
payment_infos.size.should ==
|
97
|
+
payment_infos.size.should == 2
|
98
|
+
# details_for
|
75
99
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
76
100
|
payment_infos[0].transaction_type.should == :AUTHORIZE
|
77
|
-
payment_infos[0].amount.should
|
78
|
-
payment_infos[0].currency.should
|
101
|
+
payment_infos[0].amount.should be_nil
|
102
|
+
payment_infos[0].currency.should be_nil
|
79
103
|
payment_infos[0].status.should == :PROCESSED
|
80
104
|
payment_infos[0].gateway_error.should == 'Success'
|
81
105
|
payment_infos[0].gateway_error_code.should be_nil
|
106
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
107
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
108
|
+
# purchase
|
109
|
+
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
110
|
+
payment_infos[1].transaction_type.should == :AUTHORIZE
|
111
|
+
payment_infos[1].amount.should == @amount
|
112
|
+
payment_infos[1].currency.should == @currency
|
113
|
+
payment_infos[1].status.should == :PROCESSED
|
114
|
+
payment_infos[1].gateway_error.should == 'Success'
|
115
|
+
payment_infos[1].gateway_error_code.should be_nil
|
82
116
|
find_value_from_properties(payment_infos[0].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
83
117
|
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
84
118
|
|
@@ -92,15 +126,15 @@ shared_examples 'baid_spec_common' do
|
|
92
126
|
|
93
127
|
# Verify GET API
|
94
128
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
95
|
-
payment_infos.size.should ==
|
96
|
-
payment_infos[i].kb_payment_id.should == @kb_payment.id
|
97
|
-
payment_infos[i].transaction_type.should == :CAPTURE
|
98
|
-
payment_infos[i].amount.should == partial_capture_amount
|
99
|
-
payment_infos[i].currency.should == @currency
|
100
|
-
payment_infos[i].status.should == :PROCESSED
|
101
|
-
payment_infos[i].gateway_error.should == 'Success'
|
102
|
-
payment_infos[i].gateway_error_code.should be_nil
|
103
|
-
find_value_from_properties(payment_infos[i].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
129
|
+
payment_infos.size.should == 2 + i
|
130
|
+
payment_infos[i + 1].kb_payment_id.should == @kb_payment.id
|
131
|
+
payment_infos[i + 1].transaction_type.should == :CAPTURE
|
132
|
+
payment_infos[i + 1].amount.should == partial_capture_amount
|
133
|
+
payment_infos[i + 1].currency.should == @currency
|
134
|
+
payment_infos[i + 1].status.should == :PROCESSED
|
135
|
+
payment_infos[i + 1].gateway_error.should == 'Success'
|
136
|
+
payment_infos[i + 1].gateway_error_code.should be_nil
|
137
|
+
find_value_from_properties(payment_infos[i + 1].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
104
138
|
end
|
105
139
|
|
106
140
|
# Try a partial refund
|
@@ -111,15 +145,15 @@ shared_examples 'baid_spec_common' do
|
|
111
145
|
|
112
146
|
# Verify GET API
|
113
147
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
114
|
-
payment_infos.size.should ==
|
115
|
-
payment_infos[
|
116
|
-
payment_infos[
|
117
|
-
payment_infos[
|
118
|
-
payment_infos[
|
119
|
-
payment_infos[
|
120
|
-
payment_infos[
|
121
|
-
payment_infos[
|
122
|
-
find_value_from_properties(payment_infos[
|
148
|
+
payment_infos.size.should == 6
|
149
|
+
payment_infos[5].kb_payment_id.should == @kb_payment.id
|
150
|
+
payment_infos[5].transaction_type.should == :REFUND
|
151
|
+
payment_infos[5].amount.should == partial_capture_amount
|
152
|
+
payment_infos[5].currency.should == @currency
|
153
|
+
payment_infos[5].status.should == :PROCESSED
|
154
|
+
payment_infos[5].gateway_error.should == 'Success'
|
155
|
+
payment_infos[5].gateway_error_code.should be_nil
|
156
|
+
find_value_from_properties(payment_infos[5].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
123
157
|
|
124
158
|
# Try to capture again
|
125
159
|
payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[5].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
|
@@ -129,15 +163,15 @@ shared_examples 'baid_spec_common' do
|
|
129
163
|
|
130
164
|
# Verify GET API
|
131
165
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
132
|
-
payment_infos.size.should ==
|
133
|
-
payment_infos[
|
134
|
-
payment_infos[
|
135
|
-
payment_infos[
|
136
|
-
payment_infos[
|
137
|
-
payment_infos[
|
138
|
-
payment_infos[
|
139
|
-
payment_infos[
|
140
|
-
find_value_from_properties(payment_infos[
|
166
|
+
payment_infos.size.should == 7
|
167
|
+
payment_infos[6].kb_payment_id.should == @kb_payment.id
|
168
|
+
payment_infos[6].transaction_type.should == :CAPTURE
|
169
|
+
payment_infos[6].amount.should == partial_capture_amount
|
170
|
+
payment_infos[6].currency.should == @currency
|
171
|
+
payment_infos[6].status.should == :PROCESSED
|
172
|
+
payment_infos[6].gateway_error.should == 'Success'
|
173
|
+
payment_infos[6].gateway_error_code.should be_nil
|
174
|
+
find_value_from_properties(payment_infos[6].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
141
175
|
end
|
142
176
|
|
143
177
|
it 'should be able to auth and void' do
|
@@ -145,18 +179,31 @@ shared_examples 'baid_spec_common' do
|
|
145
179
|
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
146
180
|
payment_response.amount.should == @amount
|
147
181
|
payment_response.transaction_type.should == :AUTHORIZE
|
182
|
+
payer_id = find_value_from_properties(payment_response.properties, 'payerId')
|
183
|
+
payer_id.should_not be_nil
|
148
184
|
|
149
185
|
# Verify GET API
|
150
186
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
151
|
-
payment_infos.size.should ==
|
187
|
+
payment_infos.size.should == 2
|
188
|
+
# details_for
|
152
189
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
153
190
|
payment_infos[0].transaction_type.should == :AUTHORIZE
|
154
|
-
payment_infos[0].amount.should
|
155
|
-
payment_infos[0].currency.should
|
191
|
+
payment_infos[0].amount.should be_nil
|
192
|
+
payment_infos[0].currency.should be_nil
|
156
193
|
payment_infos[0].status.should == :PROCESSED
|
157
194
|
payment_infos[0].gateway_error.should == 'Success'
|
158
195
|
payment_infos[0].gateway_error_code.should be_nil
|
159
|
-
find_value_from_properties(payment_infos[0].properties, '
|
196
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
197
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
198
|
+
# authorize
|
199
|
+
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
200
|
+
payment_infos[1].transaction_type.should == :AUTHORIZE
|
201
|
+
payment_infos[1].amount.should == @amount
|
202
|
+
payment_infos[1].currency.should == @currency
|
203
|
+
payment_infos[1].status.should == :PROCESSED
|
204
|
+
payment_infos[1].gateway_error.should == 'Success'
|
205
|
+
payment_infos[1].gateway_error_code.should be_nil
|
206
|
+
find_value_from_properties(payment_infos[1].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
160
207
|
|
161
208
|
payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, @properties, @call_context)
|
162
209
|
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
@@ -164,23 +211,35 @@ shared_examples 'baid_spec_common' do
|
|
164
211
|
|
165
212
|
# Verify GET API
|
166
213
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
167
|
-
payment_infos.size.should ==
|
214
|
+
payment_infos.size.should == 3
|
215
|
+
# details_for
|
168
216
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
169
217
|
payment_infos[0].transaction_type.should == :AUTHORIZE
|
170
|
-
payment_infos[0].amount.should
|
171
|
-
payment_infos[0].currency.should
|
218
|
+
payment_infos[0].amount.should be_nil
|
219
|
+
payment_infos[0].currency.should be_nil
|
172
220
|
payment_infos[0].status.should == :PROCESSED
|
173
221
|
payment_infos[0].gateway_error.should == 'Success'
|
174
222
|
payment_infos[0].gateway_error_code.should be_nil
|
175
|
-
find_value_from_properties(payment_infos[0].properties, '
|
223
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
224
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
225
|
+
# authorize
|
176
226
|
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
177
|
-
payment_infos[1].transaction_type.should == :
|
178
|
-
payment_infos[1].amount.should
|
179
|
-
payment_infos[1].currency.should
|
227
|
+
payment_infos[1].transaction_type.should == :AUTHORIZE
|
228
|
+
payment_infos[1].amount.should == @amount
|
229
|
+
payment_infos[1].currency.should == @currency
|
180
230
|
payment_infos[1].status.should == :PROCESSED
|
181
231
|
payment_infos[1].gateway_error.should == 'Success'
|
182
232
|
payment_infos[1].gateway_error_code.should be_nil
|
183
233
|
find_value_from_properties(payment_infos[1].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
234
|
+
# void
|
235
|
+
payment_infos[2].kb_payment_id.should == @kb_payment.id
|
236
|
+
payment_infos[2].transaction_type.should == :VOID
|
237
|
+
payment_infos[2].amount.should be_nil
|
238
|
+
payment_infos[2].currency.should be_nil
|
239
|
+
payment_infos[2].status.should == :PROCESSED
|
240
|
+
payment_infos[2].gateway_error.should == 'Success'
|
241
|
+
payment_infos[2].gateway_error_code.should be_nil
|
242
|
+
find_value_from_properties(payment_infos[2].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
184
243
|
end
|
185
244
|
|
186
245
|
it 'should be able to auth, partial capture and void' do
|
@@ -188,17 +247,30 @@ shared_examples 'baid_spec_common' do
|
|
188
247
|
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
189
248
|
payment_response.amount.should == @amount
|
190
249
|
payment_response.transaction_type.should == :AUTHORIZE
|
250
|
+
payer_id = find_value_from_properties(payment_response.properties, 'payerId')
|
251
|
+
payer_id.should_not be_nil
|
191
252
|
|
192
253
|
# Verify GET API
|
193
254
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
194
|
-
payment_infos.size.should ==
|
255
|
+
payment_infos.size.should == 2
|
256
|
+
# details_for
|
195
257
|
payment_infos[0].kb_payment_id.should == @kb_payment.id
|
196
258
|
payment_infos[0].transaction_type.should == :AUTHORIZE
|
197
|
-
payment_infos[0].amount.should
|
198
|
-
payment_infos[0].currency.should
|
259
|
+
payment_infos[0].amount.should be_nil
|
260
|
+
payment_infos[0].currency.should be_nil
|
199
261
|
payment_infos[0].status.should == :PROCESSED
|
200
262
|
payment_infos[0].gateway_error.should == 'Success'
|
201
263
|
payment_infos[0].gateway_error_code.should be_nil
|
264
|
+
find_value_from_properties(payment_infos[0].properties, 'payerId').should == payer_id
|
265
|
+
find_value_from_properties(payment_infos[0].properties, 'payerName').should_not be_nil
|
266
|
+
# authorize
|
267
|
+
payment_infos[1].kb_payment_id.should == @kb_payment.id
|
268
|
+
payment_infos[1].transaction_type.should == :AUTHORIZE
|
269
|
+
payment_infos[1].amount.should == @amount
|
270
|
+
payment_infos[1].currency.should == @currency
|
271
|
+
payment_infos[1].status.should == :PROCESSED
|
272
|
+
payment_infos[1].gateway_error.should == 'Success'
|
273
|
+
payment_infos[1].gateway_error_code.should be_nil
|
202
274
|
find_value_from_properties(payment_infos[0].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
203
275
|
|
204
276
|
partial_capture_amount = BigDecimal.new('10')
|
@@ -209,15 +281,15 @@ shared_examples 'baid_spec_common' do
|
|
209
281
|
|
210
282
|
# Verify GET API
|
211
283
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
212
|
-
payment_infos.size.should ==
|
213
|
-
payment_infos[
|
214
|
-
payment_infos[
|
215
|
-
payment_infos[
|
216
|
-
payment_infos[
|
217
|
-
payment_infos[
|
218
|
-
payment_infos[
|
219
|
-
payment_infos[
|
220
|
-
find_value_from_properties(payment_infos[
|
284
|
+
payment_infos.size.should == 3
|
285
|
+
payment_infos[2].kb_payment_id.should == @kb_payment.id
|
286
|
+
payment_infos[2].transaction_type.should == :CAPTURE
|
287
|
+
payment_infos[2].amount.should == partial_capture_amount
|
288
|
+
payment_infos[2].currency.should == @currency
|
289
|
+
payment_infos[2].status.should == :PROCESSED
|
290
|
+
payment_infos[2].gateway_error.should == 'Success'
|
291
|
+
payment_infos[2].gateway_error_code.should be_nil
|
292
|
+
find_value_from_properties(payment_infos[2].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
221
293
|
|
222
294
|
payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[2].id, @pm.kb_payment_method_id, @properties, @call_context)
|
223
295
|
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
@@ -225,15 +297,15 @@ shared_examples 'baid_spec_common' do
|
|
225
297
|
|
226
298
|
# Verify GET API
|
227
299
|
payment_infos = @plugin.get_payment_info(@pm.kb_account_id, @kb_payment.id, [], @call_context)
|
228
|
-
payment_infos.size.should ==
|
229
|
-
payment_infos[
|
230
|
-
payment_infos[
|
231
|
-
payment_infos[
|
232
|
-
payment_infos[
|
233
|
-
payment_infos[
|
234
|
-
payment_infos[
|
235
|
-
payment_infos[
|
236
|
-
find_value_from_properties(payment_infos[
|
300
|
+
payment_infos.size.should == 4
|
301
|
+
payment_infos[3].kb_payment_id.should == @kb_payment.id
|
302
|
+
payment_infos[3].transaction_type.should == :VOID
|
303
|
+
payment_infos[3].amount.should be_nil
|
304
|
+
payment_infos[3].currency.should be_nil
|
305
|
+
payment_infos[3].status.should == :PROCESSED
|
306
|
+
payment_infos[3].gateway_error.should == 'Success'
|
307
|
+
payment_infos[3].gateway_error_code.should be_nil
|
308
|
+
find_value_from_properties(payment_infos[3].properties, 'payment_processor_account_id').should == @payment_processor_account_id
|
237
309
|
end
|
238
310
|
|
239
311
|
it 'should generate forms correctly' do
|