Skip to content

Commit

Permalink
Fix redirect to return redirect URL after updated payment status (#23).
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Oct 30, 2023
1 parent 9e370a0 commit e09fa36
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ReturnController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function rest_api_init() {

/**
* Get return parameters.
*
*
* @param WP_REST_Request $request WordPress REST API request.
* @return ReturnParameters
* @throws \InvalidArgumentException Throws exception when REST request does not contain valid return parameter values.
Expand All @@ -93,7 +93,7 @@ private function get_return_parameters( WP_REST_Request $request ) {

if ( ! \is_string( $order_id ) || ! \is_string( $status ) || ! \is_string( $signature ) ) {
throw new \InvalidArgumentException(
'WordPress REST API request does not contain valid return parameter values.'
'WordPress REST API request does not contain valid return parameter values.'
);
}

Expand All @@ -102,7 +102,7 @@ private function get_return_parameters( WP_REST_Request $request ) {

/**
* Get payment.
*
*
* @param WP_REST_Request $request WordPress REST API request.
* @return Payment
* @throws \InvalidArgumentException Throws exception when REST request does not contain valid payment ID.
Expand Down Expand Up @@ -185,6 +185,8 @@ public function rest_api_return( WP_REST_Request $request ) {

if ( null !== $pronamic_status ) {
$payment->set_status( $pronamic_status );

$result->header( 'Location', $payment->get_return_redirect_url() );
}

$payment->save();
Expand Down

0 comments on commit e09fa36

Please sign in to comment.