payme-pkg icon indicating copy to clipboard operation
payme-pkg copied to clipboard

Dynamic Data Fiscalization

Open hoosnick opened this issue 2 years ago • 2 comments

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>",
    }
  ]
}

hoosnick avatar Aug 18 '23 19:08 hoosnick

BaseOrder:

Detail key Type Summary Required
receipt_type int Sale/Refund = 0
amount bigint Amount
items m2m Commodity item
shipping fk ShippingDetail

Item:

Name Type Description Required
discount bigint Discount based on quantity of products or services (tiyins)
title str Product or service name
price bigint Price per unit of products or services (tiyins)
count int Quantity of products or services
fiscal_data fk FiscalData

FiscalData:

Name Type Description Required
code str ICPS (Identification code of product or service)
units int Measurement unit code
package_code str Product packaging code
vat_percent int Percentage of VAT payable for this product

ShippingDetail:

Name Type Description Required
title str Maybe delivery location
price bigint Cost of delivery

Example of Usage:

from django.db import models

from payme.models import Item, BaseOrder

class Product(models.Model):
    item = models.ForeignKey(Item)
    image = models.CharField(max_length=255)
    desc = models.CharField(max_length=255)

class Order(BaseOrder):
    user_id = models.IntegerField()
    user_comment = models.CharField(max_length=255)

hoosnick avatar Sep 10 '23 10:09 hoosnick

count of items problem: https://t.me/c/1924284038/1/5680

hoosnick avatar Oct 05 '23 12:10 hoosnick

fixed on version 3+

Muhammadali-Akbarov avatar Nov 01 '24 12:11 Muhammadali-Akbarov