added sandbox support for paypal transaction url

This commit is contained in:
claudiosmweb 2014-08-21 19:48:28 -03:00
parent f4f5f061d8
commit ff7f1435ab
1 changed files with 21 additions and 1 deletions

View File

@ -32,7 +32,6 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
$this->testurl = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
$this->method_title = __( 'PayPal', 'woocommerce' );
$this->method_description = __( 'PayPal standard works by sending the user to PayPal to enter their payment information.', 'woocommerce' );
$this->view_transaction_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%s';
$this->notify_url = WC()->api_request_url( 'WC_Gateway_Paypal' );
$this->supports = array(
'products',
@ -1034,4 +1033,25 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
return $state;
}
/**
* Get the transaction URL.
*
* @param string $transaction_id
*
* @return string
*/
public function get_transaction_url( $transaction_id ) {
$return_url = '';
if ( empty( $transaction_id ) ) {
if ( 'yes' == $this->testmode ) {
$return_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%s';
} else {
$return_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%s';
}
}
return apply_filters( 'woocommerce_get_transaction_url', $return_url, $transaction_id, $this );
}
}