Esempio n. 1
0
#print credit_notes_api.list_credit_note_refunds(customer_id)
#print credit_notes_api.list_credit_note_refunds(None,sort_column)
#print credit_notes_api.list_credit_note_refunds(customer_id,sort_column)

# List refunds of a credit note

print credit_notes_api.list_refunds_of_credit_note(credit_note_id)

# Get credit note refund

print credit_notes_api.get_credit_note_refund(credit_note_id,
                                              creditnote_refund_id)

# Refund credit note

refund = CreditNoteRefund()
refund.set_date('2014-01-01')
refund.set_refund_mode('Cash')
refund.set_reference_number('')
refund.set_amount(20.0)
refund.set_exchange_rate(8.0)
refund.set_from_account_id('71127000000000361')
refund.set_description('Refunded amt')
print credit_notes_api.refund_credit_note(credit_note_id, refund)

# Update credit note refund

refund = CreditNoteRefund()
refund.set_date('2014-01-01')
refund.set_refund_mode('')
refund.set_reference_number('')
    def get_refund_list(self, response):
        """This method parses the given response and creates refund list 
            object.

        Args:
            response(dict): Response containing json object for refund list.

        Returns:
            instance: Refund list object.

        """
        list_refund = CreditNoteRefundList()
        creditnote_refunds = response['creditnote_refunds']
        for value in creditnote_refunds:
            creditnote_refund = CreditNoteRefund()
            creditnote_refund.set_creditnote_refund_id(value[\
                'creditnote_refund_id'])
            creditnote_refund.set_creditnote_id(value['creditnote_id'])
            creditnote_refund.set_date(value['date'])
            creditnote_refund.set_refund_mode(value['refund_mode'])
            creditnote_refund.set_reference_number(value['reference_number'])
            creditnote_refund.set_creditnote_number(value['creditnote_number'])
            creditnote_refund.set_customer_name(value['customer_name'])
            creditnote_refund.set_description(value['description'])
            creditnote_refund.set_amount_bcy(value['amount_bcy'])
            creditnote_refund.set_amount_fcy(value['amount_fcy'])
            list_refund.set_creditnote_refunds(creditnote_refund)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])    
        list_refund.set_page_context(page_context_object)

        return list_refund
Esempio n. 3
0
categorize_a_transaction.set_from_account_id('71127000000079023')
categorize_a_transaction.set_to_account_id('71127000000012001')
categorize_a_transaction.set_transaction_type('transfer_fund')
categorize_a_transaction.set_amount(10.0)
categorize_a_transaction.set_payment_mode('cash')
categorize_a_transaction.set_exchange_rate(1.0)
categorize_a_transaction.set_date('2014-04-29')
categorize_a_transaction.set_customer_id(customer_id)
categorize_a_transaction.set_reference_number('2')
categorize_a_transaction.set_description('transafer')
categorize_a_transaction.set_currency_id(currency_id)

print bank_transaction_api.categorize_an_uncategorized_transaction(transaction_id,categorize_a_transaction)

# Categorize as credit note refund
refund = CreditNoteRefund()
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)
print credit_notes_api.list_credit_note_refunds()
#print credit_notes_api.list_credit_note_refunds(customer_id)
#print credit_notes_api.list_credit_note_refunds(None,sort_column)
#print credit_notes_api.list_credit_note_refunds(customer_id,sort_column)

# List refunds of a credit note

print credit_notes_api.list_refunds_of_credit_note(credit_note_id)

# Get credit note refund

print credit_notes_api.get_credit_note_refund(credit_note_id,creditnote_refund_id)

# Refund credit note

refund=CreditNoteRefund()
refund.set_date('2014-01-01')
refund.set_refund_mode('Cash')
refund.set_reference_number('')
refund.set_amount(20.0)
refund.set_exchange_rate(8.0)
refund.set_from_account_id('71127000000000361')
refund.set_description('Refunded amt')
print credit_notes_api.refund_credit_note(credit_note_id,refund)

# Update credit note refund

