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

Name field for pointer counterparty #29

Closed
y0sh1 opened this issue Sep 26, 2017 · 3 comments
Closed

Name field for pointer counterparty #29

y0sh1 opened this issue Sep 26, 2017 · 3 comments

Comments

@y0sh1
Copy link

y0sh1 commented Sep 26, 2017

Hey Guys!

Awesome work on the API. Been playing around with it for a while now and thought now was the time to get into automated payments.

When doing this I ran into to the problem of transfering money to myself. The only way I found that would work, is to transfer it to the iban of the account I wanted it in.

So i started with the payment requestmap, like the example:

request_map = {
    generated.Payment.FIELD_AMOUNT: object_.Amount(
        str(pin_saving_amount),
        'EUR'
    ),
    generated.Payment.FIELD_COUNTERPARTY_ALIAS: object_.Pointer(
        'IBAN',
        'NL13BUNQ3713371337'
    ),
    generated.Payment.FIELD_DESCRIPTION: 'Pinsparen {}'.format(yesterday),
}

This bounded when creating the payment, because the name field was not set. Now i thought this was an error on my end, but looking in the SDK code I came across the reason didn't see it coming in the first place. Note that the api docs state this is needed, so I could have used my eyes to start with 😇 .

class Pointer(model.BunqModel):
    """
    :type type_: str
    :type value: str
    :type name: str
    """

    def __init__(self, type_, value):
        """
        :type type_: str
        :type value: str
        """

        self.type_ = type_
        self.value = value
        self.name = None

This is a piece of code from:

class Pointer(model.BunqModel):

As can be seen the name object is None by default and not set-able on init, which would make sense to do if you'd like to enforce people to use it in some cases.

Since this code is in the "generated" directory i didn't start creating a PR already, because i would like to verify if that would be a 'good move' or this is something that had to be done on bunq's side for generating the code.

Anyway, the following code would make a good replacement:

class Pointer(model.BunqModel):
    """
    :type type_: str
    :type value: str
    :type name: str
    """

    def __init__(self, type_, value, name=None):
        """
        :type type_: str
        :type value: str
        :type name: str
        """

        self.type_ = type_
        self.value = value
        self.name = name

This way name will be None by default, but at least set-able at creation 🙂

@dnl-blkv
Copy link
Contributor

@y0sh1 thanks for the suggestion!

The code is indeed generated and should be changed on our side :)

The reason we did not do it this way initially is that in Java it would require a lot of extra code to be generated. However, since this issue was raised already more than once, now we don't have any options but look into it 👍

I'll post updates to this issue!

@OGKevin
Copy link
Contributor

OGKevin commented Jan 5, 2018

This is related to #55 and will be closed once the referenced issue is closed.

duplicate #55

@OGKevin OGKevin added this to the 0.13.0 milestone Jan 5, 2018
@OGKevin OGKevin modified the milestones: 0.13.0, 0.13.5 Mar 27, 2018
@OGKevin OGKevin added this to To do in 1.0.0 - SDK via automation Mar 27, 2018
@OGKevin
Copy link
Contributor

OGKevin commented Apr 11, 2018

Closing in favour of #55

@OGKevin OGKevin closed this as completed Apr 11, 2018
1.0.0 - SDK automation moved this from To do to Done Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
1.0.0 - SDK
  
Done
Development

No branches or pull requests

3 participants