Refunds: Bug fixes in getting right gateway object

This commit is contained in:
Coen Jacobs 2012-11-13 15:18:26 +01:00
parent b4d17940de
commit c99ec141d8
2 changed files with 3 additions and 3 deletions

View File

@ -372,14 +372,14 @@ function woocommerce_order_items_meta_box( $post ) {
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
if ( isset( $gateways[ $order->payment_method ] ) ) {
$gateway = $order->payment_method;
$gateway = $gateways[ $order->payment_method ];
if ( ! in_array( 'refunds', $gateway->supports ) || ! method_exists( $gateway, 'refund' ) ) {
$disabled = ' disabled="disabled"';
}
}
echo '<option value="refund"' . $disabled . '>' . _e( 'Refund Lines', 'woocommerce' ) . '</option>';
echo '<option value="refund"' . $disabled . '>' . __( 'Refund Lines', 'woocommerce' ) . '</option>';
?>
</optgroup>
<optgroup label="<?php _e( 'Stock Actions', 'woocommerce' ); ?>">

View File

@ -964,7 +964,7 @@ function woocommerce_ajax_refund_order_item() {
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
if ( isset( $gateways[ $order->payment_method ] ) ) {
$gateway = $order->payment_method;
$gateway = $gateways[ $order->payment_method ];
if ( in_array( 'refunds', $gateway->supports ) && method_exists( $gateway, 'refund' ) ) {
$order_item_ids = $_POST['order_item_ids'];