Here are some collection of important link
hightlight.js cdnjs cdnjs.cloudflare
To get the location from ip address
https://blog.avada.io/css/book-effects#3d-book-browsing
https://www.cutout.pro/photo-enhancer-sharpener-upscaler/upload
https://django-cron.readthedocs.io/en/latest/installation.html
https://pypi.org/project/django-social-poster/
payment system:
@method_decorator(login_required,name='dispatch')
class EsewaRequestView(View):
def get(self, request, *args, **kwargs):
o_id = request.GET.get("o_id")
order = Order.objects.get(id=o_id)
total_amount = "100"
order_uuid = "11-201-13"
product_code = "EPAYTEST"
message = f"total_amount={total_amount},transaction_uuid={order_uuid},product_code={product_code}"
secret = "8gBm/:&EnhH.1/q"
hash_result=generate_signature(secret, message)
print(hash_result)
payload={
"amount": "100",
"failure_url": "https://google.com",
"product_delivery_charge": "0",
"product_service_charge": "0",
"product_code": "EPAYTEST",
"signature": hash_result ,
"signed_field_names": "total_amount,transaction_uuid,product_code",
"success_url":"https://esewa.com.np",
"tax_amount": "0",
"total_amount": "100",
"transaction_uuid":"11-201-13",
}
url="https://rc-epay.esewa.com.np/api/epay/main/v2/form"
try:
response = requests.request("POST", url, data=json.dumps(payload), headers={'Content-Type': 'application/json'})
print(response)
new_res = json.loads(response.text)
print(new_res)
except Exception as e:
print('error')
print(e)
import hmac
import hashlib
import base64
def generate_signature(secret, message):
secret_key = secret.encode('utf-8')
message = message.encode('utf-8')
hash_object = hmac.new(secret_key, message, hashlib.sha256)
signature = base64.b64encode(hash_object.digest()).decode('utf-8')
return signature
Regular expression
import re
credit_card_regex = r'^([4-6]\d{3}[\ \-]?\d{4}[\ \-]?\d{4}[\ \-]?\d{4}|3\d{3}[\ \-]?\d{6}[\ \-]?\d{5}|6011[\ \-]?\d{4}[\ \-]?\d{4}[\ \-]?\d{4}|3(4|7)\d{2}[\ \-]?\d{6}[\ \-]?\d{5}|(352[89]|35[3-8]\d)[\ \-]?\d{4}[\ \-]?\d{4}[\ \-]?\d{4}|(?:5[1-5]|2[2-7]|222[1-9]|22[3-9]|2[3-6]\d)[\ \-]?\d{4}[\ \-]?\d{4}[\ \-]?\d{4}|(?:6[01]|636\d)[\ \-]?\d{4}[\ \-]?\d{4}[\ \-]?\d{4})$'
@api.depends('card_number')
def _compute_card_type(self):
""" Define regular expressions for different card types:
visa_regex = '^4[0-9]{12}(?:[0-9]{3})?$'
mastercard_regex = '^5[1-5][0-9]{14}$'
amex_regex = '^3[47][0-9]{13}$'
discover_regex = '^6(?:011|5[0-9]{2})[0-9]{12}$'"""
# Define a table of IINs (Issuer Identification Numbers) for each card type
iin_table = {
'Visa': ['4'],
'Mastercard': ['51', '52', '53', '54', '55'],
'American Express': ['34', '37'],
'Discover': ['6011', '622126', '622127', '622128', '622129', '62213',
'62214', '62215', '62216', '62217', '62218', '62219',
'6222', '6223', '6224', '6225', '6226', '6227', '6228',
'62290', '62291', '622920', '622921', '622922', '622923',
'622924', '622925', '644', '645', '646', '647', '648',
'649', '65'],
}
for rec in self:
# Extract only the digits from the card number
card_number = str(rec.card_number)
card_number = re.sub(r'\D', '', card_number)
# print('Card Number:', card_number,credit_card_regex, re.match(credit_card_regex, card_number))
# # Validate the card number using a regular expression
# if not re.match(credit_card_regex, card_number):
# rec.card_type = 'Invalid Card Number'
# continue
# Determine the IIN of the card number
iin = None
for prefix, iins in iin_table.items():
for iin in iins:
if card_number.startswith(iin):
rec.card_type = prefix
break
if rec.card_type:
break
# If the IIN couldn't be determined, mark the card type as Unknown
if not rec.card_type:
rec.card_type = 'Unknown'
Amanda Martines 5 days ago
Exercitation photo booth stumptown tote bag Banksy, elit small batch freegan sed. Craft beer elit seitan exercitation, photo booth et 8-bit kale chips proident chillwave deep v laborum. Aliquip veniam delectus, Marfa eiusmod Pinterest in do umami readymade swag. Selfies iPhone Kickstarter, drinking vinegar jean.
ReplyBaltej Singh 5 days ago
Drinking vinegar stumptown yr pop-up artisan sunt. Deep v cliche lomo biodiesel Neutra selfies. Shorts fixie consequat flexitarian four loko tempor duis single-origin coffee. Banksy, elit small.
ReplyMarie Johnson 5 days ago
Kickstarter seitan retro. Drinking vinegar stumptown yr pop-up artisan sunt. Deep v cliche lomo biodiesel Neutra selfies. Shorts fixie consequat flexitarian four loko tempor duis single-origin coffee. Banksy, elit small.
Reply