django-quickbooks icon indicating copy to clipboard operation
django-quickbooks copied to clipboard

How to only send XML data using this library

Open owaisahmedd opened this issue 2 years ago • 2 comments

class create_xml_customer(Service): def run_test(self): sample_customer_xml = """ <CustomerRet> <ListID>800004ED-1525972764</ListID> <TimeCreated>2018-03-24T00:31:04+05:00</TimeCreated> <TimeModified>2018-03-24T00:31:04+05:00</TimeModified> <EditSequence>1525972764</EditSequence> <Name>Amazon</Name> <FullName>Amazon</FullName> <IsActive>true</IsActive> <CompanyName>Amazon</CompanyName> <BillAddress> <Addr1>2305 Litton Ln</Addr1> <Addr2></Addr2> <Addr3></Addr3> <Addr4></Addr4> <Addr5></Addr5> <City>Hebron</City> <State>Kentucky</State> <PostalCode>41048</PostalCode> <Country>United States</Country> <Note>Nice address</Note> </BillAddress> <ShipAddress> <Addr1>2305 Litton Ln</Addr1> <Addr2></Addr2> <Addr3></Addr3> <Addr4></Addr4> <Addr5></Addr5> <City>Hebron</City> <State>Kentucky</State> <PostalCode>41048</PostalCode> <Country>United States</Country> <Note>Nice address</Note> </ShipAddress> <Phone>998909090909</Phone> <AltPhone>998909090910</AltPhone> <Fax>998909090911</Fax> <Email>[email protected]</Email> <Contact>Someone from Amazon</Contact> <AltContact>Some other one from Amazon</AltContact> </CustomerRet> """ 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='[email protected]', 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

owaisahmedd avatar Oct 24 '23 10:10 owaisahmedd

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?

hassaanalansary avatar Oct 24 '23 17:10 hassaanalansary

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

owaisahmedd avatar Oct 25 '23 05:10 owaisahmedd