payment_method

This commit is contained in:
Mike Jolley 2016-08-05 16:04:41 +01:00
parent 693e5ece36
commit 7685587b22
15 changed files with 21 additions and 21 deletions

View File

@ -153,7 +153,7 @@ class WC_Meta_Box_Order_Data {
$payment_gateways = array(); $payment_gateways = array();
} }
$payment_method = ! empty( $order->payment_method ) ? $order->payment_method : ''; $payment_method = ! empty( $order->get_payment_method() ) ? $order->get_payment_method() : '';
$order_type_object = get_post_type_object( $post->post_type ); $order_type_object = get_post_type_object( $post->post_type );
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' ); wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );

View File

@ -299,8 +299,8 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Posts_Controller {
$order = wc_get_order( $order_data ); $order = wc_get_order( $order_data );
if ( isset( $payment_gateways[ $order->payment_method ] ) && $payment_gateways[ $order->payment_method ]->supports( 'refunds' ) ) { if ( isset( $payment_gateways[ $order->get_payment_method() ] ) && $payment_gateways[ $order->get_payment_method() ]->supports( 'refunds' ) ) {
$result = $payment_gateways[ $order->payment_method ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() ); $result = $payment_gateways[ $order->get_payment_method() ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() );
if ( is_wp_error( $result ) ) { if ( is_wp_error( $result ) ) {
return $result; return $result;

View File

@ -145,7 +145,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
'total_tax' => wc_format_decimal( $order->get_total_tax(), $dp ), 'total_tax' => wc_format_decimal( $order->get_total_tax(), $dp ),
'billing' => array(), 'billing' => array(),
'shipping' => array(), 'shipping' => array(),
'payment_method' => $order->payment_method, 'payment_method' => $order->get_payment_method(),
'payment_method_title' => $order->get_payment_method_title(), 'payment_method_title' => $order->get_payment_method_title(),
'transaction_id' => $order->get_transaction_id(), 'transaction_id' => $order->get_transaction_id(),
'customer_ip_address' => $order->customer_ip_address, 'customer_ip_address' => $order->customer_ip_address,

View File

@ -133,7 +133,7 @@ class WC_API_Orders extends WC_API_Resource {
'order_discount' => wc_format_decimal( $order->get_order_discount(), 2 ), 'order_discount' => wc_format_decimal( $order->get_order_discount(), 2 ),
'shipping_methods' => $order->get_shipping_method(), 'shipping_methods' => $order->get_shipping_method(),
'payment_details' => array( 'payment_details' => array(
'method_id' => $order->payment_method, 'method_id' => $order->get_payment_method(),
'method_title' => $order->get_payment_method_title(), 'method_title' => $order->get_payment_method_title(),
'paid' => isset( $order->paid_date ), 'paid' => isset( $order->paid_date ),
), ),

View File

@ -171,7 +171,7 @@ class WC_API_Orders extends WC_API_Resource {
'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ), 'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ),
'shipping_methods' => $order->get_shipping_method(), 'shipping_methods' => $order->get_shipping_method(),
'payment_details' => array( 'payment_details' => array(
'method_id' => $order->payment_method, 'method_id' => $order->get_payment_method(),
'method_title' => $order->get_payment_method_title(), 'method_title' => $order->get_payment_method_title(),
'paid' => isset( $order->paid_date ), 'paid' => isset( $order->paid_date ),
), ),
@ -1614,8 +1614,8 @@ class WC_API_Orders extends WC_API_Resource {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( isset( $payment_gateways[ $order->payment_method ] ) && $payment_gateways[ $order->payment_method ]->supports( 'refunds' ) ) { if ( isset( $payment_gateways[ $order->get_payment_method() ] ) && $payment_gateways[ $order->get_payment_method() ]->supports( 'refunds' ) ) {
$result = $payment_gateways[ $order->payment_method ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() ); $result = $payment_gateways[ $order->get_payment_method() ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() );
if ( is_wp_error( $result ) ) { if ( is_wp_error( $result ) ) {
return $result; return $result;

View File

@ -177,7 +177,7 @@ class WC_API_Orders extends WC_API_Resource {
'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ), 'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ),
'shipping_methods' => $order->get_shipping_method(), 'shipping_methods' => $order->get_shipping_method(),
'payment_details' => array( 'payment_details' => array(
'method_id' => $order->payment_method, 'method_id' => $order->get_payment_method(),
'method_title' => $order->get_payment_method_title(), 'method_title' => $order->get_payment_method_title(),
'paid' => isset( $order->paid_date ), 'paid' => isset( $order->paid_date ),
), ),
@ -1659,8 +1659,8 @@ class WC_API_Orders extends WC_API_Resource {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( isset( $payment_gateways[ $order->payment_method ] ) && $payment_gateways[ $order->payment_method ]->supports( 'refunds' ) ) { if ( isset( $payment_gateways[ $order->get_payment_method() ] ) && $payment_gateways[ $order->get_payment_method() ]->supports( 'refunds' ) ) {
$result = $payment_gateways[ $order->payment_method ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() ); $result = $payment_gateways[ $order->get_payment_method() ]->process_refund( $order_id, $refund->get_refund_amount(), $refund->get_refund_reason() );
if ( is_wp_error( $result ) ) { if ( is_wp_error( $result ) ) {
return $result; return $result;

View File

@ -2221,8 +2221,8 @@ class WC_AJAX {
if ( WC()->payment_gateways() ) { if ( WC()->payment_gateways() ) {
$payment_gateways = WC()->payment_gateways->payment_gateways(); $payment_gateways = WC()->payment_gateways->payment_gateways();
} }
if ( isset( $payment_gateways[ $order->payment_method ] ) && $payment_gateways[ $order->payment_method ]->supports( 'refunds' ) ) { if ( isset( $payment_gateways[ $order->get_payment_method() ] ) && $payment_gateways[ $order->get_payment_method() ]->supports( 'refunds' ) ) {
$result = $payment_gateways[ $order->payment_method ]->process_refund( $order_id, $refund_amount, $refund_reason ); $result = $payment_gateways[ $order->get_payment_method() ]->process_refund( $order_id, $refund_amount, $refund_reason );
do_action( 'woocommerce_refund_processed', $refund, $result ); do_action( 'woocommerce_refund_processed', $refund, $result );

View File

@ -646,7 +646,7 @@ class WC_CLI_Order extends WC_CLI_Command {
'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ), 'total_discount' => wc_format_decimal( $order->get_total_discount(), $dp ),
'shipping_methods' => $order->get_shipping_method(), 'shipping_methods' => $order->get_shipping_method(),
'payment_details' => array( 'payment_details' => array(
'method_id' => $order->payment_method, 'method_id' => $order->get_payment_method(),
'method_title' => $order->get_payment_method_title(), 'method_title' => $order->get_payment_method_title(),
'paid' => isset( $order->paid_date ), 'paid' => isset( $order->paid_date ),
), ),

View File

@ -246,7 +246,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
*/ */
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
if ( ! $sent_to_admin && 'bacs' === $order->payment_method && $order->has_status( 'on-hold' ) ) { if ( ! $sent_to_admin && 'bacs' === $order->get_payment_method() && $order->has_status( 'on-hold' ) ) {
if ( $this->instructions ) { if ( $this->instructions ) {
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL; echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
} }

View File

@ -97,7 +97,7 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
* @param bool $plain_text * @param bool $plain_text
*/ */
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
if ( $this->instructions && ! $sent_to_admin && 'cheque' === $order->payment_method && $order->has_status( 'on-hold' ) ) { if ( $this->instructions && ! $sent_to_admin && 'cheque' === $order->get_payment_method() && $order->has_status( 'on-hold' ) ) {
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL; echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
} }
} }

View File

@ -233,7 +233,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
* @param bool $plain_text * @param bool $plain_text
*/ */
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
if ( $this->instructions && ! $sent_to_admin && 'cod' === $order->payment_method ) { if ( $this->instructions && ! $sent_to_admin && 'cod' === $order->get_payment_method() ) {
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL; echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
} }
} }

View File

@ -315,7 +315,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
public function capture_payment( $order_id ) { public function capture_payment( $order_id ) {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
if ( 'paypal' === $order->payment_method && 'pending' === get_post_meta( $order->get_id(), '_paypal_status', true ) && $order->get_transaction_id() ) { if ( 'paypal' === $order->get_payment_method() && 'pending' === get_post_meta( $order->get_id(), '_paypal_status', true ) && $order->get_transaction_id() ) {
$this->init_api(); $this->init_api();
$result = WC_Gateway_Paypal_API_Handler::do_capture( $order ); $result = WC_Gateway_Paypal_API_Handler::do_capture( $order );

View File

@ -159,7 +159,7 @@ class WC_Shortcode_Checkout {
<?php endif; ?> <?php endif; ?>
</ul> </ul>
<?php do_action( 'woocommerce_receipt_' . $order->payment_method, $order_id ); ?> <?php do_action( 'woocommerce_receipt_' . $order->get_payment_method(), $order_id ); ?>
<div class="clear"></div> <div class="clear"></div>
<?php <?php

View File

@ -962,7 +962,7 @@ function wc_get_payment_gateway_by_order( $order ) {
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
} }
return isset( $payment_gateways[ $order->payment_method ] ) ? $payment_gateways[ $order->payment_method ] : false; return isset( $payment_gateways[ $order->get_payment_method() ] ) ? $payment_gateways[ $order->get_payment_method() ] : false;
} }
/** /**

View File

@ -61,7 +61,7 @@ if ( $order ) : ?>
<?php endif; ?> <?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->get_id() ); ?> <?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
<?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?> <?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>
<?php else : ?> <?php else : ?>