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

reopening of question #12 generated.Payment.FIELD_COUNTERPARTY_ALIAS not working with IBAN #96

Closed
CharlPels opened this issue May 8, 2018 · 2 comments

Comments

@CharlPels
Copy link

In issue #12 a solution was given for sending money to IBAN numbers, this is no longer working for the new SDK.
Would love to know how to do the same in the with the new sdk,

thinker sample is only for sending to email

    endpoint.Payment.create(
        amount=Amount(amount_string, self._CURRENCY_EUR),
        counterparty_alias=Pointer(self._POINTER_TYPE_EMAIL, recipient),
        description=description
    )
@OGKevin
Copy link
Contributor

OGKevin commented May 8, 2018

class Pointer(core.BunqModel):
"""
:param type_: The alias type, can be: EMAIL|PHONE_NUMBER|IBAN.
:type type_: str
:param value: The alias value.
:type value: str
:param name: The alias name.
:type name: str
"""
def __init__(self, type_=None, value=None, name=None):
"""
:param type_: The alias type, can be: EMAIL|PHONE_NUMBER|IBAN.
:type type_: str
:param value: The alias value. Phone number are formatted conform E.123
without spaces (e.g., +314211234567).
:type value: str
:param name: The alias name. Only required for IBANs.
:type name: str
"""
self.type_ = type_
self.value = value
self.name = name

I think this says enough ? :)

Closing as this is not a bug or feature request. Feel free to continue commenting.

@OGKevin OGKevin closed this as completed May 8, 2018
@CharlPels
Copy link
Author

CharlPels commented May 8, 2018

Thanks Kevin,

issue solved, and for others this may help them

for the core part i added this

from bunq.sdk.model import core

then 2 classes

class Pointer(core.BunqModel): 
""" 
:param type_: The alias type, can be: EMAIL|PHONE_NUMBER|IBAN. 
:type type_: str 
:param value: The alias value. 
:type value: str 
:param name: The alias name. 
:type name: str 
""" 

    def __init__(self, type_=None, value=None, name=None): 
     """ 
     :param type_: The alias type, can be: EMAIL|PHONE_NUMBER|IBAN. 
     :type type_: str 
     :param value: The alias value. Phone number are formatted conform E.123 
     without spaces (e.g., +314211234567). 
     :type value: str 
     :param name: The alias name. Only required for IBANs. 
     :type name: str 
     """ 

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

 class Amount(core.BunqModel): 
    def __init__(self, value=None, currency=None):  
     self.value = value 
     self.currency = currency

Here is my payment function

   def Payment(_PAYMENT_AMOUNT,_COUNTERPARTY_IBAN,_COUNTERPARTY_NAME,_PAYMENT_DESCRIPTION,_MONETARY_ACCOUNT_ITEM_ID):
    endpoint.Payment.create(
        amount=Amount(_PAYMENT_AMOUNT, "EUR"),
        counterparty_alias=Pointer("IBAN",_COUNTERPARTY_IBAN,_COUNTERPARTY_NAME),
        description=_PAYMENT_DESCRIPTION,
        monetary_account_id=_MONETARY_ACCOUNT_ITEM_ID
    )

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