setIPAddress in etapestry

A post that I wrote trying make myself feel better with pat in my back.

August 05, 2022 Code

For any of the poor souls experiencing lack of documentation with using setIPAddress, there’s few things that you should consider:

  1. Need to use error catching function if you want to check if there is an error.
  2. Need to use
  3. array("IP Address")
  4. as a parameter.

The code is as follows:

$nsc->call("setIPAddress", array($_SERVER['REMOTE_ADDR']));

if($nsc->fault || $nsc->getError())
{
    $resp_obj['accountRef'] = $accountReference;
    $resp_obj['error'] = checkStatus($nsc);
    stopEtapestrySession($nsc);
    return $this->asJson($resp_obj);
}

$transResponse = $nsc->call("processTransaction", array($transactionRequest));

The $_SERVER['REMOTE_ADDR'] gives client’s IP address. Also, right after the setIPAddress and error handling code, we run the transaction code.

Invely's