|
|
@@ -23,6 +23,14 @@ $GLOBALS['pdo'] = new PDO($dsn, $dbUser, $dbPass);
|
|
|
$GLOBALS['pdo']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
|
|
$payloadFile = $argv[1] ?? null;
|
|
|
+$cprIdArg = $argv[1] ?? null;
|
|
|
+if ($cprIdArg === null || !ctype_digit((string)$cprIdArg)) {
|
|
|
+ fwrite(STDERR, "Usage: php ./test/token_create_test.php <cpr_id> [payload.json]" . PHP_EOL);
|
|
|
+ exit(1);
|
|
|
+}
|
|
|
+$cprId = (int)$cprIdArg;
|
|
|
+$payloadFile = $argv[2] ?? null;
|
|
|
+
|
|
|
if ($payloadFile) {
|
|
|
if (!is_file($payloadFile)) {
|
|
|
fwrite(STDERR, "[error] Payload file '{$payloadFile}' not found" . PHP_EOL);
|
|
|
@@ -44,11 +52,13 @@ if ($payloadFile) {
|
|
|
'wallet_id' => 1,
|
|
|
'chain_id' => 1,
|
|
|
'commodities_id' => 1,
|
|
|
- 'cpr_id' => 1,
|
|
|
+ 'cpr_id' => $cprId,
|
|
|
'user_id' => 1,
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+$data['cpr_id'] = $cprId;
|
|
|
+
|
|
|
$required = [
|
|
|
'token_commodities_amount',
|
|
|
'token_commodities_value',
|