BOB Docs
APIApplicationPayment

BillingService

Key Features

  • Billing Data Validation: Ensures that customers have valid billing data before processing payments.
  • Dynamic Currency Selection: Determines the appropriate transaction currency based on customer billing data.
  • Billing Information Management: Creates, retrieves, and updates customer billing details.
  • Tax Data Handling: Manages tax-related fields, including VAT numbers and exemption statuses.

Methods

  1. Validation:

    • billing_data_valid: Verifies if a customer has valid billing information.
  2. Currency Management:

    • get_checkout_currency: Determines the transaction currency based on the customer's billing address.
  3. Billing Information Retrieval:

    • get_customer_billing_info: Fetches billing details for a specified customer. Raises an exception if no data is available.
  4. Billing Information Processing:

    • process_billing_information: Creates or updates a customer's billing profile, ensuring accuracy and completeness.
    • process_tax_data: Updates tax-related fields, such as VAT numbers and tax exemption statuses, in the customer's billing profile.

Example Workflow

  1. Validate Billing Data:

    is_valid = await billing_service.billing_data_valid(customer_id=123)
  2. Retrieve Checkout Currency:

currency = await billing_service.get_checkout_currency(customer_id=123)
  1. Update Billing Information:
billing_info = await billing_service.process_billing_information(
    customer_id=123,
    name="John Doe",
    customer_email="john.doe@example.com",
    postal_code="12345",
    city="Warsaw",
    country_code="PL",
    street="Main Street 1",
    tax_exempt="NONE"
)

Dependencies

  • Repository:
  • BillingRepository: Manages database operations for the BillingInformation model.

Purpose

This service ensures accurate and complete customer billing data, a critical component for:

  • Payment processing
  • Tax compliance
  • Enhancing user experience through seamless billing and currency management

By centralizing billing operations, the BillingService streamlines data handling and supports integration with payment and tax systems.

On this page