Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to only send XML data using this library #37

Open
owaisahmedd opened this issue Oct 24, 2023 · 2 comments
Open

How to only send XML data using this library #37

owaisahmedd opened this issue Oct 24, 2023 · 2 comments

Comments

@owaisahmedd
Copy link

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
[email protected]
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='[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

@hassaanalansary
Copy link
Collaborator

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants