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

Bad schedule payment update response(sdk_php) #173

Closed
1 task
GytisTo opened this issue Jan 31, 2019 · 19 comments · Fixed by #179
Closed
1 task

Bad schedule payment update response(sdk_php) #173

GytisTo opened this issue Jan 31, 2019 · 19 comments · Fixed by #179

Comments

@GytisTo
Copy link

GytisTo commented Jan 31, 2019

Steps to reproduce:

  1. Make a schedule payment
    2.Try to update schedule payment

What should happen:

1.Payment should be updated and return as a success

What happens:

1.Payment updates but return as a fail.

SDK version and environment

  • [ +] Sandbox
  • Production

Extra info:

`$monetaryAccountId = $monetaryAccount->getId();
$transaction_id = $dataForTransaction['transaction_id'];

$counterpartyAlias_user = new Pointer('IBAN', $payment->userIban ,$payment->userRecipient);
$schedule = new Schedule($payment->endTime, 'ONCE', 1);
$amount_user = new Amount($payment->userAmount, 'EUR');
$description = $transaction_id;
$schedulePayment_user = new SchedulePaymentEntry($amount_user, $counterpartyAlias_user, $description);

$user_update_id = SchedulePayment::update($payment->userPaymentId, $monetaryAccountId, $schedulePayment_user, $schedule);`

Error shown:

A PHP Error was encountered
Severity: Notice

Message: Undefined index: Id

Filename: Core/BunqModel.php

An uncaught Exception was encountered
Type: Error

Message: Call to a member function getId() on null

@basst85
Copy link

basst85 commented Feb 1, 2019

@kojoru I can also simulate this error

@GytisTo
Copy link
Author

GytisTo commented Feb 20, 2019

is there is any progress?

@GytisTo
Copy link
Author

GytisTo commented Feb 25, 2019

can I get any response about that issue? cause now I even don't know are you trying to fix the issue or just leave like that.

@GytisTo
Copy link
Author

GytisTo commented Mar 18, 2019

Hello, can i get any response of this issue ? @kojoru this is very important

@OGKevin
Copy link
Contributor

OGKevin commented Mar 18, 2019

@basst85 or @GytisTo could you please provide a better stack trace of the error?

@GytisTo
Copy link
Author

GytisTo commented Mar 19, 2019

Untitled

@GytisTo
Copy link
Author

GytisTo commented Mar 19, 2019

@kojoru you mean self error or how i get error?

@basst85
Copy link

basst85 commented Mar 19, 2019

@OGKevin I think you have enough information now, or do you need more? 🙂

@OGKevin
Copy link
Contributor

OGKevin commented Mar 19, 2019

@kojoru you mean self error or how i get error?
I take it you are talking to me? I'm not @kojoru :)

I meant the error. What you have posted is enough for me to have a look at this to see what is the issue.

@OGKevin
Copy link
Contributor

OGKevin commented Mar 19, 2019

@OGKevin I think you have enough information now, or do you need more? 🙂
for now i have enough yes :D

@OGKevin
Copy link
Contributor

OGKevin commented Mar 19, 2019

Right, so it seems that the actual response is not matching what is defined on doc.bunq.com.

Could you please compare the actual response with what is described at https://doc.bunq.com/#/schedule-payment/Update_SchedulePayment_for_User_MonetaryAccount.

Once we have an example of the actual response i can show you what you can change to the code for it to work for you until @kojoru can properly fix this internally and regenerate the SDK.

I have not seen much activity from him on github, so i would suggest you to open a topic on together and spam it with gifs.

@GytisTo
Copy link
Author

GytisTo commented Mar 19, 2019

Sorry im not used to use posts, get's like that. it should be something like that ?
`url: https://public-api.sandbox.bunq.com/v1/user/{userID}/monetary-account/{monetary-accountID}/schedule-payment/{itemId}

and raw body:
curl https://public-api.sandbox.bunq.com/v1/sandbox-user -X POST
--header "Content-Type: application/json"
--header "Cache-Control: none"
--header "User-Agent: curl-request"
--header "X-Bunq-Client-Request-Id: $(date)randomId"
--header "X-Bunq-Language: nl_NL"
--header "X-Bunq-Region: nl_NL"
--header "X-Bunq-Geolocation: 0 0 0 0 000"
`
for all that im using postman @OGKevin

@basst85
Copy link

basst85 commented Mar 20, 2019

@OGKevin The actual response JSON: https://pastebin.com/jNbs9ELS

@GytisTo
Copy link
Author

GytisTo commented Mar 20, 2019

@OGKevin The actual response JSON: https://pastebin.com/jNbs9ELS

thanks for help :)

@OGKevin
Copy link
Contributor

OGKevin commented Mar 20, 2019

@OGKevin The actual response JSON: https://pastebin.com/jNbs9ELS

if that's the response of a PUT

Then you can just replace

return BunqResponseInt::castFromBunqResponse(
static::processForId($responseRaw)
);

with

return BunqResponseSchedulePayment::castFromBunqResponse(
static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
);

Basically the response is the same as the GET response.

@OGKevin
Copy link
Contributor

OGKevin commented Mar 20, 2019

However, seeing the data this is from sandbox. It can be that sandbox is outdated compared to production as we have seen before.

@GytisTo
Copy link
Author

GytisTo commented Mar 20, 2019

@OGKevin still not working :/
image

@OGKevin
Copy link
Contributor

OGKevin commented Mar 20, 2019

@OGKevin still not working :/

As the error says, you must change the return type :).

change

with

): BunqResponseSchedulePayment {

@GytisTo
Copy link
Author

GytisTo commented Mar 20, 2019

ah.. looks like it works now, thanks :) @OGKevin

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

Successfully merging a pull request may close this issue.

3 participants