some pravesh conversion changes

This commit is contained in:
Ubuntu 2025-05-23 12:16:11 +00:00
parent 64978f88a4
commit 6cb172c922
1 changed files with 28 additions and 24 deletions

View File

@ -422,33 +422,37 @@ class Conversion:
if obj.User_preference !="MNF": if obj.User_preference !="MNF":
tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project), tx_id, tx_gas_fee = UploadConversionData(OWNER_KEY, blockchain_obj.publicKey, UserId, str(Project),
Data) Data)
if tx_id == False:
obj.User_preference = "MNF"
obj.save()
else:
print("Tx id -> ", tx_id,tx_gas_fee) print("Tx id -> ", tx_id,tx_gas_fee)
print(type(tx_id)) print(type(tx_id))
try:
try: user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=tx_gas_fee,
user_infos = user_info(tx_hash=tx_id, service="Conversion", gas_fee=tx_gas_fee, script_name=self.name_script)
script_name=self.name_script) addition_result = user_infos.update_info(self)
addition_result = user_infos.update_info(self) print("Blockchain Result -> ",addition_result)
print("Blockchain Result -> ",addition_result) except Exception as e:
except Exception as e: print("Error:", e)
print("Error:", e)
print("blockchain script conversion 6") print("blockchain script conversion 6")
# certificatepath = certificateGenrate(self.user.username, "script conversion", hash) # certificatepath = certificateGenrate(self.user.username, "script conversion", hash)
certificatepath = certificateGenrate(self.user.username, "script conversion", hash, projectname=self.name_script, matic = tx_gas_fee) certificatepath = certificateGenrate(self.user.username, "script conversion", hash, projectname=self.name_script, matic = tx_gas_fee)
hash = hash_decrypation(hash) hash = hash_decrypation(hash)
to_email = [self.user.email] to_email = [self.user.email]
email_code = 'BL1' email_code = 'BL1'
key_value = { key_value = {
"Product Name": "script conversion", "Product Name": "script conversion",
"Profile url": f"{settings.SITE_DOMAIN}/memberpage/#/personaldetails", "Profile url": f"{settings.SITE_DOMAIN}/memberpage/#/personaldetails",
"User url": f"{settings.SITE_DOMAIN}/memberpage/#/user/{self.user.id}/personaldetails", "User url": f"{settings.SITE_DOMAIN}/memberpage/#/user/{self.user.id}/personaldetails",
"Product output card url": f"{settings.SITE_DOMAIN}/conversion/view_conversion/", "Product output card url": f"{settings.SITE_DOMAIN}/conversion/view_conversion/",
} }
sendmail(to_email=to_email, email_code=email_code,key_value=key_value, filePath=certificatepath) sendmail(to_email=to_email, email_code=email_code,key_value=key_value, filePath=certificatepath)
except Exception as e: except Exception as e:
self.translated_script_object.error_desc = "Error in blockchain is " + str(e) self.translated_script_object.error_desc = "Error in blockchain is " + str(e)
self.translated_script_object.save() self.translated_script_object.save()