bunq / sdk_php

PHP SDK for bunq API
MIT License
84 stars 54 forks source link

Bad schedule payment update response(sdk_php) #173

Closed GytisTo closed 5 years ago

GytisTo commented 5 years ago

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

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 commented 5 years ago

@kojoru I can also simulate this error

GytisTo commented 5 years ago

is there is any progress?

GytisTo commented 5 years ago

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 commented 5 years ago

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

OGKevin commented 5 years ago

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

GytisTo commented 5 years ago

Untitled

GytisTo commented 5 years ago

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

basst85 commented 5 years ago

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

OGKevin commented 5 years ago

@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 commented 5 years ago

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

OGKevin commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

GytisTo commented 5 years ago

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

thanks for help :)

OGKevin commented 5 years ago

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

if that's the response of a PUT

Then you can just replace

https://github.com/bunq/sdk_php/blob/e9511e1c158a2c8d768d167bc05a66d7d88ea5d5/src/Model/Generated/Endpoint/SchedulePayment.php#L220-L222

with

https://github.com/bunq/sdk_php/blob/e9511e1c158a2c8d768d167bc05a66d7d88ea5d5/src/Model/Generated/Endpoint/SchedulePayment.php#L155-L157

Basically the response is the same as the GET response.

OGKevin commented 5 years ago

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

GytisTo commented 5 years ago

@OGKevin still not working :/ image

OGKevin commented 5 years ago

@OGKevin still not working :/

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

change https://github.com/bunq/sdk_php/blob/e9511e1c158a2c8d768d167bc05a66d7d88ea5d5/src/Model/Generated/Endpoint/SchedulePayment.php#L206

with https://github.com/bunq/sdk_php/blob/e9511e1c158a2c8d768d167bc05a66d7d88ea5d5/src/Model/Generated/Endpoint/SchedulePayment.php#L144

GytisTo commented 5 years ago

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