Skip to content

Commit

Permalink
Use SHIPTOSTREET2 element instead of STREET2 element for Payflow Expr…
Browse files Browse the repository at this point in the history
…ess Uk address
  • Loading branch information
Cody Fauser committed May 6, 2009
1 parent d40c009 commit 5b86701
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG

* Use SHIPTOSTREET2 element instead of STREET2 element for Payflow Express Uk address [cody]
* Clean up the test helper [cody]
* Fix DataCash unit test that was making a remote call [cody]
* Don't check Request#test? for remote PaymentExpress tests because their test environment has changed [cody]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def address
{ 'name' => full_name,
'company' => nil,
'address1' => @params['street'],
'address2' => nil,
'address2' => @params['shiptostreet2'],
'city' => @params['city'],
'state' => @params['state'],
'country' => @params['country'],
Expand Down
72 changes: 72 additions & 0 deletions test/unit/gateways/payflow_express_uk_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,76 @@ def setup
def test_supported_countries
assert_equal ['GB'], PayflowExpressUkGateway.supported_countries
end

def test_get_express_details
@gateway.expects(:ssl_post).returns(successful_get_express_details_response)
response = @gateway.details_for('EC-2OPN7UJGFWK9OYFV')
assert_instance_of PayflowExpressResponse, response
assert_success response
assert response.test?

assert_equal 'EC-2OPN7UJGFWK9OYFV', response.token
assert_equal 'LYWCMEN4FA7ZQ', response.payer_id
assert_equal 'paul@test.com', response.email
assert_equal 'paul smith', response.full_name
assert_equal 'GB', response.payer_country

assert address = response.address
assert_equal 'paul smith', address['name']
assert_nil address['company']
assert_equal '10 keyworth avenue', address['address1']
assert_equal 'grangetown', address['address2']
assert_equal 'hinterland', address['city']
assert_equal 'Tyne and Wear', address['state']
assert_equal 'sr5 2uh', address['zip']
assert_equal 'GB', address['country']
assert_nil address['phone']
end

private
def successful_get_express_details_response
<<-RESPONSE
<?xml version="1.0"?>
<XMLPayResponse xmlns="http://www.paypal.com/XMLPay">
<ResponseData>
<Vendor>markcoop</Vendor>
<Partner>paypaluk</Partner>
<TransactionResults>
<TransactionResult>
<Result>0</Result>
<AVSResult>
<StreetMatch>Match</StreetMatch>
<ZipMatch>Match</ZipMatch>
</AVSResult>
<Message>Approved</Message>
<PayPalResult>
<EMail>paul@test.com</EMail>
<PayerID>LYWCMEN4FA7ZQ</PayerID>
<Token>EC-2OPN7UJGFWK9OYFV</Token>
<FeeAmount>0</FeeAmount>
<PayerStatus>unverified</PayerStatus>
<Name>paul</Name>
<ShipTo>
<Address>
<Street>10 keyworth avenue</Street>
<City>hinterland</City>
<State>Tyne and Wear</State>
<Zip>sr5 2uh</Zip>
<Country>GB</Country>
</Address>
</ShipTo>
<CorrelationID>1ea22ef3873ba</CorrelationID>
</PayPalResult>
<ExtData Name="LASTNAME" Value="smith"/>
<ExtData Name="SHIPTOSTREET2" Value="grangetown"/>
<ExtData Name="SHIPTONAME" Value="paul smith"/>
<ExtData Name="STREET2" Value="ALLAWAY AVENUE"/>
<ExtData Name="COUNTRYCODE" Value="GB"/>
<ExtData Name="ADDRESSSTATUS" Value="Y"/>
</TransactionResult>
</TransactionResults>
</ResponseData>
</XMLPayResponse>
RESPONSE
end
end

0 comments on commit 5b86701

Please sign in to comment.