예제 #1
0
def factory_invoice(payment_account: PaymentAccount,
                    status_code: str = InvoiceStatus.CREATED.value,
                    corp_type_code='CP',
                    business_identifier: str = 'CP0001234',
                    service_fees: float = 0.0,
                    total=0,
                    payment_method_code: str = PaymentMethod.DIRECT_PAY.value,
                    created_on: datetime = datetime.now(),
                    cfs_account_id: int = 0,
                    routing_slip=None):
    """Return Factory."""
    status_code = InvoiceStatus.APPROVED.value if payment_method_code == PaymentMethod.PAD.value else status_code
    invoice = Invoice(invoice_status_code=status_code,
                      payment_account_id=payment_account.id,
                      total=total,
                      created_by='test',
                      created_on=created_on,
                      business_identifier=business_identifier,
                      corp_type_code=corp_type_code,
                      folio_number='1234567890',
                      service_fees=service_fees,
                      bcol_account=payment_account.bcol_account,
                      payment_method_code=payment_method_code
                      or payment_account.payment_method,
                      routing_slip=routing_slip)
    if cfs_account_id != 0:
        invoice.cfs_account_id = cfs_account_id

    invoice.save()
    return invoice
예제 #2
0
def factory_invoice(payment: Payment,
                    payment_account: str,
                    status_code: str = Status.DRAFT.value,
                    corp_type_code='CP',
                    business_identifier: str = 'CP0001234'):
    """Factory."""
    bcol_account_id = None
    credit_account_id = None
    internal_account_id = None
    if isinstance(payment_account, BcolPaymentAccount):
        bcol_account_id = payment_account.id
    elif isinstance(payment_account, InternalPaymentAccount):
        internal_account_id = payment_account.id
    if isinstance(payment_account, CreditPaymentAccount):
        credit_account_id = payment_account.id

    return Invoice(payment_id=payment.id,
                   invoice_status_code=status_code,
                   bcol_account_id=bcol_account_id,
                   credit_account_id=credit_account_id,
                   internal_account_id=internal_account_id,
                   total=0,
                   created_by='test',
                   created_on=datetime.now(),
                   business_identifier=business_identifier,
                   corp_type_code=corp_type_code)
예제 #3
0
def factory_invoice(payment: Payment,
                    payment_account: str,
                    status_code: str = InvoiceStatus.CREATED.value,
                    corp_type_code='CP',
                    business_identifier: str = 'CP0001234',
                    service_fees: float = 0.0):
    """Return Factory."""
    bcol_account_id = None
    credit_account_id = None
    internal_account_id = None
    if isinstance(payment_account, BcolPaymentAccount):
        bcol_account_id = payment_account.id
    elif isinstance(payment_account, InternalPaymentAccount):
        internal_account_id = payment_account.id
    if isinstance(payment_account, CreditPaymentAccount):
        credit_account_id = payment_account.id

    return Invoice(payment_id=payment.id,
                   invoice_status_code=status_code,
                   bcol_account_id=bcol_account_id,
                   credit_account_id=credit_account_id,
                   internal_account_id=internal_account_id,
                   total=0,
                   created_by='test',
                   created_on=datetime.now(),
                   business_identifier=business_identifier,
                   corp_type_code=corp_type_code,
                   folio_number='1234567890',
                   service_fees=service_fees)
예제 #4
0
def factory_invoice(payment_id: str, account_id: str):
    """Factory."""
    return Invoice(payment_id=payment_id,
                   invoice_status_code='DRAFT',
                   account_id=account_id,
                   total=0,
                   created_by='test',
                   created_on=datetime.now())
예제 #5
0
def factory_invoice(payment_id: str, account_id: str, status_code: str = Status.DRAFT.value):
    """Factory."""
    return Invoice(
        payment_id=payment_id,
        invoice_status_code=status_code,
        account_id=account_id,
        total=0,
        created_by='test',
        created_on=datetime.now(),
    )
예제 #6
0
def factory_invoice(payment_account, status_code: str = InvoiceStatus.CREATED.value,
                    corp_type_code='CP',
                    business_identifier: str = 'CP0001234',
                    service_fees: float = 0.0, total=0,
                    payment_method_code: str = PaymentMethod.DIRECT_PAY.value,
                    created_on: datetime = datetime.now()):
    """Return Factory."""
    return Invoice(
        invoice_status_code=status_code,
        payment_account_id=payment_account.id,
        total=total,
        created_by='test',
        #created_on=created_on,
        business_identifier=business_identifier,
        corp_type_code=corp_type_code,
        folio_number='1234567890',
        service_fees=service_fees,
        bcol_account=payment_account.bcol_account,
        payment_method_code=payment_method_code
    ).save()