コード例 #1
0
    def test_build_payload(self):
        shipping_address = G(models.ShippingAddress,
                             phone_number='')
        order = factories.create_order(shipping_address=shipping_address)
        # Ensure partner has an address
        partner = order.lines.all()[0].stockrecord.partner
        G(partner_models.PartnerAddress, partner=partner)

        with mock.patch('avalara.gateway.post_tax') as mocked_post_tax:
            avalara.submit(order)
            self.assertTrue(mocked_post_tax.called)
コード例 #2
0
    def handle_successful_order(self, order):
        # Override the handle_successful_order method so we can submit the
        # order to Avalara for tax reporting

        response = super(PaymentDetailsView, self).handle_successful_order(
            order)

        # Submit tax information to Avalara
        try:
            avalara.submit(order)
        except Exception:
            # Tax can be re-submitted later so we swallow all possible
            # exceptions and log them.
            logger.error("Unable to submit tax information for order %s",
                         order.number, exc_info=True)

        return response
コード例 #3
0
    def handle_successful_order(self, order):
        # Override the handle_successful_order method so we can submit the
        # order to Avalara for tax reporting

        response = super(PaymentDetailsView,
                         self).handle_successful_order(order)

        # Submit tax information to Avalara
        try:
            avalara.submit(order)
        except Exception:
            # Tax can be re-submitted later so we swallow all possible
            # exceptions and log them.
            logger.error("Unable to submit tax information for order %s",
                         order.number,
                         exc_info=True)

        return response