add - sharing & company fee to pos free products
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from rest_framework import serializers
|
||||
from apps.product import models as product_models
|
||||
from apps.pos_device.models import POSFreeProducts
|
||||
|
||||
from apps.authentication.api.v1.serializers.serializer import OrganizationTypeSerializer
|
||||
from apps.pos_device.models import POSFreeProducts
|
||||
from apps.product import models as product_models
|
||||
from apps.product.exceptions import FreePOSProductUniqueCheck
|
||||
|
||||
|
||||
@@ -39,6 +40,21 @@ class POSFreeProductSerializer(serializers.ModelSerializer):
|
||||
}
|
||||
|
||||
representation['total_price'] = instance.price + instance.company_fee
|
||||
representation['main_shaba'] = instance.organization.bank_information.all().first().sheba # noqa
|
||||
|
||||
main_company = product_models.Organization.objects.get(
|
||||
national_unique_id='1111111111'
|
||||
)
|
||||
main_company_bank_account = main_company.bank_information.first()
|
||||
representation['sharing'] = {
|
||||
"organization_name": main_company.name,
|
||||
"bank_account": {
|
||||
"credit_card": main_company_bank_account.card,
|
||||
"sheba": main_company_bank_account.sheba,
|
||||
"account": main_company_bank_account.account
|
||||
},
|
||||
"amount": instance.company_fee
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user