Code Monkey home page Code Monkey logo

payme-pkg's People

Contributors

anvarbeckk avatar chogirmaliyigit avatar hoosnick avatar muhammadali-akbarov avatar murtazox04 avatar quvonchbekbobojonov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

payme-pkg's Issues

Update `generate_link()` to accept a `callback_url` parameter

The generate_link() method within the GeneratePayLink data class in our project currently lacks flexibility by not allowing a custom callback_url. This enhancement aims to incorporate a callback_url parameter, enabling users to specify their desired callback URL when generating payment links.

Dynamic Data Fiscalization

Add a detail object to Order model

Detail key Type Summary Required
receipt_type Number Sale/Refund = 0
shipping Object Delivery
items Array Commodity item
{
    "result": {
        "allow": true,
        "detail": {
            "receipt_type" : 0,
            "shipping": {},
            "items": []
        }
    }
}

Items array parameters:

Name Type Description Required
discount Number Discount based on quantity of products or services (tiyins)
title String Product or service name
price Number Price per unit of products or services (tiyins)
count Number Quantity of products or services
code String ICPS (Identification code of product or service)
units Number Measurement unit code
package_code String Product packaging code
vat_percent Number Percentage of VAT payable for this product

Shipping object parameters (optional field):

Name Type Description Required
title String Maybe delivery location
price Number Cost of delivery

With only required objects and their keys, we need to add like following for each product or service in our Order model:

"detail": {
  "receipt_type": 0,
  "items": [
    {
      "title": "<product-or-service-name>",
      "price": "<price>",
      "count": "<quantity-int>",
      "code":  "<ICPS>",
      "package_code": "<package-code>"
      "vat_percent": "<percent-int>",
    }
  ]
}

Tests

  • More tests
  • Add to py manage.py test command
  • Test on Pull Request (Github Actions)

KeyError: 'order_id'

  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/payme/views.py", line 61, in post
    order_id, action = paycom_method(incoming_data.get("params"))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/payme/methods/create_transaction.py", line 23, in __call__
    data=get_params(params)
         ^^^^^^^^^^^^^^^^^^
  File "/Users/darklaki/PycharmProjects/naktutka_web/.venv/lib/python3.12/site-packages/payme/utils/get_params.py", line 22, in get_params
    clean_params["order_id"] = account[account_name]
                               ~~~~~~~^^^^^^^^^^^^^^
KeyError: 'order_id'
[07/Feb/2024 11:18:27] "POST /api/payment/payme/transaction/ HTTP/1.1" 500 107475

Add `pyproject.toml` for pip

pypa/pip#8559

  1. A package failing to build. Scroll up in the output to see if "Building wheel" failed for the same package. If yes, then you want to investigate that issue and not this warning.

  2. Or, wheel not being installed in your environment.
    If you're a user, install that package in the environment to avoid hitting this issue.
    If you're the package author, make sure you can install the package with --use-pep517 passed into pip.

incorrectly implemented check `CUSTOM_ORDER`

Here in these lines, it's incorrectly implemented pass check in CUSTOM_ORDER variable,
even when I include my custom model, it ignores it.

try:
CUSTOM_ORDER = import_string(settings.ORDER_MODEL)
if 'amount' in CUSTOM_ORDER.__doc__:
Order = CUSTOM_ORDER
else:
raise ImportError("amount field is not defined in your custom order model")
except (ImportError, AttributeError):
CUSTOM_ORDER = None
logger.warning("You have no payme custom order model")

Always scolding me with it's warn message:

You have no payme custom order model

When I print a CUSTOM_ORDER.__doc__, docstring is printed, but not everyone writes the word "amount" there, hardly everyone writes docstring under classes!

Generate QR-Code

Something like this:

def to_qrcode(data) -> base64 (str) | Path: 
   ...

Need convention for field type `amount`

  • Order model used IntegerField for amount
  • FloatField is used for amount in TransactionModel
  • amount Decimal in GeneratePayLink
  • int in other places

All should be converted to float or decimal

Method names should be replaced

Before
@staticmethod 
def to_soum(amount: Decimal) -> Decimal: 
    """ 
    Convert from tiyin to soum. 

    Parameters 
    ---------- 
    amount: Decimal -> order amount 
    """ 
    return amount * 100 
  
@staticmethod 
def to_tiyin(amount: Decimal) -> Decimal: 
    """ 
    Convert from tiyin to soum. 

    Parameters 
    ---------- 
    amount: Decimal -> order amount 
    """ 
    return amount / 100 
After
@staticmethod 
def to_tiyin(amount: Decimal) -> Decimal: 
    """ 
    Convert from soum to tiyin. 

    Parameters 
    ---------- 
    amount: Decimal -> order amount 
    """ 
    return amount * 100 
  
@staticmethod 
def to_soum(amount: Decimal) -> Decimal: 
    """ 
    Convert from tiyin to soum. 

    Parameters 
    ---------- 
    amount: Decimal -> order amount 
    """ 
    return amount / 100 

Bug in lib/payme/methods/generate_link.py

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.