Skip to content

Commit

Permalink
For renewal order payment method update: add WooCommerce 3.0 code and…
Browse files Browse the repository at this point in the history
… remove creditcard from checked methods
  • Loading branch information
davdebcom committed Aug 23, 2017
1 parent 333d7ec commit 8e87764
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,19 @@ public function scheduled_subscription_payment( $amount_to_charge, $renewal_orde
'mollie_wc_gateway_sofort',
'mollie_wc_gateway_kbc',
'mollie_wc_gateway_belfius',
'mollie_wc_gateway_creditcard', // TODO DAVID -- REMOVE
);

$current_method = get_post_meta( $renewal_order_id, '_payment_method', $single = true );

if ( in_array( $current_method, $methods_needing_update ) && $payment->method == 'directdebit' ) {
update_post_meta( $renewal_order_id, '_payment_method', 'mollie_wc_gateway_directdebit' );
update_post_meta( $renewal_order_id, '_payment_method_title', 'SEPA Direct Debit' );
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
update_post_meta( $renewal_order_id, '_payment_method', 'mollie_wc_gateway_directdebit' );
update_post_meta( $renewal_order_id, '_payment_method_title', 'SEPA Direct Debit' );
} else {
$renewal_order->update_meta_data( '_payment_method', 'mollie_wc_gateway_directdebit' );
$renewal_order->update_meta_data( '_payment_method_title', 'SEPA Direct Debit' );
$renewal_order->save();
}
}

Mollie_WC_Plugin::debug($this->id . ': Created payment for order ' . $renewal_order_id. ' payment json response '.json_encode($payment));
Expand Down

0 comments on commit 8e87764

Please sign in to comment.