Added paypal refund reason/note

cc @mikejolley
This commit is contained in:
claudiosmweb 2014-08-21 20:22:28 -03:00 committed by Ninos Ego
parent b2262e999d
commit 64625ba795
1 changed files with 8 additions and 0 deletions

View File

@ -589,6 +589,14 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
$post_data['CURRENCYCODE'] = $order->get_order_currency();
}
if ( $reason ) {
if ( 255 < strlen( $reason ) ) {
$reason = substr( $reason, 0, 252 ) . '...';
}
$post_data['NOTE'] = html_entity_decode( $reason, ENT_NOQUOTES, 'UTF-8' );
}
$response = wp_remote_post( 'yes' === $this->testmode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp', array(
'method' => 'POST',
'body' => $post_data,