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

PaymentReference is generated with an invalid value #21

Open
bartbrouwer opened this issue Sep 6, 2022 · 2 comments
Open

PaymentReference is generated with an invalid value #21

bartbrouwer opened this issue Sep 6, 2022 · 2 comments

Comments

@bartbrouwer
Copy link

bartbrouwer commented Sep 6, 2022

$this->paymentReference = "$this->debtorReference$this->transactionID";

DebtorReference has to be maximal 35 characters long
TransactionID has to be alphanumeric and maximal 64 characters long and is set by the library by the first 28 characters of DebtorReference plus YYYYMMDD
PaymentReference has to be alphanumeric and maximal 35 characters long

So, given this example:
DebtorReference = "Website order 12345678";
The library is removing all the non-alphanumeric values from the DebtorReference (#20) (why?).

TransactionID will be "Websiteorder1234567820220906";
PaymentReference will be "Websiteorder12345678Websiteorder1234567820220906";

The PaymentReference is a combination of a max 35 long string and a max 36 long string, but can only be 35 chars long and will throw a validation error from the API.

Expected behaviour is that PaymentReference can be set by the implementation (and will be validated) or otherwise will be a valid generated value which meets the API requirements.

@bartbrouwer bartbrouwer changed the title PaymentReferenc PaymentReference is generated with an invalid value Sep 6, 2022
@DaanRijpkema
Copy link
Collaborator

Hi Bart,
In release 2.1.4.1 you can now set the PaymentReference as the last parameter when creating a PaymentRequest. Example:

    $request = $bluem_object->CreatePaymentRequest(
        $description,
        $debtorReference,
        $amount,
        $dueDateTime,
        $currency,
        $entranceCode,
        $debtorReturnURL,
        $paymentReference
    );

Moreover, the sanitization has been moved from the DebtorReference (now only substring to 35chars) but added to the TransactionID.
If a PaymentReference is set by the application, the library does not use the fallback of a concatenated string.

@bartbrouwer
Copy link
Author

bartbrouwer commented Sep 12, 2022

When no PaymentReference is provided, DebtorReference and TransactionID are used as PaymentReference.
DebtorReference may contain whitespaces, PaymentReference don't.
Because of that, the PaymentReference should be sanitized. That's currentlty missing.

When I provide DebtorReference 'Payment 123' and no PaymentReference, I'll get an exception about the space.
When I provide DebtorReference with 35 characters and no PaymentReference, I'll get an exception about the length.

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