Git Product home page Git Product logo

ecommerce-nau-extensions's People

Contributors

igobranco avatar

Watchers

 avatar  avatar  avatar

ecommerce-nau-extensions's Issues

Fix retry_send_to_financial_manager command

Error executing command for a single basket using its id:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/openedx/venv/lib/python3.8/site-packages/nau_extensions/management/commands/retry_send_to_financial_manager.py", line 65, in handle
    bti = BasketTransactionIntegration.get_by_basket(basket)
  File "/openedx/venv/lib/python3.8/site-packages/nau_extensions/models.py", line 156, in get_by_basket
    return BasketTransactionIntegration.objects.filter(basket=basket).first()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 674, in first
    for obj in (self if self.ordered else self.order_by('pk'))[:1]:
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 280, in __iter__
    self._fetch_all()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1162, in execute_sql
    sql, params = self.as_sql()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 528, in as_sql
    where, w_params = self.compile(self.where) if self.where is not None else ("", [])
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 445, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/where.py", line 81, in as_sql
    sql, params = compiler.compile(child)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 445, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/related_lookups.py", line 132, in as_sql
    return super().as_sql(compiler, connection)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/lookups.py", line 315, in as_sql
    return super().as_sql(compiler, connection)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/lookups.py", line 194, in as_sql
    rhs_sql, rhs_params = self.process_rhs(compiler, connection)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/lookups.py", line 297, in process_rhs
    raise ValueError(
ValueError: The QuerySet value for an exact lookup must be limited to one result using slicing.

Error retry ecommerce Fullfillment

2024-01-25 09:18:43,498 ERROR 7 [django.request] /openedx/venv/lib/python3.8/site-packages/django/utils/log.py:224 - Internal Server Error: /api/v2/orders/OPENEDX-100029/fulfill/
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry '29' for key 'basket_id'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/openedx/ecommerce/./ecommerce/extensions/api/v2/views/orders.py", line 91, in fulfill
    post_checkout.send(
  File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 180, in send
    return [
  File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/openedx/venv/lib/python3.8/site-packages/nau_extensions/signals.py", line 22, in create_and_send_basket_transaction_integration_to_financial_manager
    BasketTransactionIntegration.create(order.basket).save()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 739, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 776, in save_base
    updated = self._save_table(
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 881, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 919, in _do_insert
    return manager._insert(
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1270, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
    cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1062, "Duplicate entry '29' for key 'basket_id'")

Show receipts PDFs from iLink that are proxied by nau-financial-manager

We need to create a new use case or change/extend an existing one, that show all Orders (Transactions or Buckets that have fullfilled) and add a button/link that allows the user to download the receipt PDF.

To implement this use case this application needs to use the nau-financial-manager /billing/invoice-link/ service.
This service proxies the iLink service, but internally translates the Transaction ID (order id) to the correct iLink document id and requests the PDF document link to the iLink.

The ideia is that this application shows a link to PDF on iLink. And not to store the PDFs itself. Nevertheless we could cache the PDF links.

Add discount to the synced data

The nau-financial-manager needs a discount value synced with the ecommerce system.
This discount value is associated with the vouchers implemented by the ecommerce system.

Related PR
fccn/nau-financial-manager#249

On transaction level:

  • total_discount_incl_tax
  • total_discount_excl_tax

On Transaction Item level:

  • discount_excl_tax
  • discount_incl_tax

Error sending order to financial manager

2024-03-01 11:09:06,688 ERROR 11 [ecommerce.extensions.checkout.mixins] /openedx/ecommerce/./ecommerce/extensions/checkout/mixins.py:317 - Duplicate Order Attempt: Paygate payment was received, but an order with number [OPENEDX-100033] already exists. Basket id: [33].
Traceback (most recent call last):
  File "/openedx/ecommerce/./ecommerce/extensions/checkout/mixins.py", line 71, in create_order
    order = self.handle_order_placement(
  File "/openedx/ecommerce/./ecommerce/extensions/checkout/mixins.py", line 197, in handle_order_placement
    return self.handle_successful_order(order, request)
  File "/openedx/ecommerce/./ecommerce/extensions/checkout/mixins.py", line 237, in handle_successful_order
    post_checkout.send(sender=self, order=order, request=request, email_opt_in=email_opt_in)
  File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 180, in send
    return [
  File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/openedx/venv/lib/python3.8/site-packages/nau_extensions/signals.py", line 26, in create_and_send_basket_transaction_integration_to_financial_manager
    send_to_financial_manager_if_enabled(bti)
  File "/openedx/venv/lib/python3.8/site-packages/nau_extensions/financial_manager.py", line 142, in send_to_financial_manager_if_enabled
    site = basket_transaction_integration.basket.site
AttributeError: 'NoneType' object has no attribute 'basket'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.