Sets the transaction ID.
public setTransactionId ( string $value ) : |
||
$value | string | |
return | Provides a fluent interface |
/** * Override the abstract method to add requirement that it must start with 4 numeric characters * * @param string|int $value The transaction ID (merchant order) to set for the transaction */ public function setTransactionId($value) { $start = substr($value, 0, 4); $numerics = 0; foreach (str_split($start) as $char) { if (is_numeric($char)) { $numerics++; } else { break; } } $value = str_pad(substr($start, 0, $numerics), 4, 0, STR_PAD_LEFT) . substr($value, $numerics); parent::setTransactionId($value); }