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

TabUsageSingle with uuid "X" not found. #106

Closed
dqos opened this issue Jan 13, 2018 · 3 comments
Closed

TabUsageSingle with uuid "X" not found. #106

dqos opened this issue Jan 13, 2018 · 3 comments

Comments

@dqos
Copy link

dqos commented Jan 13, 2018

I'm using the following code to get the status of a request/tab (no bunq request), but it always returns an error that the UUID can't be found. Is this intentional due the sandbox mode?

First I create a tab, and I use that UUID to get the status, so it should work...
Then I tried to get the status of a real UUID from my bunq account, same issue.

Steps to reproduce:

// Restore the API context.
$apiContext = ApiContext::restore(ApiContext::FILENAME_CONFIG_DEFAULT);
// Retrieve the active user.
$users = User::listing($apiContext)->getValue();
// If your user is UserPerson or UserLight, replace getUserCompany() with getUserPerson() or getUserLight()
$userId = $users[INDEX_FIRST]->getUserCompany()->getId();
// Retrieve the first monetary account of the active user.
$monetaryAccounts = MonetaryAccount::listing($apiContext, $userId)->getValue();
$monetaryAccountId = $monetaryAccounts[INDEX_FIRST]->getMonetaryAccountBank()->getId();

$attachmentPublicBytes = file_get_contents(__DIR__ . ATTACHMENT_FILENAME);
$requestHeadersMap = [
    ApiClient::HEADER_CONTENT_TYPE => ATTACHMENT_CONTENT_TYPE,
    ApiClient::HEADER_ATTACHMENT_DESCRIPTION => ATTACHMENT_DESCRIPTION,
];
// Create a new public attachment.
$attachmentPublicUuid = AttachmentPublic::create($apiContext, $attachmentPublicBytes, $requestHeadersMap)->getValue();
$attachmentPublicUuidMap = [
    Avatar::FIELD_ATTACHMENT_PUBLIC_UUID => $attachmentPublicUuid,
];
// Create a new avatar using the public attachment.
$avatarUuid = Avatar::create($apiContext, $attachmentPublicUuidMap)->getValue();

$cashRegisterMap = [
    CashRegister::FIELD_AVATAR_UUID => $avatarUuid,
    CashRegister::FIELD_LOCATION => $geoLocation,
    CashRegister::FIELD_NAME => uniqid(CASH_REGISTER_PREFIX_NAME),
    CashRegister::FIELD_STATUS => CASH_REGISTER_STATUS_PENDING_APPROVAL,
];

$cashRegisterId = CashRegister::create($apiContext, $cashRegisterMap, $userId, $monetaryAccountId)->getValue();

$tab = TabUsageSingle::get($apiContext, $userId, $monetaryAccountId, $cashRegisterId, "XXX")->getValue();

What should happen:

It should return the status of the UUID.

What happens:

HTTP Response Code: 404
TabUsageSingle with uuid "691b0115-b4c9-4d3a-8fcf-c72dd3c5d47d" not found.

Thanks!

@OGKevin
Copy link
Contributor

OGKevin commented Jan 13, 2018

@Qarizma in this code snippet i don't see you creating the tab ?

Where are you getting "XXX" from ?

@dqos
Copy link
Author

dqos commented Jan 13, 2018

@OGKevin I already created a tab using:
https://github.com/bunq/sdk_php/blob/develop/example/tab_example.php

The XXX is returned by $tabUsageSingle->getUuid();
The UUID seems to be correct formed. Also tried using an existing/real uuid.

@OGKevin
Copy link
Contributor

OGKevin commented Jan 13, 2018

@Qarizma i could not reproduce with the following code:

        static::$tabUuid = TabUsageSingle::create(
            $apiContext,
            $tabUsageSingleCreateMap,
            static::$userId,
            static::$monetaryAccountId,
            static::$cashRegisterId
        )->getValue();

        $tabUsageSingle =
            TabUsageSingle::get(
                $apiContext,
                static::$userId,
                static::$monetaryAccountId,
                static::$cashRegisterId,
                static::$tabUuid
            );
  1. Are you sure you're indeed using the correct uuid ?
  2. Could you filter out the unneeded code from the issue, maybe this will help us spot the problem quicker.
  3. When you do listing, instead of get, do you see the new tab you created in that list ?
  4. Could you do a get call to CashRegister and check the status of this cash register.

@OGKevin OGKevin closed this as completed Apr 7, 2018
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

2 participants