Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process API - Undefined array key "identifier" #88

Open
madrzejewski opened this issue Oct 8, 2024 · 0 comments
Open

Process API - Undefined array key "identifier" #88

madrzejewski opened this issue Oct 8, 2024 · 0 comments

Comments

@madrzejewski
Copy link

madrzejewski commented Oct 8, 2024

Hello,

On the process API, the following error can happen :

ErrorException:
Warning: Undefined array key "identifier"

at vendor/sandwave-io/realtimeregister-php/src/Domain/Process.php:150

This happens when we try to list all processes using :

$realtimeRegister->processes->list();

It seems that RTR can return processes without the identifier key. When this happens, it can throw an error.

I modified the ProcessApi.php file to debug this, and I found out that the processes without the identifier keys are the ones related to the action of adding credit to the account.

[ProcessesApi.php](file:///app/vendor/sandwave-io/realtimeregister-php/src/Api/ProcessesApi.php#L68) on line 68:
array:11 [▼
  "id" => REDACTED
  "user" => "rtr/admin"
  "customer" => "REDACTED"
  "status" => "COMPLETED"
  "createdDate" => "2024-04-17T13:58:17Z"
  "updatedDate" => "2024-04-17T13:58:17Z"
  "startedDate" => "2024-04-17T13:58:17Z"
  "action" => "allotmarketingcredit"
  "type" => "billing"
  "transaction" => array:1 [▼
    "EUR" => 1000000
  ]
  "command" => array:3 [▼
    "currency" => "EUR"
    "amount" => 1000000
    "description" => "test"
  ]
]

EDIT: There is some other actions that create a process without an identifier, for instance :

{
      "id": REDACTED,
      "user": "REDACTED",
      "customer": "REDACTED",
      "status": "COMPLETED",
      "createdDate": "2024-07-09T14:57:35Z",
      "updatedDate": "2024-07-09T14:57:35Z",
      "startedDate": "2024-07-09T14:57:35Z",
      "action": "createhmackey",
      "type": "customer",
      "command": {
          "customer": "REDACTED"
      }
  }

You can find those using the identifier + does not have a value filter.

Edit 2 : For now, I ignore/bypass the error using :

$realtimeRegister->processes->list(parameters: ['identifier:not_null' => ''])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant