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

added more fields and functions such as get_device_status, get_invoic… #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion erpnext_zra/zra.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,44 @@ def get_tax_types(self):
}
response = requests.get(url, headers=headers)
return response.json()
def get_device_status(self):
url = f"{self.BASE_URL}/device/status"
payload = {
"tpin": self.tpin,
"bhfId": self.branch_id,
"dvcSrlNo": self.device_serial_no
}
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
return response.json()

def get_invoice_status(self, invoice_no):
url = f"{self.BASE_URL}/invoice/status"
payload = {
"invoiceNo": invoice_no
}
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
return response.json()

def get_sales_summary(self, start_date, end_date):
url = f"{self.BASE_URL}/sales/summary"
payload = {
"startDate": start_date,
"endDate": end_date
}
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
return response.json()

# We Can Add other methods as required by the VSDC API
def submit_invoice():
Expand Down Expand Up @@ -90,6 +128,7 @@ def get_invoice_data(self):
"totalDiscount": self.total_discount,
"paymentType": self.payment_type,
"currency": self.currency,
"exchangeRate": self.conversion_rate
"exchangeRate": self.conversion_rate,
"remarks": self.remarks
}
return invoice_data