mangopay2-python-sdk icon indicating copy to clipboard operation
mangopay2-python-sdk copied to clipboard

Fields not set on ReportTransactions create()

Open MatCast opened this issue 1 year ago • 1 comments

I am trying to create a report following the documentation here.

I however had to change the handler as suggested on 136 as i was getting an invalid_client error.

My resulting code is:

mangopay.client_id = CLIENT_ID
mangopay.apikey = APIKEY 

mangopay.sandbox = False

# Set your other settings.
_handler = mangopay.APIRequest(client_id=CLIENT_ID, apikey=APIKEY)
_handler.sandbox = False

def get_default_handler():
    return _handler

# Monkeypatch `get_default_handler` everywhere.
mangopay.get_default_handler = get_default_handler
mangopay.base.get_default_handler = get_default_handler
mangopay.query.get_default_handler = get_default_handler

filters = ReportTransactionsFilters(
    status=["SUCCEEDED", "CREATED", "FAILED"],
    nature=["REGULAR", "REFUND", "REPUDIATION", "SETTLEMENT"],
    transaction_type=["PAYIN", "PAYOUT", "TRANSFER"],
    wallet_id=123456,
    author_id=None,
    min_debited_funds_currency="EUR",
    max_debited_funds_currency="EUR",
    after_date=1696756976,
    before_date=1699435376,
)
transactions_report = ReportTransactions(
    tag="Created using Mangopay Python SDK",
    download_format="CSV",
    callback_url="https://mangopay.com/docs/please-ignore",
    sort="CreationDate: ASC",
    preview=False,
    filters=filters,
    columns=[
        "Id",
        "Tag",
        "CreationDate",
        "ExecutionDate",
        "AuthorId",
        "CreditedUserId",
        "DebitedFundsAmount",
        "CreditedFundsAmount",
        "Status",
        "ResultCode",
        "ResultMessage",
        "Type",
        "Nature",
        "CreditedWalletId",
        "DebitedWalletId",
    ],
)

create_report = transactions_report.create()

The report is created but all the parametrs passed to the call are ignored and the default parameters are instead set. I get a report with no for example no Tag, and none of the filter i set up.

Am i doing something wrong? I am using version 3.35.1

MatCast avatar Sep 08 '24 11:09 MatCast

Hi @MatCast

Do you still have this issue? We have also added a new implementation of reports, the ReportV2 class. Maybe using that would help.

iulian03 avatar Aug 26 '25 11:08 iulian03