[FIX] payment_authorize/paypal: Fix tests
This commit is contained in:
@@ -89,10 +89,13 @@ class AuthorizeForm(AuthorizeCommon):
|
||||
res = self.authorize.render('SO004', 320.0, self.currency_usd.id, values=self.buyer_values)
|
||||
# check form result
|
||||
tree = objectify.fromstring(res)
|
||||
self.assertEqual(tree.get('action'), 'https://test.authorize.net/gateway/transact.dll', 'Authorize: wrong form POST url')
|
||||
|
||||
data_set = tree.xpath("//input[@name='data_set']")
|
||||
self.assertEqual(len(data_set), 1, 'Authorize: Found %d "data_set" input instead of 1' % len(data_set))
|
||||
self.assertEqual(data_set[0].get('data-action-url'), 'https://test.authorize.net/gateway/transact.dll', 'Authorize: wrong data-action-url POST url')
|
||||
for el in tree.iterfind('input'):
|
||||
values = list(el.attrib.values())
|
||||
if values[1] in ['submit', 'x_fp_hash', 'return_url', 'x_state', 'x_ship_to_state']:
|
||||
if values[1] in ['submit', 'x_fp_hash', 'return_url', 'x_state', 'x_ship_to_state', 'data_set']:
|
||||
continue
|
||||
self.assertEqual(
|
||||
values[2],
|
||||
|
||||
@@ -48,43 +48,45 @@
|
||||
</template>
|
||||
|
||||
<template id="authorize_form">
|
||||
<input type="hidden" name="data_set" t-att-data-action-url="tx_url"/>
|
||||
<input type='hidden' name='x_login' t-att-value='x_login'/>
|
||||
<input type='hidden' name='x_fp_hash' t-att-value='x_fp_hash'/>
|
||||
<input type='hidden' name='x_amount' t-att-value='x_amount'/>
|
||||
<input type='hidden' name='x_show_form' t-att-value="x_show_form"/>
|
||||
<input type='hidden' name='x_type' t-att-value="x_type"/>
|
||||
<input type='hidden' name='x_method' t-att-value="x_method"/>
|
||||
<input type='hidden' name='x_fp_sequence' t-att-value='x_fp_sequence'/>
|
||||
<input type='hidden' name='x_version' t-att-value="x_version"/>
|
||||
<input type="hidden" name="x_relay_response" t-att-value="x_relay_response"/>
|
||||
<input type="hidden" name="x_relay_url" t-att-value="x_relay_url"/>
|
||||
<input type='hidden' name="x_fp_timestamp" t-att-value="x_fp_timestamp"/>
|
||||
<input type="hidden" name='return_url' t-att-value="returndata"/>
|
||||
<input type="hidden" name='x_cancel_url' t-att-value="x_cancel_url"/>
|
||||
<!--Order Information -->
|
||||
<input type='hidden' name='x_invoice_num' t-att-value='reference'/>
|
||||
<input type='hidden' name='x_currency_code' t-att-value='x_currency_code'/>
|
||||
<!-- Billing Information-->
|
||||
<input type='hidden' name='x_first_name' t-att-value="billing_first_name"/>
|
||||
<input type='hidden' name='x_last_name' t-att-value="billing_last_name"/>
|
||||
<input type='hidden' name='x_address' t-att-value="billing_address"/>
|
||||
<input type='hidden' name='x_city' t-att-value="billing_city"/>
|
||||
<input type='hidden' name='x_zip' t-att-value="billing_zip_code"/>
|
||||
<input type='hidden' name='x_country' t-att-value="billing_country"/>
|
||||
<input type='hidden' name='x_phone' t-att-value='billing_phone'/>
|
||||
<input type='hidden' name='x_email' t-att-value="billing_email"/>
|
||||
<input type='hidden' name='x_state' t-att-value="billing_state"/>
|
||||
<!-- Shipping Information-->
|
||||
<input type='hidden' name='x_ship_to_first_name' t-att-value="first_name"/>
|
||||
<input type='hidden' name='x_ship_to_last_name' t-att-value="last_name"/>
|
||||
<input type='hidden' name='x_ship_to_address' t-att-value="address"/>
|
||||
<input type='hidden' name='x_ship_to_city' t-att-value="city"/>
|
||||
<input type='hidden' name='x_ship_to_zip' t-att-value="zip_code"/>
|
||||
<input type='hidden' name='x_ship_to_country' t-att-value="country"/>
|
||||
<input type='hidden' name='x_ship_to_phone' t-att-value='phone'/>
|
||||
<input type='hidden' name='x_ship_to_email' t-att-value="email"/>
|
||||
<input type='hidden' name='x_ship_to_state' t-att-value="state"/>
|
||||
<div>
|
||||
<input type="hidden" name="data_set" t-att-data-action-url="tx_url"/>
|
||||
<input type='hidden' name='x_login' t-att-value='x_login'/>
|
||||
<input type='hidden' name='x_fp_hash' t-att-value='x_fp_hash'/>
|
||||
<input type='hidden' name='x_amount' t-att-value='x_amount'/>
|
||||
<input type='hidden' name='x_show_form' t-att-value="x_show_form"/>
|
||||
<input type='hidden' name='x_type' t-att-value="x_type"/>
|
||||
<input type='hidden' name='x_method' t-att-value="x_method"/>
|
||||
<input type='hidden' name='x_fp_sequence' t-att-value='x_fp_sequence'/>
|
||||
<input type='hidden' name='x_version' t-att-value="x_version"/>
|
||||
<input type="hidden" name="x_relay_response" t-att-value="x_relay_response"/>
|
||||
<input type="hidden" name="x_relay_url" t-att-value="x_relay_url"/>
|
||||
<input type='hidden' name="x_fp_timestamp" t-att-value="x_fp_timestamp"/>
|
||||
<input type="hidden" name='return_url' t-att-value="returndata"/>
|
||||
<input type="hidden" name='x_cancel_url' t-att-value="x_cancel_url"/>
|
||||
<!--Order Information -->
|
||||
<input type='hidden' name='x_invoice_num' t-att-value='reference'/>
|
||||
<input type='hidden' name='x_currency_code' t-att-value='x_currency_code'/>
|
||||
<!-- Billing Information-->
|
||||
<input type='hidden' name='x_first_name' t-att-value="billing_first_name"/>
|
||||
<input type='hidden' name='x_last_name' t-att-value="billing_last_name"/>
|
||||
<input type='hidden' name='x_address' t-att-value="billing_address"/>
|
||||
<input type='hidden' name='x_city' t-att-value="billing_city"/>
|
||||
<input type='hidden' name='x_zip' t-att-value="billing_zip_code"/>
|
||||
<input type='hidden' name='x_country' t-att-value="billing_country"/>
|
||||
<input type='hidden' name='x_phone' t-att-value='billing_phone'/>
|
||||
<input type='hidden' name='x_email' t-att-value="billing_email"/>
|
||||
<input type='hidden' name='x_state' t-att-value="billing_state"/>
|
||||
<!-- Shipping Information-->
|
||||
<input type='hidden' name='x_ship_to_first_name' t-att-value="first_name"/>
|
||||
<input type='hidden' name='x_ship_to_last_name' t-att-value="last_name"/>
|
||||
<input type='hidden' name='x_ship_to_address' t-att-value="address"/>
|
||||
<input type='hidden' name='x_ship_to_city' t-att-value="city"/>
|
||||
<input type='hidden' name='x_ship_to_zip' t-att-value="zip_code"/>
|
||||
<input type='hidden' name='x_ship_to_country' t-att-value="country"/>
|
||||
<input type='hidden' name='x_ship_to_phone' t-att-value='phone'/>
|
||||
<input type='hidden' name='x_ship_to_email' t-att-value="email"/>
|
||||
<input type='hidden' name='x_ship_to_state' t-att-value="state"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="payment_authorize_redirect" name="Payment Authorize">
|
||||
|
||||
@@ -68,9 +68,12 @@ class PaypalForm(PaypalCommon):
|
||||
|
||||
# check form result
|
||||
tree = objectify.fromstring(res)
|
||||
self.assertEqual(tree.get('action'), 'https://www.sandbox.paypal.com/cgi-bin/webscr', 'paypal: wrong form POST url')
|
||||
|
||||
data_set = tree.xpath("//input[@name='data_set']")
|
||||
self.assertEqual(len(data_set), 1, 'paypal: Found %d "data_set" input instead of 1' % len(data_set))
|
||||
self.assertEqual(data_set[0].get('data-action-url'), 'https://www.sandbox.paypal.com/cgi-bin/webscr', 'paypal: wrong form POST url')
|
||||
for form_input in tree.input:
|
||||
if form_input.get('name') in ['submit']:
|
||||
if form_input.get('name') in ['submit', 'data_set']:
|
||||
continue
|
||||
self.assertEqual(
|
||||
form_input.get('value'),
|
||||
|
||||
@@ -42,35 +42,37 @@
|
||||
</template>
|
||||
|
||||
<template id="paypal_form">
|
||||
<input type="hidden" name="data_set" t-att-data-action-url="tx_url"/>
|
||||
<input type="hidden" name="cmd" t-att-value="cmd"/>
|
||||
<input type="hidden" name="business" t-att-value="business"/>
|
||||
<input type="hidden" name="item_name" t-att-value="item_name"/>
|
||||
<input type="hidden" name="item_number" t-att-value="item_number"/>
|
||||
<input type="hidden" name="amount" t-att-value="amount"/>
|
||||
<input t-if="handling" type="hidden" name="handling"
|
||||
t-att-value="handling"/>
|
||||
<input type="hidden" name="currency_code" t-att-value="currency_code"/>
|
||||
<!-- partner / address data -->
|
||||
<input type="hidden" name="address1" t-att-value="address1"/>
|
||||
<input type="hidden" name="city" t-att-value="city"/>
|
||||
<input type="hidden" name="country" t-att-value="country"/>
|
||||
<input type="hidden" name="email" t-att-value="email"/>
|
||||
<input type="hidden" name="first_name" t-att-value="first_name"/>
|
||||
<input type="hidden" name="last_name" t-att-value="last_name"/>
|
||||
<input type="hidden" name="zip" t-att-value="zip_code"/>
|
||||
<input t-if='state' type='hidden' name="state"
|
||||
t-att-value='state'/>
|
||||
<!-- after payment parameters -->
|
||||
<input t-if='custom' type='hidden' name="custom"
|
||||
t-att-value='custom'/>
|
||||
<!-- URLs -->
|
||||
<input t-if="paypal_return" type='hidden' name='return'
|
||||
t-att-value="paypal_return"/>
|
||||
<input t-if="acquirer.paypal_use_ipn" type='hidden' name='notify_url'
|
||||
t-att-value="notify_url"/>
|
||||
<input t-if="cancel_return" type="hidden" name="cancel_return"
|
||||
t-att-value="cancel_return"/>
|
||||
<div>
|
||||
<input type="hidden" name="data_set" t-att-data-action-url="tx_url"/>
|
||||
<input type="hidden" name="cmd" t-att-value="cmd"/>
|
||||
<input type="hidden" name="business" t-att-value="business"/>
|
||||
<input type="hidden" name="item_name" t-att-value="item_name"/>
|
||||
<input type="hidden" name="item_number" t-att-value="item_number"/>
|
||||
<input type="hidden" name="amount" t-att-value="amount"/>
|
||||
<input t-if="handling" type="hidden" name="handling"
|
||||
t-att-value="handling"/>
|
||||
<input type="hidden" name="currency_code" t-att-value="currency_code"/>
|
||||
<!-- partner / address data -->
|
||||
<input type="hidden" name="address1" t-att-value="address1"/>
|
||||
<input type="hidden" name="city" t-att-value="city"/>
|
||||
<input type="hidden" name="country" t-att-value="country"/>
|
||||
<input type="hidden" name="email" t-att-value="email"/>
|
||||
<input type="hidden" name="first_name" t-att-value="first_name"/>
|
||||
<input type="hidden" name="last_name" t-att-value="last_name"/>
|
||||
<input type="hidden" name="zip" t-att-value="zip_code"/>
|
||||
<input t-if='state' type='hidden' name="state"
|
||||
t-att-value='state'/>
|
||||
<!-- after payment parameters -->
|
||||
<input t-if='custom' type='hidden' name="custom"
|
||||
t-att-value='custom'/>
|
||||
<!-- URLs -->
|
||||
<input t-if="paypal_return" type='hidden' name='return'
|
||||
t-att-value="paypal_return"/>
|
||||
<input t-if="acquirer.paypal_use_ipn" type='hidden' name='notify_url'
|
||||
t-att-value="notify_url"/>
|
||||
<input t-if="cancel_return" type="hidden" name="cancel_return"
|
||||
t-att-value="cancel_return"/>
|
||||
</div>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user