weltlink / django-quickbooks

Django Integration with Quickbooks
Mozilla Public License 2.0
37 stars 13 forks source link

How to only send XML data using this library #37

Open owaisahmedd opened 1 year ago

owaisahmedd commented 1 year ago

class create_xml_customer(Service): def run_test(self): sample_customer_xml = """

800004ED-1525972764 2018-03-24T00:31:04+05:00 2018-03-24T00:31:04+05:00 1525972764 Amazon Amazon true Amazon 2305 Litton Ln Hebron Kentucky 41048 United States Nice address 2305 Litton Ln Hebron Kentucky 41048 United States Nice address 998909090909 998909090910 998909090911 info@amazon.com Someone from Amazon Some other one from Amazon
    """
    sample_customer_data = dict(
        ListID='800004ED-1525972764',
        TimeCreated='2018-03-24T00:31:04+05:00',
        TimeModified='2018-03-24T00:31:04+05:00',
        EditSequence='1525972764',
        Name='Amazon',
        FullName='Amazon',
        IsActive=True,
        CompanyName='Amazon',
        Phone='998909090909',
        AltPhone='998909090910',
        Fax='998909090911',
        Email='info@amazon.com',
        Contact='Someone from Amazon',
        AltContact='Some other one from Amazon',
    )
    sample_address_data = dict(
        Addr1='2305 Litton Ln',
        City='Hebron',
        State='Kentucky',
        PostalCode='41048',
        Country='United States',
        Note='Nice address'
    )
    root_lxml = etree.fromstring(sample_customer_xml)
    customer = Customer.from_lxml(root_lxml)
    assert customer.ListID == sample_customer_data['ListID']
    assert customer.TimeCreated == sample_customer_data['TimeCreated']
    assert customer.TimeModified == sample_customer_data['TimeModified']
    assert customer.EditSequence == sample_customer_data['EditSequence']
    assert customer.Name == sample_customer_data['Name']
    assert customer.FullName == sample_customer_data['FullName']
    assert customer.IsActive == sample_customer_data['IsActive']
    assert customer.CompanyName == sample_customer_data['CompanyName']
    assert customer.Phone == sample_customer_data['Phone']
    assert customer.AltPhone == sample_customer_data['AltPhone']
    assert customer.Fax == sample_customer_data['Fax']
    assert customer.Email == sample_customer_data['Email']
    assert customer.Contact == sample_customer_data['Contact']
    assert customer.AltContact == sample_customer_data['AltContact']

    # assert customer.BillAddress == BillAddress(**sample_address_data)
    # assert customer.ShipAddress == ShipAddress(**sample_address_data)

    from django_quickbooks.objects import Customer as QBCustomer
    # map your fields to the qbd_obj fields
    xx = QBCustomer(customer)
    # QBDTask.objects.create(qb_operation=QUICKBOOKS_ENUMS.OPP_ADD,
    #                        qb_resource=QUICKBOOKS_ENUMS.RESOURCE_CUSTOMER,
    #                        object_id=instance.id,
    #                        content_type=ContentType.objects.get_for_model(instance),
    #                        realm_id="6aea80599dad4469920d0d633b67d0f4",
    #
    #                        )
    xx = CustomerService.add(self, customer)
    if xx:
        return xx
    else:
        return xx

This is the code, try to run without sending object_id how can I add this in the queue manager

hassaanalansary commented 1 year ago

Sorry i don't understand what you are trying to do. Can you please explain with minimum code what you are doing and what is the error you get?

owaisahmedd commented 1 year ago

how can I just simply send xml data without creating an object using this library