bunq / sdk_php

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

Not receive schedule payment status (sdk_php) #170

Closed GytisTo closed 5 years ago

GytisTo commented 5 years ago

Steps to reproduce:

Create schedule payment and printed info about that payment

print_r($payment->getPayment()->getAmount()->getValue()); echo "
"; print_r($payment->getSchedule()->getTimeStart()); echo "
"; print_r($payment->getSchedule()->getStatus()); //only this one return empty echo "
"; print_r($payment->getPayment()->getCounterpartyAlias()->getDisplayName()); echo "
"; print_r($payment->getPayment()->getCounterpartyAlias()->getIban()); echo "
";

What should happen:

get all info about that payment

What happens:

didnt get payment status in both enviroments

Traceback

SDK version and environment

Response id

Extra info:

Im using sdk_php, also all other (at least i am using) i recieve , just can't get schedule payment status

basst85 commented 5 years ago

Extra info:

It looks like the SDK is looking in the wrong object. The status is inside the "ScheduledPayment" object, not in "Schedule" or "Payment".

OGKevin commented 5 years ago

I don't quite understand. @GytisTo could you please update the issue body to make it clear what is failing and properly format the issue. Plz use markdown formatting.

@basst85 how did you come to this conclusion? Did you manage to get a raw response ?

GytisTo commented 5 years ago

I don't quite understand. @GytisTo could you please update the issue body to make it clear what is failing and properly format the issue. Plz use markdown formatting.

@basst85 how did you come to this conclusion? Did you manage to get a raw response ?

basst85 commented 5 years ago

@basst85 how did you come to this conclusion? Did you manage to get a raw response ?

Yes, i managed to get the raw response. Check this: https://pastebin.com/Lj4bEvmw

OGKevin commented 5 years ago

yup, @basst85 you're correct 👍

@kojoru view definition mistake... this needs regeneration to fix it.

GytisTo commented 5 years ago

So i need take more info or its clear now what the problem is? :)

OGKevin commented 5 years ago

yea its clear @GytisTo

GytisTo commented 5 years ago

Cool :) inform me if you fix the problem or find other way to reach status :)

OGKevin commented 5 years ago

That is up to @kojoru, I could show you how to "hack"/modify the code for it to work if you want to.

GytisTo commented 5 years ago

well if there is way to get status from sdk_php it would be nice :)

OGKevin commented 5 years ago

You can add

    /**
     * The schedule status, options: ACTIVE, FINISHED, CANCELLED.
     *
     * @var string
     */
    protected $status;

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

and ofc its getters to get the status.

GytisTo commented 5 years ago

will try thanks :)

GytisTo commented 5 years ago

added your code and this: public function getStatus() { return $this->status; } looks like its working, thanks for help :)

GytisTo commented 5 years ago

I find interesting thing working on SANDBOX : if you use SchedulePayment::get you will get right one status but if you use SchedulePayment::listing to see status you will get all payments "ACTIVE" although there are payments which are "FINISHED" or "CANCELLED" . Also there is way to get specific days payments( for example these days)? cause i know only there is $pagination = new Pagination(); $pagination->setCount(2); $list = SchedulePayment::listing($monetaryAccount->getId(),$pagination->getUrlParamsCountOnly())->getValue() where you number of payments you wont to get

GytisTo commented 5 years ago

is this also kinda bug @OGKevin @basst85 ?