app/Dorcas/Support/helpers.php
/**
 * ReQueries the server for the details of a transaction.
 *
 * @param string $env
 * @param string $secretKey
 * @param string $reference
 * @param Order  $order
 *
 * @return array
 */
ReQueries the server for the details of a transaction.

@return array
ReQueries the server for the details of a transaction . @return array
function payment_verify_rave(string $env, string $secretKey, string $reference, Order $order): array
{
    $response = get_rave_http_client($env)->post('/flwv3-pug/getpaidx/api/xrequery', [
        RequestOptions::JSON => [
            'SECKEY' => $secretKey,
            'txref' => $reference,
            'include_payment_entity' => '1'
        ]
    ]);
    $json = json_decode((string) $response->getBody(), true);
    if (empty($json['data'])) {
        throw new RuntimeException('Could not verify the details of the payment. Contact support for assistance.');
    }
    return [
        'channel' => 'rave',
        'reference' => $reference,
        'amount' => $json['data']['amount'],
        'response_code' => $json['data']['chargecode'],
        'response_description' => '',
        'json_payload' => $json,
        'is_successful' => $json['data']['chargecode'] == '00' || $json['data']['chargecode'] == '0'
    ];
}
function payment_verify_rave ( string $ env , string $ secretKey , string $ reference , Order $ order ) : array { $ response = get_rave_http_client ( $ env ) -> post ( '/flwv3-pug/getpaidx/api/xrequery' , [ RequestOptions :: JSON => [ 'SECKEY' => $ secretKey , 'txref' => $ reference , 'include_payment_entity' => '1' ] ] ) ; $ json = json_decode ( ( string ) $ response -> getBody ( ) , true ) ; if ( empty ( $ json [ 'data' ] ) ) { throw new RuntimeException ( 'Could not verify the details of the payment. Contact support for assistance.' ) ; } return [ 'channel' => 'rave' , 'reference' => $ reference , 'amount' => $ json [ 'data' ] [ 'amount' ] , 'response_code' => $ json [ 'data' ] [ 'chargecode' ] , 'response_description' => '' , 'json_payload' => $ json , 'is_successful' => $ json [ 'data' ] [ 'chargecode' ] == '00' || $ json [ 'data' ] [ 'chargecode' ] == '0' ] ; }
ReQueries the server for the details of a transaction.
ReQueries the server for the details of a transaction .
# send the request