Closed CharlPels closed 7 years ago
@CharlPels Name option is not required for some pointer types. Therefore, it is not settable from the constructor. You can set it after the object is instantiated, just like any other optional field of any object in our SDK. Please do this:
pointer = object_.Pointer('IBAN', 'IBAN number')
pointer.name = 'Name'
Closing this issue as of its not a bug nor request. Feel free to comment if you have further questions 😉
I have no clue how to implement pointer = object_.Pointer('IBAN', 'IBAN number') pointer.name = 'Name' maybe an update to the payment sample would be nice
@CharlPels That's the original example:
#!/usr/bin/env python3
from bunq.sdk import context
from bunq.sdk.model import generated
from bunq.sdk.model.generated import object_
_PAYMENT_AMOUNT = '0.01'
_PAYMENT_CURRENCY = 'EUR'
_COUNTERPARTY_POINTER_TYPE = 'EMAIL'
_COUNTERPARTY_EMAIL = 'bravo@bunq.com' # Put your counterparty email here
_PAYMENT_DESCRIPTION = 'This is a generated payment!'
_USER_ITEM_ID = 0 # Put your user ID here
_MONETARY_ACCOUNT_ITEM_ID = 0 # Put your monetary account ID here
def run():
api_context = context.ApiContext.restore()
request_map = {
generated.Payment.FIELD_AMOUNT: object_.Amount(
_PAYMENT_AMOUNT,
_PAYMENT_CURRENCY
),
generated.Payment.FIELD_COUNTERPARTY_ALIAS: object_.Pointer(
_COUNTERPARTY_POINTER_TYPE,
_COUNTERPARTY_EMAIL
),
generated.Payment.FIELD_DESCRIPTION: _PAYMENT_DESCRIPTION,
}
payment_id = generated.Payment.create(
api_context,
request_map,
_USER_ITEM_ID,
_MONETARY_ACCOUNT_ITEM_ID
).value
print(
generated.Payment.get(
api_context,
_USER_ITEM_ID,
_MONETARY_ACCOUNT_ITEM_ID,
payment_id
).value.to_json()
)
@CharlPels
And that's what you need...
#!/usr/bin/env python3
from bunq.sdk import context
from bunq.sdk.model import generated
from bunq.sdk.model.generated import object_
_PAYMENT_AMOUNT = '0.01'
_PAYMENT_CURRENCY = 'EUR'
_COUNTERPARTY_POINTER_TYPE = 'EMAIL'
_COUNTERPARTY_EMAIL = 'bravo@bunq.com' # Put your counterparty email here
_PAYMENT_DESCRIPTION = 'This is a generated payment!'
_USER_ITEM_ID = 0 # Put your user ID here
_MONETARY_ACCOUNT_ITEM_ID = 0 # Put your monetary account ID here
def run():
api_context = context.ApiContext.restore()
pointer = object_.Pointer(
_COUNTERPARTY_POINTER_TYPE,
_COUNTERPARTY_EMAIL
)
pointer.name = 'Some Name' # <---------
request_map = {
generated.Payment.FIELD_AMOUNT: object_.Amount(
_PAYMENT_AMOUNT,
_PAYMENT_CURRENCY
),
generated.Payment.FIELD_COUNTERPARTY_ALIAS: pointer,
generated.Payment.FIELD_DESCRIPTION: _PAYMENT_DESCRIPTION,
}
payment_id = generated.Payment.create(
api_context,
request_map,
_USER_ITEM_ID,
_MONETARY_ACCOUNT_ITEM_ID
).value
print(
generated.Payment.get(
api_context,
_USER_ITEM_ID,
_MONETARY_ACCOUNT_ITEM_ID,
payment_id
).value.to_json()
)
Thanks for the sample, it works perfect
With the new sdk the object_.Pointer option is not working anymore, the thinker sample
endpoint.Payment.create(
amount=Amount(amount_string, self._CURRENCY_EUR),
counterparty_alias=Pointer(self._POINTER_TYPE_EMAIL, recipient),
description=description
)
is just for sending to bunq accounts, can you give a sample for sending money to IBAN nummers just like you did for the older sdk version.
lOOKS LIKE THE generated.Payment.FIELD_COUNTERPARTY_ALIAS is not supporting IBANs for sending money For example using generated.Payment.FIELD_COUNTERPARTYALIAS: object.Pointer( 'IBAN', 'IBAN number', 'Name' ), The Name option looks like it is not there at all