Skip to content
Snippets Groups Projects
Commit 79a35982 authored by Petr Kalashnikov's avatar Petr Kalashnikov
Browse files

Fix signature for batch extraction method

parent 75810414
No related branches found
No related tags found
2 merge requests!13Fsho12, del 1: mulighet å returnere en liste av batcher uten vouchere,!11FSHO10: support filtering of batches in list from setra
Pipeline #67482 passed
"""Client for connecting to SETRA API"""
import logging
import urllib.parse
from typing import Union
from typing import Union, Optional
import requests
from setra_client.models import Batch, CompleteBatch, BatchErrors
from setra_client.models import (Batch,
CompleteBatch,
BatchErrors,
BatchProgressEnum)
logger = logging.getLogger(__name__)
......@@ -182,11 +185,12 @@ class SetraClient(object):
return cls.from_dict(data)
def get_batch(self,
batch_id: int = None,
min_created_date: str = None,
max_created_date: str = None,
batch_progress: str = None,
interface: str = None):
batch_id: Optional[int] = None,
min_created_date: Optional[str] = None,
max_created_date: Optional[str] = None,
batch_progress: Optional[BatchProgressEnum] = None,
interface: Optional[str] = None):
"""
GETs one or all batches from SETRA.
Dates (maximal and minimal creation dates) should
......
......@@ -3,7 +3,7 @@ import datetime
import json
import typing
from typing import Optional, TypeVar
from enum import Enum
import pydantic
NameType = TypeVar('NameType')
......@@ -30,6 +30,23 @@ class BaseModel(pydantic.BaseModel):
return cls.from_dict(data)
class BatchProgressEnum(Enum):
CREATED = 'created'
VALIDATION_COMPLETED = 'validation_completed'
VALIDATION_FAILED = 'validation_failed'
SENT_TO_UBW = 'sent_to_ubw'
SEND_TO_UBW_FAILED = 'send_to_ubw_failed'
POLLING_COMPLETED = 'polling_completed'
POLLING_FAILED = 'polling_failed'
UBW_IMPORT_OK = 'ubw_import_ok'
UBW_IMPORT_FAILED = 'ubw_import_failed'
FETCH_FINAL_VOUCHERNO_COMPLETED = 'fetch_final_voucherno_completed'
FETCH_FINAL_VOUCHERNO_FAILED = 'fetch_final_voucherno_failed'
def __str__(self):
return str(self.value)
class Transaction(BaseModel):
account: str
amount: float
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment