Skip to content

Savings

Savings

Bases: BaseAPIWrapper

Source code in pykuda2/wrappers/sync_wrappers/savings.py
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
class Savings(BaseAPIWrapper):
    def create_plain_savings_account(
        self,
        name: str,
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Create a Plain Savings Account.

        To create a Plain savings, in your request, you need to state the Virtual Account
        associated with this savings account as well as create a unique identifier for
        the savings account to be created.

        Args:
            name: The savings plan name.
            tracking_reference: The virtual account transaction reference number.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {"Name": name, "TrackingReference": tracking_reference}
        return self._api_call(
            service_type=ServiceType.CREATE_PLAIN_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def get_plain_savings_account(
        self,
        tracking_reference: str,
        primary_account_number: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieves a customers plain savings account

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
                This parameter is for specific plain savings.
            primary_account_number: Account number of the specific customer.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "TrackingReference": tracking_reference,
            "PrimaryAccountNumber": primary_account_number,
        }
        return self._api_call(service_type=ServiceType.GET_PLAIN_SAVE, data=data)

    def get_plain_savings_accounts(
        self, tracking_reference: str, request_reference: Optional[str] = None
    ) -> APIResponse:
        """Retrieves all customers plain savings accounts

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
                This parameter is for specific plain savings.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {"TrackingReference": tracking_reference}
        return self._api_call(
            service_type=ServiceType.GET_ALL_CUSTOMER_PLAIN_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def credit_or_debit_plain_savings_account(
        self,
        amount: Union[int, float],
        narration: str,
        transaction_type: TransactionType,
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Adds or removes money from a plain savings account.

        Args:
            amount: The amount to be added or removed. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            narration: The transaction description.
            transaction_type: The transaction type e.g. TransactionType.CREDIT.
            tracking_reference: Unique identifier for savings.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "Amount": amount,
            "Narration": narration,
            "TransactionType": transaction_type,
            "TrackingReference": tracking_reference,
        }
        return self._api_call(
            service_type=ServiceType.PLAIN_SAVE_DEBIT_CREDIT,
            data=data,
            request_reference=request_reference,
        )

    def get_plain_savings_account_transactions(
        self,
        page_size: int,
        page_number: int,
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieves all plain savings account transaction data.

        Args:
            tracking_reference: Unique identifier for account.
            page_size: This specifies the number of transactions to be retrieved.
            page_number: This specifies the index of the paginated results retrieved.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "PageSize": page_size,
            "PageNumber": page_number,
            "TrackingReference": tracking_reference,
        }
        return self._api_call(
            service_type=ServiceType.RETRIEVE_PLAIN_SAVE_TRANSACTIONS,
            data=data,
            request_reference=request_reference,
        )

    def create_open_flexible_savings_account(
        self,
        savings_tracking_reference: str,
        name: str,
        virtual_account_tracking_reference: str,
        amount: Union[int, float],
        duration: str,
        frequency: str,
        start_now: bool,
        start_date: Optional[str],
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Create an open savings plan.

        Args:
            savings_tracking_reference: The unique identifier for savings.
            name: Name of the savings plan.
            virtual_account_tracking_reference: Unique identifier for the associated virtual account.
            amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            duration: Length of savings.
            frequency: How often the savings should happen.
            start_now: Flag to start the savings immediately.
            start_date: Starting date of the savings. Required if `start_now` is `False`.
                Format (YYYY-MM-DD).
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "SavingsTrackingReference": savings_tracking_reference,
            "Name": name,
            "VirtualAccountTrackingReference": virtual_account_tracking_reference,
            "Amount": amount,
            "Duration": duration,
            "Frequency": frequency,
            "StartNow": start_now,
            "StartData": start_date,
        }
        return self._api_call(
            service_type=ServiceType.CREATE_OPEN_FLEXIBLE_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def pre_create_open_flexible_savings_account(
        self,
        savings_tracking_reference: str,
        name: str,
        virtual_account_tracking_reference: str,
        amount: Union[int, float],
        duration: str,
        frequency: str,
        start_now: bool,
        start_date: str,
        is_interest_earning: bool,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Pre create an Open Flexible Savings account.

        Args:
            savings_tracking_reference: The unique identifier for savings.
            name: Name of the savings plan.
            virtual_account_tracking_reference: Unique identifier for the associated virtual account.
            amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            duration: Length of savings.
            frequency: How often the savings should happen.
            start_now: Flag to start the savings immediately.
            start_date: Starting date of the savings. Required if `start_now` is `False`.
                Format (YYYY-MM-DD).
            is_interest_earning: Will the savings earn interest or not.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "SavingsTrackingReference": savings_tracking_reference,
            "Name": name,
            "VirtualAccountTrackingReference": virtual_account_tracking_reference,
            "Amount": amount,
            "Duration": duration,
            "Frequency": frequency,
            "StartNow": start_now,
            "StartData": start_date,
            "IsInterestEarning": is_interest_earning,
        }
        return self._api_call(
            service_type=ServiceType.PRE_CREATE_OPEN_FLEXIBLE_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def get_open_flexible_savings_account(
        self,
        tracking_reference: str,
        primary_account_number: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieve an open flexible savings account.

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
            primary_account_number: Account number of the specific customer.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "TrackingReference": tracking_reference,
            "PrimaryAccountNumber": primary_account_number,
        }
        return self._api_call(
            service_type=ServiceType.GET_OPEN_FLEXIBLE_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def get_open_flexible_savings_accounts(
        self,
        tracking_reference: str,
        primary_account_number: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieves all flexible savings account.

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
            primary_account_number: Account number of the specific customer.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "TrackingReference": tracking_reference,
            "PrimaryAccountNumber": primary_account_number,
        }
        return self._api_call(
            service_type=ServiceType.GET_ALL_CUSTOMER_OPEN_FLEXIBLE_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def withdrawal_from_flexible_savings_account(
        self,
        amount: Union[int, float],
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """

        Args:
            amount: Amount to be removed. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            tracking_reference: Unique identifier for savings.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {"Amount": amount, "TrackingReference": tracking_reference}
        return self._api_call(
            service_type=ServiceType.COMPLETE_OPEN_FLEXIBLE_SAVE_WITHDRAWAL,
            data=data,
            request_reference=request_reference,
        )

    def get_flexible_savings_account_transactions(
        self,
        tracking_reference: str,
        page_size: int,
        page_number: int,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """

        Args:
            tracking_reference: Account tracking reference number.
            page_size: This specifies the number of transactions to be retrieved.
            page_number: This specifies the index of the paginated results retrieved.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "PageSize": page_size,
            "PageNumber": page_number,
            "TrackingReference": tracking_reference,
        }
        return self._api_call(
            service_type=ServiceType.RETRIEVE_OPEN_FLEXIBLE_SAVE_TRANSACTIONS,
            data=data,
            request_reference=request_reference,
        )

    def create_fixed_savings_account(
        self,
        savings_tracking_reference: str,
        name: str,
        virtual_account_tracking_reference: str,
        amount: Union[int, float],
        duration: str,
        frequency: str,
        start_now: bool,
        start_date: str,
        is_interest_earning: bool,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Creates a fixed account.

        Args:
            savings_tracking_reference: The unique identifier for savings.
            name: Name of the savings plan.
            virtual_account_tracking_reference: Unique identifier for the associated virtual account.
            amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            duration: Length of savings.
            frequency: How often the savings should happen.
            start_now: Flag to start the savings immediately.
            start_date: Starting date of the savings. Required if `start_now` is `False`.
                Format (YYYY-MM-DD).
            is_interest_earning: Will the savings earn interest or not.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "SavingsTrackingReference": savings_tracking_reference,
            "Name": name,
            "VirtualAccountTrackingReference": virtual_account_tracking_reference,
            "Amount": amount,
            "Duration": duration,
            "Frequency": frequency,
            "StartNow": start_now,
            "StartData": start_date,
            "IsInterestEarning": is_interest_earning,
        }
        return self._api_call(
            service_type=ServiceType.CREATE_FIXED_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def get_fixed_savings_account(
        self,
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieves a fixed savings account.

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "SavingsId": tracking_reference,
        }
        return self._api_call(
            service_type=ServiceType.GET_FIXED_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def get_fixed_savings_accounts(
        self, tracking_reference: str, request_reference: Optional[str] = None
    ) -> APIResponse:
        """Retrieves all fixed savings you want to retrieve.

        Args:
            tracking_reference: Account transaction reference number of the savings you want to retrieve.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {"TrackingReference": tracking_reference}
        return self._api_call(
            service_type=ServiceType.GET_ALL_CUSTOMER_FIXED_SAVE,
            data=data,
            request_reference=request_reference,
        )

    def close_fixed_savings_account(
        self,
        amount: Union[int, float],
        tracking_reference: str,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """

        Args:
            amount: amount to be removed. Note care should be taken when performing calculations as money is involved.
                a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
                it is advisable that static values are passed for this parameter. see
                https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
            tracking_reference: unique identifier for the savings.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {"Amount": amount, "SavingsId": tracking_reference}
        return self._api_call(
            service_type=ServiceType.COMPLETE_FIXED_SAVE_WITHDRAWAL,
            data=data,
            request_reference=request_reference,
        )

    def get_fixed_savings_account_transactions(
        self,
        tracking_reference: str,
        page_number: int,
        page_size: int,
        request_reference: Optional[str] = None,
    ) -> APIResponse:
        """Retrieves all fixed savings account transaction

        Args:
            tracking_reference: Account tracking reference number.
            page_size: This specifies the number of transactions to be retrieved.
            page_number: This specifies the index of the paginated results retrieved.
            request_reference: a unique identifier for this api call.
                it is automatically generated if not provided.

        Returns:
            An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
                of calling this function.

        Raises:
            ConnectionException: when the request times out or in the absence of an internet connection.
        """
        data = {
            "PageNumber": page_number,
            "PageSize": page_size,
            "SavingsId": tracking_reference,
        }
        return self._api_call(
            service_type=ServiceType.RETRIEVE_FIXED_SAVE_TRANSACTIONS,
            data=data,
            request_reference=request_reference,
        )

close_fixed_savings_account(amount, tracking_reference, request_reference=None)

Parameters:

Name Type Description Default
amount Union[int, float]

amount to be removed. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
tracking_reference str

unique identifier for the savings.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def close_fixed_savings_account(
    self,
    amount: Union[int, float],
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """

    Args:
        amount: amount to be removed. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        tracking_reference: unique identifier for the savings.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {"Amount": amount, "SavingsId": tracking_reference}
    return self._api_call(
        service_type=ServiceType.COMPLETE_FIXED_SAVE_WITHDRAWAL,
        data=data,
        request_reference=request_reference,
    )

create_fixed_savings_account(savings_tracking_reference, name, virtual_account_tracking_reference, amount, duration, frequency, start_now, start_date, is_interest_earning, request_reference=None)

Creates a fixed account.

Parameters:

Name Type Description Default
savings_tracking_reference str

The unique identifier for savings.

required
name str

Name of the savings plan.

required
virtual_account_tracking_reference str

Unique identifier for the associated virtual account.

required
amount Union[int, float]

Amount to be saved. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
duration str

Length of savings.

required
frequency str

How often the savings should happen.

required
start_now bool

Flag to start the savings immediately.

required
start_date str

Starting date of the savings. Required if start_now is False. Format (YYYY-MM-DD).

required
is_interest_earning bool

Will the savings earn interest or not.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def create_fixed_savings_account(
    self,
    savings_tracking_reference: str,
    name: str,
    virtual_account_tracking_reference: str,
    amount: Union[int, float],
    duration: str,
    frequency: str,
    start_now: bool,
    start_date: str,
    is_interest_earning: bool,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Creates a fixed account.

    Args:
        savings_tracking_reference: The unique identifier for savings.
        name: Name of the savings plan.
        virtual_account_tracking_reference: Unique identifier for the associated virtual account.
        amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        duration: Length of savings.
        frequency: How often the savings should happen.
        start_now: Flag to start the savings immediately.
        start_date: Starting date of the savings. Required if `start_now` is `False`.
            Format (YYYY-MM-DD).
        is_interest_earning: Will the savings earn interest or not.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "SavingsTrackingReference": savings_tracking_reference,
        "Name": name,
        "VirtualAccountTrackingReference": virtual_account_tracking_reference,
        "Amount": amount,
        "Duration": duration,
        "Frequency": frequency,
        "StartNow": start_now,
        "StartData": start_date,
        "IsInterestEarning": is_interest_earning,
    }
    return self._api_call(
        service_type=ServiceType.CREATE_FIXED_SAVE,
        data=data,
        request_reference=request_reference,
    )

create_open_flexible_savings_account(savings_tracking_reference, name, virtual_account_tracking_reference, amount, duration, frequency, start_now, start_date, request_reference=None)

Create an open savings plan.

Parameters:

Name Type Description Default
savings_tracking_reference str

The unique identifier for savings.

required
name str

Name of the savings plan.

required
virtual_account_tracking_reference str

Unique identifier for the associated virtual account.

required
amount Union[int, float]

Amount to be saved. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
duration str

Length of savings.

required
frequency str

How often the savings should happen.

required
start_now bool

Flag to start the savings immediately.

required
start_date Optional[str]

Starting date of the savings. Required if start_now is False. Format (YYYY-MM-DD).

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def create_open_flexible_savings_account(
    self,
    savings_tracking_reference: str,
    name: str,
    virtual_account_tracking_reference: str,
    amount: Union[int, float],
    duration: str,
    frequency: str,
    start_now: bool,
    start_date: Optional[str],
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Create an open savings plan.

    Args:
        savings_tracking_reference: The unique identifier for savings.
        name: Name of the savings plan.
        virtual_account_tracking_reference: Unique identifier for the associated virtual account.
        amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        duration: Length of savings.
        frequency: How often the savings should happen.
        start_now: Flag to start the savings immediately.
        start_date: Starting date of the savings. Required if `start_now` is `False`.
            Format (YYYY-MM-DD).
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "SavingsTrackingReference": savings_tracking_reference,
        "Name": name,
        "VirtualAccountTrackingReference": virtual_account_tracking_reference,
        "Amount": amount,
        "Duration": duration,
        "Frequency": frequency,
        "StartNow": start_now,
        "StartData": start_date,
    }
    return self._api_call(
        service_type=ServiceType.CREATE_OPEN_FLEXIBLE_SAVE,
        data=data,
        request_reference=request_reference,
    )

create_plain_savings_account(name, tracking_reference, request_reference=None)

Create a Plain Savings Account.

To create a Plain savings, in your request, you need to state the Virtual Account associated with this savings account as well as create a unique identifier for the savings account to be created.

Parameters:

Name Type Description Default
name str

The savings plan name.

required
tracking_reference str

The virtual account transaction reference number.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def create_plain_savings_account(
    self,
    name: str,
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Create a Plain Savings Account.

    To create a Plain savings, in your request, you need to state the Virtual Account
    associated with this savings account as well as create a unique identifier for
    the savings account to be created.

    Args:
        name: The savings plan name.
        tracking_reference: The virtual account transaction reference number.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {"Name": name, "TrackingReference": tracking_reference}
    return self._api_call(
        service_type=ServiceType.CREATE_PLAIN_SAVE,
        data=data,
        request_reference=request_reference,
    )

credit_or_debit_plain_savings_account(amount, narration, transaction_type, tracking_reference, request_reference=None)

Adds or removes money from a plain savings account.

Parameters:

Name Type Description Default
amount Union[int, float]

The amount to be added or removed. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
narration str

The transaction description.

required
transaction_type TransactionType

The transaction type e.g. TransactionType.CREDIT.

required
tracking_reference str

Unique identifier for savings.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def credit_or_debit_plain_savings_account(
    self,
    amount: Union[int, float],
    narration: str,
    transaction_type: TransactionType,
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Adds or removes money from a plain savings account.

    Args:
        amount: The amount to be added or removed. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        narration: The transaction description.
        transaction_type: The transaction type e.g. TransactionType.CREDIT.
        tracking_reference: Unique identifier for savings.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "Amount": amount,
        "Narration": narration,
        "TransactionType": transaction_type,
        "TrackingReference": tracking_reference,
    }
    return self._api_call(
        service_type=ServiceType.PLAIN_SAVE_DEBIT_CREDIT,
        data=data,
        request_reference=request_reference,
    )

get_fixed_savings_account(tracking_reference, request_reference=None)

Retrieves a fixed savings account.

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_fixed_savings_account(
    self,
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieves a fixed savings account.

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "SavingsId": tracking_reference,
    }
    return self._api_call(
        service_type=ServiceType.GET_FIXED_SAVE,
        data=data,
        request_reference=request_reference,
    )

get_fixed_savings_account_transactions(tracking_reference, page_number, page_size, request_reference=None)

Retrieves all fixed savings account transaction

Parameters:

Name Type Description Default
tracking_reference str

Account tracking reference number.

required
page_size int

This specifies the number of transactions to be retrieved.

required
page_number int

This specifies the index of the paginated results retrieved.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_fixed_savings_account_transactions(
    self,
    tracking_reference: str,
    page_number: int,
    page_size: int,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieves all fixed savings account transaction

    Args:
        tracking_reference: Account tracking reference number.
        page_size: This specifies the number of transactions to be retrieved.
        page_number: This specifies the index of the paginated results retrieved.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "PageNumber": page_number,
        "PageSize": page_size,
        "SavingsId": tracking_reference,
    }
    return self._api_call(
        service_type=ServiceType.RETRIEVE_FIXED_SAVE_TRANSACTIONS,
        data=data,
        request_reference=request_reference,
    )

get_fixed_savings_accounts(tracking_reference, request_reference=None)

Retrieves all fixed savings you want to retrieve.

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_fixed_savings_accounts(
    self, tracking_reference: str, request_reference: Optional[str] = None
) -> APIResponse:
    """Retrieves all fixed savings you want to retrieve.

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {"TrackingReference": tracking_reference}
    return self._api_call(
        service_type=ServiceType.GET_ALL_CUSTOMER_FIXED_SAVE,
        data=data,
        request_reference=request_reference,
    )

get_flexible_savings_account_transactions(tracking_reference, page_size, page_number, request_reference=None)

Parameters:

Name Type Description Default
tracking_reference str

Account tracking reference number.

required
page_size int

This specifies the number of transactions to be retrieved.

required
page_number int

This specifies the index of the paginated results retrieved.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_flexible_savings_account_transactions(
    self,
    tracking_reference: str,
    page_size: int,
    page_number: int,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """

    Args:
        tracking_reference: Account tracking reference number.
        page_size: This specifies the number of transactions to be retrieved.
        page_number: This specifies the index of the paginated results retrieved.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "PageSize": page_size,
        "PageNumber": page_number,
        "TrackingReference": tracking_reference,
    }
    return self._api_call(
        service_type=ServiceType.RETRIEVE_OPEN_FLEXIBLE_SAVE_TRANSACTIONS,
        data=data,
        request_reference=request_reference,
    )

get_open_flexible_savings_account(tracking_reference, primary_account_number, request_reference=None)

Retrieve an open flexible savings account.

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve.

required
primary_account_number str

Account number of the specific customer.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_open_flexible_savings_account(
    self,
    tracking_reference: str,
    primary_account_number: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieve an open flexible savings account.

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
        primary_account_number: Account number of the specific customer.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "TrackingReference": tracking_reference,
        "PrimaryAccountNumber": primary_account_number,
    }
    return self._api_call(
        service_type=ServiceType.GET_OPEN_FLEXIBLE_SAVE,
        data=data,
        request_reference=request_reference,
    )

get_open_flexible_savings_accounts(tracking_reference, primary_account_number, request_reference=None)

Retrieves all flexible savings account.

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve.

required
primary_account_number str

Account number of the specific customer.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_open_flexible_savings_accounts(
    self,
    tracking_reference: str,
    primary_account_number: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieves all flexible savings account.

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
        primary_account_number: Account number of the specific customer.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "TrackingReference": tracking_reference,
        "PrimaryAccountNumber": primary_account_number,
    }
    return self._api_call(
        service_type=ServiceType.GET_ALL_CUSTOMER_OPEN_FLEXIBLE_SAVE,
        data=data,
        request_reference=request_reference,
    )

get_plain_savings_account(tracking_reference, primary_account_number, request_reference=None)

Retrieves a customers plain savings account

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve. This parameter is for specific plain savings.

required
primary_account_number str

Account number of the specific customer.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_plain_savings_account(
    self,
    tracking_reference: str,
    primary_account_number: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieves a customers plain savings account

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
            This parameter is for specific plain savings.
        primary_account_number: Account number of the specific customer.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "TrackingReference": tracking_reference,
        "PrimaryAccountNumber": primary_account_number,
    }
    return self._api_call(service_type=ServiceType.GET_PLAIN_SAVE, data=data)

get_plain_savings_account_transactions(page_size, page_number, tracking_reference, request_reference=None)

Retrieves all plain savings account transaction data.

Parameters:

Name Type Description Default
tracking_reference str

Unique identifier for account.

required
page_size int

This specifies the number of transactions to be retrieved.

required
page_number int

This specifies the index of the paginated results retrieved.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_plain_savings_account_transactions(
    self,
    page_size: int,
    page_number: int,
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Retrieves all plain savings account transaction data.

    Args:
        tracking_reference: Unique identifier for account.
        page_size: This specifies the number of transactions to be retrieved.
        page_number: This specifies the index of the paginated results retrieved.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "PageSize": page_size,
        "PageNumber": page_number,
        "TrackingReference": tracking_reference,
    }
    return self._api_call(
        service_type=ServiceType.RETRIEVE_PLAIN_SAVE_TRANSACTIONS,
        data=data,
        request_reference=request_reference,
    )

get_plain_savings_accounts(tracking_reference, request_reference=None)

Retrieves all customers plain savings accounts

Parameters:

Name Type Description Default
tracking_reference str

Account transaction reference number of the savings you want to retrieve. This parameter is for specific plain savings.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def get_plain_savings_accounts(
    self, tracking_reference: str, request_reference: Optional[str] = None
) -> APIResponse:
    """Retrieves all customers plain savings accounts

    Args:
        tracking_reference: Account transaction reference number of the savings you want to retrieve.
            This parameter is for specific plain savings.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {"TrackingReference": tracking_reference}
    return self._api_call(
        service_type=ServiceType.GET_ALL_CUSTOMER_PLAIN_SAVE,
        data=data,
        request_reference=request_reference,
    )

pre_create_open_flexible_savings_account(savings_tracking_reference, name, virtual_account_tracking_reference, amount, duration, frequency, start_now, start_date, is_interest_earning, request_reference=None)

Pre create an Open Flexible Savings account.

Parameters:

Name Type Description Default
savings_tracking_reference str

The unique identifier for savings.

required
name str

Name of the savings plan.

required
virtual_account_tracking_reference str

Unique identifier for the associated virtual account.

required
amount Union[int, float]

Amount to be saved. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
duration str

Length of savings.

required
frequency str

How often the savings should happen.

required
start_now bool

Flag to start the savings immediately.

required
start_date str

Starting date of the savings. Required if start_now is False. Format (YYYY-MM-DD).

required
is_interest_earning bool

Will the savings earn interest or not.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def pre_create_open_flexible_savings_account(
    self,
    savings_tracking_reference: str,
    name: str,
    virtual_account_tracking_reference: str,
    amount: Union[int, float],
    duration: str,
    frequency: str,
    start_now: bool,
    start_date: str,
    is_interest_earning: bool,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """Pre create an Open Flexible Savings account.

    Args:
        savings_tracking_reference: The unique identifier for savings.
        name: Name of the savings plan.
        virtual_account_tracking_reference: Unique identifier for the associated virtual account.
        amount: Amount to be saved. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        duration: Length of savings.
        frequency: How often the savings should happen.
        start_now: Flag to start the savings immediately.
        start_date: Starting date of the savings. Required if `start_now` is `False`.
            Format (YYYY-MM-DD).
        is_interest_earning: Will the savings earn interest or not.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {
        "SavingsTrackingReference": savings_tracking_reference,
        "Name": name,
        "VirtualAccountTrackingReference": virtual_account_tracking_reference,
        "Amount": amount,
        "Duration": duration,
        "Frequency": frequency,
        "StartNow": start_now,
        "StartData": start_date,
        "IsInterestEarning": is_interest_earning,
    }
    return self._api_call(
        service_type=ServiceType.PRE_CREATE_OPEN_FLEXIBLE_SAVE,
        data=data,
        request_reference=request_reference,
    )

withdrawal_from_flexible_savings_account(amount, tracking_reference, request_reference=None)

Parameters:

Name Type Description Default
amount Union[int, float]

Amount to be removed. Note care should be taken when performing calculations as money is involved. a Decimal would have been the preferred type compared to Union[int, float] that was used. it is advisable that static values are passed for this parameter. see https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

required
tracking_reference str

Unique identifier for savings.

required
request_reference Optional[str]

a unique identifier for this api call. it is automatically generated if not provided.

None

Returns:

Type Description
APIResponse

An APIResponse which is basically just a dataclass containing the data returned by the server as result of calling this function.

Raises:

Type Description
ConnectionException

when the request times out or in the absence of an internet connection.

Source code in pykuda2/wrappers/sync_wrappers/savings.py
def withdrawal_from_flexible_savings_account(
    self,
    amount: Union[int, float],
    tracking_reference: str,
    request_reference: Optional[str] = None,
) -> APIResponse:
    """

    Args:
        amount: Amount to be removed. Note care should be taken when performing calculations as money is involved.
            a `Decimal` would have been the preferred type compared to `Union[int, float]` that was used.
            it is advisable that static values are passed for this parameter. see
            https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
        tracking_reference: Unique identifier for savings.
        request_reference: a unique identifier for this api call.
            it is automatically generated if not provided.

    Returns:
        An `APIResponse` which is basically just a dataclass containing the data returned by the server as result
            of calling this function.

    Raises:
        ConnectionException: when the request times out or in the absence of an internet connection.
    """
    data = {"Amount": amount, "TrackingReference": tracking_reference}
    return self._api_call(
        service_type=ServiceType.COMPLETE_OPEN_FLEXIBLE_SAVE_WITHDRAWAL,
        data=data,
        request_reference=request_reference,
    )