"""BriteCore v2 Payments API endpoint wrappers.
Provides helpers for payment method management, batch entry workflows,
policy and invoice payments, sweep processing, and billing lookups.
"""
from logging import Logger
from typing import Any, Unpack, cast
from urllib3 import BaseHTTPResponse, HTTPResponse
from britecore_sdk import logger
from britecore_sdk.api.api_calls import (
BritecoreAPIClient,
RequestParameters,
api_client,
)
LOGGER: Logger = logger
API_CLIENT: BritecoreAPIClient = api_client
def build_payload(**fields: Any) -> dict[str, Any]:
"""Build a JSON payload while preserving explicit ``False`` and empty lists."""
return {key: value for key, value in fields.items() if value is not None}
def post(
path: str,
payload: dict[str, Any] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Send a payment request and normalize the response."""
LOGGER.debug("Calling payments endpoint %s", path)
request_result: BaseHTTPResponse | HTTPResponse | None = API_CLIENT.do_request(
path=path,
json=payload or {},
**kwargs,
)
return API_CLIENT.process_result(cast(Any, request_result))
[docs]
def add_payment_method(
card_expires_mm: str | None = None,
ach_bank: str | None = None,
customer_profile_id: str | None = None,
card_cvv2: str | None = None,
card_name_on: str | None = None,
account_description: str | None = None,
contact_id: str | None = None,
ach_account: str | None = None,
card_type: str | None = None,
card_expires_yy: str | None = None,
ach_type: str | None = None,
ach_routing: str | None = None,
ach_name_on: str | None = None,
metadata: dict[str, Any] | None = None,
payment_method_type: str | None = None,
card_number: str | None = None,
address: dict[str, Any] | None = None,
vendor_payment_method_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Add a payment method for a contact..
POST /api/v2/payments/add_payment_method
"""
return post(
"/api/v2/payments/add_payment_method",
build_payload(
card_expires_mm=card_expires_mm,
ach_bank=ach_bank,
customer_profile_id=customer_profile_id,
card_cvv2=card_cvv2,
card_name_on=card_name_on,
account_description=account_description,
contact_id=contact_id,
ach_account=ach_account,
card_type=card_type,
card_expires_yy=card_expires_yy,
ach_type=ach_type,
ach_routing=ach_routing,
ach_name_on=ach_name_on,
metadata=metadata,
type=payment_method_type,
card_number=card_number,
address=address,
vendor_payment_method_id=vendor_payment_method_id,
),
**kwargs,
)
[docs]
def apply_selected_payments(
payment_ids: list[str] | None = None,
print_deposit_receipt: bool | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Apply selected payments and optionally generate a deposit receipt.
Use ``payment_ids`` to identify queued payments and ``print_deposit_receipt``
to request receipt generation after successful application. Returns the
normalized ``process_result(...)`` payload, and ``**kwargs`` accepts
``RequestParameters`` overrides.
"""
return post(
"/api/v2/payments/apply_selected_payments",
build_payload(
print_deposit_receipt=print_deposit_receipt,
payment_ids=payment_ids,
),
**kwargs,
)
[docs]
def change_payment_method(
auto_payment_method_id: str | None = None,
auto_pay_days_before: int | None = None,
contact_id: str | None = None,
policy_list: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Set a payment method across multiple policies..
POST /api/v2/payments/change_payment_method
"""
return post(
"/api/v2/payments/change_payment_method",
build_payload(
auto_payment_method_id=auto_payment_method_id,
auto_pay_days_before=auto_pay_days_before,
contact_id=contact_id,
policy_list=policy_list,
),
**kwargs,
)
[docs]
def change_payment_method_single(
auto_pay_days_before: int | None = None,
contact_id: str | None = None,
policy_term_id: str | None = None,
auto_payment_method_id: str | None = None,
override_propagation: bool | None = None,
policy_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Set a payment method for one policy or one policy term..
POST /api/v2/payments/change_payment_method_single
"""
return post(
"/api/v2/payments/change_payment_method_single",
build_payload(
auto_pay_days_before=auto_pay_days_before,
contact_id=contact_id,
policy_term_id=policy_term_id,
auto_payment_method_id=auto_payment_method_id,
override_propagation=override_propagation,
policy_id=policy_id,
),
**kwargs,
)
[docs]
def create_payment_batch(
data: dict[str, Any] | list[dict[str, Any]] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Create a payment batch record in the database..
POST /api/v2/payments/create_payment_batch
"""
return post(
"/api/v2/payments/create_payment_batch",
build_payload(data=data),
**kwargs,
)
[docs]
def create_payment_entries(
entries: list[dict[str, Any]] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Create payment entries from a serialized dataset..
POST /api/v2/payments/create_payment_entries
"""
return post(
"/api/v2/payments/create_payment_entries",
build_payload(entries=entries),
**kwargs,
)
[docs]
def delete_payment_batch(
batch_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Remove a payment batch from the database.
Provide ``batch_id`` for the batch that should be deleted. Returns the
normalized ``process_result(...)`` payload, and ``**kwargs`` may include
``RequestParameters`` overrides.
"""
return post(
"/api/v2/payments/delete_payment_batch",
build_payload(batch_id=batch_id),
**kwargs,
)
[docs]
def delete_payment_entries(
entry_ids: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Delete payment entries by entry identifier..
POST /api/v2/payments/delete_payment_entries
"""
return post(
"/api/v2/payments/delete_payment_entries",
build_payload(entry_ids=entry_ids),
**kwargs,
)
[docs]
def get_payment_method_info(
payment_method_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve information about a stored payment method..
POST /api/v2/payments/get_payment_method_info
"""
return post(
"/api/v2/payments/get_payment_method_info",
build_payload(payment_method_id=payment_method_id),
**kwargs,
)
[docs]
def get_unpaid_invoices_by_date(
due_date: str | None = None,
bill_date: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve unpaid invoices for a bill date and/or due date..
POST /api/v2/payments/get_unpaid_invoices_by_date
"""
return post(
"/api/v2/payments/get_unpaid_invoices_by_date",
build_payload(due_date=due_date, bill_date=bill_date),
**kwargs,
)
[docs]
def import_payment_entries(
entry_ids: list[str] | None = None,
bypass_duplicates_check: bool | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Import staged payment entries into the accounting workflow..
POST /api/v2/payments/import_payment_entries
"""
return post(
"/api/v2/payments/import_payment_entries",
build_payload(
entry_ids=entry_ids,
bypass_duplicates_check=bypass_duplicates_check,
),
**kwargs,
)
[docs]
def make_payment_by_invoice_or_policy(
payment_date: str | None = None,
policy_number: str | None = None,
amount: float | int | None = None,
meta: dict[str, Any] | None = None,
payment_transaction_id: str | None = None,
source_id: str | None = None,
invoice_number: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Make a payment identified by invoice number or policy number..
POST /api/v2/payments/make_payment_by_invoice_or_policy
"""
return post(
"/api/v2/payments/make_payment_by_invoice_or_policy",
build_payload(
payment_date=payment_date,
policy_number=policy_number,
amount=amount,
meta=meta,
payment_transaction_id=payment_transaction_id,
source_id=source_id,
invoice_number=invoice_number,
),
**kwargs,
)
[docs]
def mark_payment_nsf(
payment_date: str | None = None,
confirmation_number: str | None = None,
policy_number: str | None = None,
amount: float | int | None = None,
disable_auto_pay: bool | None = None,
invoice_number: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Mark a payment as NSF..
POST /api/v2/payments/mark_payment_nsf
"""
return post(
"/api/v2/payments/mark_payment_nsf",
build_payload(
payment_date=payment_date,
confirmation_number=confirmation_number,
policy_number=policy_number,
amount=amount,
disable_auto_pay=disable_auto_pay,
invoice_number=invoice_number,
),
**kwargs,
)
[docs]
def remove_payment_method(
payment_method_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Soft-delete a stored payment method..
POST /api/v2/payments/remove_payment_method
"""
return post(
"/api/v2/payments/remove_payment_method",
build_payload(payment_method_id=payment_method_id),
**kwargs,
)
[docs]
def retrieve_account_payoff_amount(
policy_number: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve the payoff amount for an account or policy..
POST /api/v2/payments/retrieve_account_payoff_amount
"""
return post(
"/api/v2/payments/retrieve_account_payoff_amount",
build_payload(policy_number=policy_number),
**kwargs,
)
[docs]
def retrieve_convenience_fee(
payment_amount: float | int | None = None,
account_type: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve the processor convenience fee for a payment..
POST /api/v2/payments/retrieve_convenience_fee
"""
return post(
"/api/v2/payments/retrieve_convenience_fee",
build_payload(payment_amount=payment_amount, account_type=account_type),
**kwargs,
)
[docs]
def retrieve_payment(
payment_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve a specific payment record.
Provide ``payment_id`` for the payment that should be fetched. Returns the
normalized ``process_result(...)`` payload, and ``**kwargs`` may include
``RequestParameters`` overrides.
"""
return post(
"/api/v2/payments/retrieve_payment",
build_payload(payment_id=payment_id),
**kwargs,
)
[docs]
def retrieve_payment_batch_entries(
batch_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve the entries related to a payment batch..
POST /api/v2/payments/retrieve_payment_batch_entries
"""
return post(
"/api/v2/payments/retrieve_payment_batch_entries",
build_payload(batch_id=batch_id),
**kwargs,
)
[docs]
def retrieve_payment_batches(
load_entries: bool | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve payment batch records..
POST /api/v2/payments/retrieve_payment_batches
"""
return post(
"/api/v2/payments/retrieve_payment_batches",
build_payload(load_entries=load_entries),
**kwargs,
)
[docs]
def retrieve_payment_entries(
entry_ids: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve payment entries by entry identifier.
Provide ``entry_ids`` for the entry records that should be returned. Returns
the normalized ``process_result(...)`` payload, and ``**kwargs`` accepts
``RequestParameters`` overrides.
"""
return post(
"/api/v2/payments/retrieve_payment_entries",
build_payload(entry_ids=entry_ids),
**kwargs,
)
[docs]
def retrieve_payment_methods(
contact_ids: list[str] | None = None,
exp_less_than: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve payment methods for one or more contacts..
POST /api/v2/payments/retrieve_payment_methods
"""
return post(
"/api/v2/payments/retrieve_payment_methods",
build_payload(contact_ids=contact_ids, exp_less_than=exp_less_than),
**kwargs,
)
[docs]
def retrieve_sweep_payment_list(
procdate: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve pending sweep payments..
POST /api/v2/payments/retrieve_sweep_payment_list
"""
return post(
"/api/v2/payments/retrieve_sweep_payment_list",
build_payload(procdate=procdate),
**kwargs,
)
[docs]
def retrieve_updated_invoice_balance(
invoice_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve the current balance for an invoice..
POST /api/v2/payments/retrieve_updated_invoice_balance
"""
return post(
"/api/v2/payments/retrieve_updated_invoice_balance",
build_payload(invoice_id=invoice_id),
**kwargs,
)
[docs]
def update_payment_batch(
batch_id: str | None = None,
data: dict[str, Any] | list[dict[str, Any]] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Update a payment batch record..
POST /api/v2/payments/update_payment_batch
"""
return post(
"/api/v2/payments/update_payment_batch",
build_payload(batch_id=batch_id, data=data),
**kwargs,
)
[docs]
def update_payment_entries(
entries: list[dict[str, Any]] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Update payment entries from a serialized dataset..
POST /api/v2/payments/update_payment_entries
"""
return post(
"/api/v2/payments/update_payment_entries",
build_payload(entries=entries),
**kwargs,
)
[docs]
def update_sweep_payments_complete(
procdate: str | None = None,
payment_ids: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Mark sweep payments as completed..
POST /api/v2/payments/update_sweep_payments_complete
"""
return post(
"/api/v2/payments/update_sweep_payments_complete",
build_payload(procdate=procdate, payment_ids=payment_ids),
**kwargs,
)
__all__ = [
"add_payment_method",
"apply_selected_payments",
"change_payment_method",
"change_payment_method_single",
"create_payment_batch",
"create_payment_entries",
"delete_payment_batch",
"delete_payment_entries",
"get_payment_method_info",
"get_unpaid_invoices_by_date",
"import_payment_entries",
"make_payment_by_contact_and_payment_method",
"make_payment_by_invoice_or_policy",
"mark_payment_nsf",
"remove_payment_method",
"retrieve_account_payoff_amount",
"retrieve_convenience_fee",
"retrieve_payment",
"retrieve_payment_batch_entries",
"retrieve_payment_batches",
"retrieve_payment_entries",
"retrieve_payment_methods",
"retrieve_policy_billing_information",
"retrieve_sweep_payment_list",
"retrieve_updated_invoice_balance",
"update_payment_batch",
"update_payment_entries",
"update_sweep_payments_complete",
]
# --- Autogenerated spec wrappers ---
[docs]
def approve_pending_payment(
payment_id: str | Any | None = None,
settlement_date_time: str | Any | None = None,
integration_instance_external_id: str | None = None,
reference_id: str | Any | None = None,
set_reference_id: str | Any | None = None,
vendor_processing_fee_in_cents: int | Any | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Approve Pending Payment.
POST /api/v2/payments/approve_pending_payment
"""
request_json: dict[str, Any] = {
"payment_id": payment_id,
"settlement_date_time": settlement_date_time,
"integration_instance_external_id": integration_instance_external_id,
"reference_id": reference_id,
"set_reference_id": set_reference_id,
"vendor_processing_fee_in_cents": vendor_processing_fee_in_cents,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/approve_pending_payment",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/approve_pending_payment"
)
[docs]
def create_recurring_payment_consent(
contact_id: Any | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Create Recurring Payment Consent.
POST /api/v2/payments/create_recurring_payment_consent
"""
request_json: dict[str, Any] = {"contact_id": contact_id}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/create_recurring_payment_consent",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/create_recurring_payment_consent"
)
[docs]
def decline_pending_payment(
payment_id: str | Any | None = None,
vendor_message: str | None = None,
integration_instance_external_id: str | None = None,
reference_id: str | Any | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Decline Pending Payment.
POST /api/v2/payments/decline_pending_payment
"""
request_json: dict[str, Any] = {
"payment_id": payment_id,
"vendor_message": vendor_message,
"integration_instance_external_id": integration_instance_external_id,
"reference_id": reference_id,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/decline_pending_payment",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/decline_pending_payment"
)
[docs]
def import_payment_method(
policy_term_external_system_reference: str | None = None,
vendor_payment_method_id: str | None = None,
payment_method_type: str | None = None,
contact_external_system_reference: str | None = None,
contact_id: str | None = None,
policy_term_id: str | None = None,
vendor_customer_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Import Payment Method.
POST /api/v2/payments/import_payment_method
"""
request_json: dict[str, Any] = {
"policy_term_external_system_reference": policy_term_external_system_reference,
"vendor_payment_method_id": vendor_payment_method_id,
"payment_method_type": payment_method_type,
"contact_external_system_reference": contact_external_system_reference,
"contact_id": contact_id,
"policy_term_id": policy_term_id,
"vendor_customer_id": vendor_customer_id,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/import_payment_method",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/import_payment_method"
)
[docs]
def retrieve_active_payment_processor(
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve Active Payment Processor.
POST /api/v2/payments/retrieve_active_payment_processor
"""
request_json: dict[str, Any] = {}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/retrieve_active_payment_processor",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/retrieve_active_payment_processor"
)
[docs]
def retrieve_payment_method_consent(
payment_method_id: Any | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve Payment Method Consent.
POST /api/v2/payments/retrieve_payment_method_consent
"""
request_json: dict[str, Any] = {"payment_method_id": payment_method_id}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/retrieve_payment_method_consent",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/retrieve_payment_method_consent"
)
[docs]
def retrieve_payment_method_creation_details(
contact_id: str | None = None,
requester_contact_id: str | None = None,
cancel_url: str | None = None,
success_url: str | None = None,
policy_ids: list[str] | None = None,
types: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve Payment Method Creation Details.
POST /api/v2/payments/retrieve_payment_method_creation_details
"""
request_json: dict[str, Any] = {
"contact_id": contact_id,
"requester_contact_id": requester_contact_id,
"cancel_url": cancel_url,
"success_url": success_url,
"policy_ids": policy_ids,
"types": types,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/retrieve_payment_method_creation_details",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result,
endpoint="/api/v2/payments/retrieve_payment_method_creation_details",
)
[docs]
def retrieve_pending_payments_for_settlement(
integration_instance_external_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Retrieve Pending Payments For Settlement.
POST /api/v2/payments/retrieve_pending_payments_for_settlement
"""
request_json: dict[str, Any] = {
"integration_instance_external_id": integration_instance_external_id,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/retrieve_pending_payments_for_settlement",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result,
endpoint="/api/v2/payments/retrieve_pending_payments_for_settlement",
)
[docs]
def settle_payments(
payments: list[str] | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Settle Payments.
POST /api/v2/payments/settle_payments
"""
request_json: dict[str, Any] = {
"payments": payments,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/settle_payments",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/settle_payments"
)
[docs]
def store_external_payment(
transaction_date_time: str | None = None,
external_account_name: str | None = None,
transaction_amount_in_cents: int | None = None,
policy_number: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Store External Payment.
POST /api/v2/payments/store_external_payment
"""
request_json: dict[str, Any] = {
"transaction_date_time": transaction_date_time,
"external_account_name": external_account_name,
"transaction_amount_in_cents": transaction_amount_in_cents,
"policy_number": policy_number,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/store_external_payment",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/store_external_payment"
)
[docs]
def store_payment(
policy_numbers: list[str] | None = None,
transaction_amount_in_cents: int | None = None,
vendor_response: dict[str, Any] | None = None,
masked_number: str | None = None,
integration_instance_external_id: str | None = None,
convenience_fee_in_cents: int | None = None,
transaction_date_time: str | None = None,
reference_id: str | None = None,
vendor_message: str | None = None,
pay_by: str | None = None,
account_name: str | None = None,
vendor_processing_fee_in_cents: int | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Store Payment.
POST /api/v2/payments/store_payment
"""
request_json: dict[str, Any] = {
"policy_numbers": policy_numbers,
"transaction_amount_in_cents": transaction_amount_in_cents,
"vendor_response": vendor_response,
"masked_number": masked_number,
"integration_instance_external_id": integration_instance_external_id,
"convenience_fee_in_cents": convenience_fee_in_cents,
"transaction_date_time": transaction_date_time,
"reference_id": reference_id,
"vendor_message": vendor_message,
"pay_by": pay_by,
"account_name": account_name,
"vendor_processing_fee_in_cents": vendor_processing_fee_in_cents,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/store_payment",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/store_payment"
)
[docs]
def store_payment_nsf(
payment_id: str | None = None,
policy_term_external_system_reference: str | None = None,
postpone_until_date: str | None = None,
allow_cancel: bool | None = None,
assess_fee: str | None = None,
policy_term_id: str | None = None,
policy_id: str | None = None,
**kwargs: Unpack[RequestParameters],
) -> Any:
"""Store Payment Nsf.
POST /api/v2/payments/store_payment_nsf
"""
request_json: dict[str, Any] = {
"payment_id": payment_id,
"policy_term_external_system_reference": policy_term_external_system_reference,
"postpone_until_date": postpone_until_date,
"allow_cancel": allow_cancel,
"assess_fee": assess_fee,
"policy_term_id": policy_term_id,
"policy_id": policy_id,
}
filtered_json = {k: v for k, v in request_json.items() if v is not None}
request_result = API_CLIENT.do_request(
path="/api/v2/payments/store_payment_nsf",
json=filtered_json,
method="POST",
**kwargs,
)
return API_CLIENT.process_result(
request_result, endpoint="/api/v2/payments/store_payment_nsf"
)
__all__.extend(
[
"approve_pending_payment",
"create_recurring_payment_consent",
"decline_pending_payment",
"import_payment_method",
"retrieve_active_payment_processor",
"retrieve_payment_method_consent",
"retrieve_payment_method_creation_details",
"retrieve_pending_payments_for_settlement",
"settle_payments",
"store_external_payment",
"store_payment",
"store_payment_nsf",
]
)