Skip to content

Commit

Permalink
Merge pull request #19 from DoggoITA/main
Browse files Browse the repository at this point in the history
Added some fix fr and it should work fully
  • Loading branch information
Rix565 authored Apr 20, 2024
2 parents d83859f + 9f87846 commit 4314fdf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
50 changes: 44 additions & 6 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,52 @@ def redeem_title(request, country, tid):
owned.save()
res = {"transaction_result":{"transaction_id":1,"title_id":title.tid,"ticket_id":int(tikid, base=16),"post_balance":{"amount":str(ds.balance)+",00 Credit","currency":"CREDIT","raw_value":str(ds.balance)},"business_type":"NCL_DIST","integrated_account":True}}
return JsonResponse(res)



#Todo make the date not be a static value
@csrf_exempt
def transactions(request):
try:
ds = Client3DS.objects.get(consoleid=request.session["deviceid"])
except:
return JsonResponse({"error": {"code": "3010","message": "The connection to the server has\ntimed out due to user inactivity.\n\nPlease restart Nintendo eShop\nand try again."}}, status=400)
return JsonResponse({"error": {"code": "8458", "message": "Hello!\nHere is your 3DS Key:\n"+ds.uniquekey}}, status=400)
try:
ds = Client3DS.objects.get(consoleid=request.session["deviceid"])
except:
return JsonResponse({"error": {"code": "3010","message": "The connection to the server has\ntimed out due to user inactivity.\n\nPlease restart Nintendo eShop\nand try again."}}, status=400)

ownedtitles = ownedTitle.objects.filter(owner=ds)

transactions = []
index = 1
for transaction in ownedtitles:
transactions.append({
"date": "14.04.2024",
"type": "Title Download",
"description": transaction.title.name,
"transaction_amount": {
"amount": "0,00",
"currency": "EUR",
"raw_value": "0"
},
"balance": {
"amount": "0,00",
"currency": "EUR",
"raw_value": "0"
},
"title": {},
"receipt": False,
"index": index,
"id": transaction.title.id
})
index += 1

res = {
"transactions": {
"transaction": transactions,
"length": len(transactions),
"offset": 0,
"total": len(transactions)
}
}

return JsonResponse(res)

@csrf_exempt
def shared_titles(request):
Expand Down
3 changes: 2 additions & 1 deletion shopdeckdb/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
admin.site.register(movie)
admin.site.register(User)
admin.site.register(item)
admin.site.register(ownedTicket)
admin.site.register(ownedTicket)
admin.site.register(Vote)

0 comments on commit 4314fdf

Please sign in to comment.