Skip to content

Commit

Permalink
Merge pull request #67 from chnutzen/master
Browse files Browse the repository at this point in the history
Update class-wc-gateway-reepay-checkout.php
  • Loading branch information
markusbrunke authored Mar 31, 2020
2 parents 5251805 + 7a7b1f7 commit 6b02c17
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions includes/class-wc-gateway-reepay-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ public function process_payment( $order_id ) {
// Initialize Payment
$params = [
'locale' => $this->get_language(),
'settle' => $settleInstant,
//'settle' => $settleInstant,
'recurring' => $maybe_save_card || self::order_contains_subscription( $order ) || self::wcs_is_payment_change(),
'order' => [
'handle' => $this->get_order_handle( $order ),
Expand Down Expand Up @@ -1016,8 +1016,6 @@ public function payment_confirm() {
$order = wc_get_order( $order_id );
} while ( $order->has_status( apply_filters( 'woocommerce_default_order_status', 'pending' ) ) );

//$this->process_instant_settle( $order );
//exit();
// Update order status
if ( $status_failback ) {
$this->log( sprintf( '%s::%s Processing status_fallback ', __CLASS__, __METHOD__ ) );
Expand Down Expand Up @@ -1087,7 +1085,6 @@ public function process_instant_settle( $order ) {
//
try {
$result = $this->request( 'POST', 'https://api.reepay.com/v1/charge/order-' . $order->get_id() . '/settle', $params );
//$this->log( sprintf( '%s::%s Invoice settled success %s', __CLASS__, __METHOD__, var_export( $result, true ) ) );
} catch (Exception $e) {
$this->log( sprintf( '%s::%s API Error: %s', __CLASS__, __METHOD__, var_export( $e->getMessage(), true ) ) );
return false;
Expand All @@ -1104,7 +1101,7 @@ public function process_instant_settle( $order ) {
//
// Set the order as settled
//
// $order->payment_complete();
$order->payment_complete();
} else {
//
// Partly settle
Expand All @@ -1114,7 +1111,6 @@ public function process_instant_settle( $order ) {
}
}

//print_r($instant_settle_ary); exit();
return true;
}

Expand Down Expand Up @@ -1178,11 +1174,12 @@ public function return_handler() {
wc_reduce_stock_levels( $order->get_id() );
}

// set order a<s authorized
$this->set_authorized_status( $order );

// process instant settle
$this->process_instant_settle( $order );

$this->set_authorized_status( $order );

$this->log( sprintf( 'WebHook: Success event type: %s', $data['event_type'] ) );
break;
case 'invoice_settled':
Expand Down

0 comments on commit 6b02c17

Please sign in to comment.