Giter Club home page Giter Club logo

Comments (7)

dnl-blkv avatar dnl-blkv commented on May 26, 2024 2

@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'

from sdk_python.

CharlPels avatar CharlPels commented on May 26, 2024 1

Thanks for the sample, it works perfect

from sdk_python.

OGKevin avatar OGKevin commented on May 26, 2024

Closing this issue as of its not a bug nor request. Feel free to comment if you have further questions 😉

from sdk_python.

CharlPels avatar CharlPels commented on May 26, 2024

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

from sdk_python.

dnl-blkv avatar dnl-blkv commented on May 26, 2024

@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 = '[email protected]'  # 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()
    )

from sdk_python.

dnl-blkv avatar dnl-blkv commented on May 26, 2024

@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 = '[email protected]'  # 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()
    )

from sdk_python.

CharlPels avatar CharlPels commented on May 26, 2024

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.

from sdk_python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.