Changed thank you page text to follow PayPal guidelines
Also fixed coding standards
This commit is contained in:
parent
3c9b9ac6a0
commit
4c023c5e8a
|
@ -72,6 +72,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
||||||
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
||||||
add_action( 'woocommerce_order_status_processing', array( $this, 'capture_payment' ) );
|
add_action( 'woocommerce_order_status_processing', array( $this, 'capture_payment' ) );
|
||||||
add_action( 'woocommerce_order_status_completed', array( $this, 'capture_payment' ) );
|
add_action( 'woocommerce_order_status_completed', array( $this, 'capture_payment' ) );
|
||||||
|
add_filter( 'woocommerce_thankyou_order_received_text', array( $this, 'order_received_text' ), 10, 2 );
|
||||||
|
|
||||||
if ( ! $this->is_valid_for_use() ) {
|
if ( ! $this->is_valid_for_use() ) {
|
||||||
$this->enabled = 'no';
|
$this->enabled = 'no';
|
||||||
|
@ -380,17 +381,17 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
||||||
|
|
||||||
$this->log( 'Refund Result: ' . wc_print_r( $result, true ) );
|
$this->log( 'Refund Result: ' . wc_print_r( $result, true ) );
|
||||||
|
|
||||||
switch ( strtolower( $result->ACK ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
switch ( strtolower( $result->ACK ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
case 'success':
|
case 'success':
|
||||||
case 'successwithwarning':
|
case 'successwithwarning':
|
||||||
$order->add_order_note(
|
$order->add_order_note(
|
||||||
/* translators: 1: Refund amount, 2: Refund ID */
|
/* translators: 1: Refund amount, 2: Refund ID */
|
||||||
sprintf( __( 'Refunded %1$s - Refund ID: %2$s', 'woocommerce' ), $result->GROSSREFUNDAMT, $result->REFUNDTRANSACTIONID ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
sprintf( __( 'Refunded %1$s - Refund ID: %2$s', 'woocommerce' ), $result->GROSSREFUNDAMT, $result->REFUNDTRANSACTIONID ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset( $result->L_LONGMESSAGE0 ) ? new WP_Error( 'error', $result->L_LONGMESSAGE0 ) : false; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
return isset( $result->L_LONGMESSAGE0 ) ? new WP_Error( 'error', $result->L_LONGMESSAGE0 ) : false; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -414,7 +415,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
||||||
|
|
||||||
$this->log( 'Capture Result: ' . wc_print_r( $result, true ) );
|
$this->log( 'Capture Result: ' . wc_print_r( $result, true ) );
|
||||||
|
|
||||||
// phpcs:disable WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
|
// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||||
if ( ! empty( $result->PAYMENTSTATUS ) ) {
|
if ( ! empty( $result->PAYMENTSTATUS ) ) {
|
||||||
switch ( $result->PAYMENTSTATUS ) {
|
switch ( $result->PAYMENTSTATUS ) {
|
||||||
case 'Completed':
|
case 'Completed':
|
||||||
|
@ -450,4 +451,20 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
||||||
|
|
||||||
wp_enqueue_script( 'woocommerce_paypal_admin', WC()->plugin_url() . '/includes/gateways/paypal/assets/js/paypal-admin' . $suffix . '.js', array(), WC_VERSION, true );
|
wp_enqueue_script( 'woocommerce_paypal_admin', WC()->plugin_url() . '/includes/gateways/paypal/assets/js/paypal-admin' . $suffix . '.js', array(), WC_VERSION, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom PayPal order received text.
|
||||||
|
*
|
||||||
|
* @since 3.9.0
|
||||||
|
* @param string $text Default text.
|
||||||
|
* @param WC_Order $order Order data.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function order_received_text( $text, $order ) {
|
||||||
|
if ( $this->id ) {
|
||||||
|
return esc_html__( 'Thank you for your payment. Your transaction has been completed, and a receipt for your purchase has been emailed to you. Log into your PayPal account to view transaction details.', 'woocommerce' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue