def get_vendor_payment(self, resp): """This method is used to parse the given response and returns vendor payments object. Args: resp(dict): Dictionary containing json object for vendor payments. Returns: instance: Vendor payments object. """ vendor_payment_obj = VendorPayment() vendor_payment = resp['vendorpayment'] vendor_payment_obj.set_payment_id(vendor_payment['payment_id']) vendor_payment_obj.set_vendor_id(vendor_payment['vendor_id']) vendor_payment_obj.set_vendor_name(vendor_payment['vendor_name']) vendor_payment_obj.set_payment_mode(vendor_payment['payment_mode']) vendor_payment_obj.set_description(vendor_payment['description']) vendor_payment_obj.set_date(vendor_payment['date']) vendor_payment_obj.set_reference_number(vendor_payment[\ 'reference_number']) vendor_payment_obj.set_exchange_rate(vendor_payment['exchange_rate']) vendor_payment_obj.set_amount(vendor_payment['amount']) vendor_payment_obj.set_currency_symbol(vendor_payment[\ 'currency_symbol']) vendor_payment_obj.set_paid_through_account_id(vendor_payment[\ 'paid_through_account_id']) vendor_payment_obj.set_paid_through_account_name(vendor_payment[\ 'paid_through_account_name']) for value in vendor_payment['bills']: bill = Bill() bill.set_bill_number(value['bill_number']) bill.set_bill_payment_id(value['bill_payment_id']) bill.set_bill_id(value['bill_id']) bill.set_total(value['total']) bill.set_balance(value['balance']) bill.set_amount_applied(value['amount_applied']) bill.set_date(value['date']) bill.set_due_date(value['due_date']) vendor_payment_obj.set_bills(bill) return vendor_payment_obj
refund.set_creditnote_id(credit_note_id) refund.set_date('2014-01-01') refund.set_refund_mode('cash') refund.set_reference_number('') refund.set_exchange_rate(1.0) refund.set_from_account_id(account_id) refund.set_description('credit not categorize') print bank_transaction_api.categorize_as_credit_note_refunds(transaction_id,refund) # Categorize as vendor payments vendor_payment = VendorPayment() vendor_payment.set_vendor_id(vendor_id) bills=Bill() bills.set_bill_id(bill_id) bills.set_amount_applied(10.0) vendor_payment.set_bills(bills) vendor_payment.set_payment_mode('cash') vendor_payment.set_description('vendor payments') vendor_payment.set_date('2014-04-29') vendor_payment.set_reference_number('2') vendor_payment.set_exchange_rate(1.0) vendor_payment.set_amount(20.0) vendor_payment.set_paid_through_account_id('') print bank_transaction_api.categorize_as_vendor_payment(transaction_id,vendor_payment) # Categorize as customer payment invoice_api = zoho_books.get_invoices_api() invoice_id = invoice_api.get_invoices().get_invoices()[0].get_invoice_id()