refund=CreditNoteRefund()
refund.set_date('2014-01-01')
refund.set_refund_mode('')
refund.set_reference_number('')
Esempio n. 5
0
    def get_refund_list(self, response):
        """This method parses the given response and creates refund list
            object.

        Args:
            response(dict): Response containing json object for refund list.

        Returns:
            instance: Refund list object.

        """
        list_refund = CreditNoteRefundList()
        creditnote_refunds = response['creditnote_refunds']
        for value in creditnote_refunds:
            creditnote_refund = CreditNoteRefund()
            creditnote_refund.set_creditnote_refund_id(value[\
                'creditnote_refund_id'])
            creditnote_refund.set_creditnote_id(value['creditnote_id'])
            creditnote_refund.set_date(value['date'])
            creditnote_refund.set_refund_mode(value['refund_mode'])
            creditnote_refund.set_reference_number(value['reference_number'])
            creditnote_refund.set_creditnote_number(value['creditnote_number'])
            creditnote_refund.set_customer_name(value['customer_name'])
            creditnote_refund.set_description(value['description'])
            creditnote_refund.set_amount_bcy(value['amount_bcy'])
            creditnote_refund.set_amount_fcy(value['amount_fcy'])
            list_refund.set_creditnote_refunds(creditnote_refund)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        list_refund.set_page_context(page_context_object)

        return list_refund
categorize_a_transaction.set_from_account_id('71127000000079023')
categorize_a_transaction.set_to_account_id('71127000000012001')
categorize_a_transaction.set_transaction_type('transfer_fund')
categorize_a_transaction.set_amount(10.0)
categorize_a_transaction.set_payment_mode('cash')
categorize_a_transaction.set_exchange_rate(1.0)
categorize_a_transaction.set_date('2014-04-29')
categorize_a_transaction.set_customer_id(customer_id)
categorize_a_transaction.set_reference_number('2')
categorize_a_transaction.set_description('transafer')
categorize_a_transaction.set_currency_id(currency_id)

print bank_transaction_api.categorize_an_uncategorized_transaction(transaction_id,categorize_a_transaction)

# Categorize as credit note refund
refund = CreditNoteRefund()
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)
    def get_creditnote_refund(self,response):
        """This method parses the given repsonse and returns credit note 
            refund object.

        Args:
            response(dict): Response containing json object for credit note 
                refund.

        Returns:
            isntacne: Credit note object.

        """
        creditnote_refund=response['creditnote_refund']
        creditnote_refund_obj=CreditNoteRefund()
        creditnote_refund_obj.set_creditnote_refund_id(\
        creditnote_refund['creditnote_refund_id'])
        creditnote_refund_obj.set_creditnote_id(\
        creditnote_refund['creditnote_id'])
        creditnote_refund_obj.set_date(creditnote_refund['date'])
        creditnote_refund_obj.set_refund_mode(creditnote_refund['refund_mode'])
        creditnote_refund_obj.set_reference_number(\
        creditnote_refund['reference_number'])
        creditnote_refund_obj.set_amount(creditnote_refund['amount'])
        creditnote_refund_obj.set_exchange_rate(\
        creditnote_refund['exchange_rate'])
        creditnote_refund_obj.set_from_account_id(\
        creditnote_refund['from_account_id'])
        creditnote_refund_obj.set_from_account_name(\
        creditnote_refund['from_account_name'])
        creditnote_refund_obj.set_description(creditnote_refund['description'])
        return creditnote_refund_obj
    def payment_refunds(self, response):
        """This method parses the given response and returns credit notes
            refund list.

        Args:
            response(dict): Repsonse containing json object for credit notes
                list.

        Returns:
            instance: Creditnote list object.

        """
        payment_refunds_list = CreditNoteRefundList()
        if 'payment_refunds' not in response:
            response['payment_refunds'] = [response['payment_refund']]
        for value in response['payment_refunds']:
            payment_refund = CreditNoteRefund()
            payment_refund.set_creditnote_refund_id(value['payment_refund_id'])
            payment_refund.set_creditnote_id(value['payment_id'])
            payment_refund.set_date(value['date'])
            payment_refund.set_refund_mode(value['refund_mode'])
            payment_refund.set_reference_number(value['reference_number'])
            payment_refund.set_description(value['description'])
            payment_refund.set_amount(value['amount'])
            payment_refunds_list.set_creditnote_refunds(payment_refund)
        if 'page_context' in response:
            page_context = response['page_context']
            page_context_obj = PageContext()
            page_context_obj.set_page(page_context['page'])
            page_context_obj.set_per_page(page_context['per_page'])
            page_context_obj.set_has_more_page(page_context['has_more_page'])
            page_context_obj.set_report_name(page_context['report_name'])
            page_context_obj.set_sort_column(page_context['sort_column'])
            page_context_obj.set_sort_order(page_context['sort_order'])
            payment_refunds_list.set_page_context(page_context_obj)
        return payment_refunds_list