|
@@ -2578,25 +2578,32 @@ class serveManagement(View):
|
|
order_lookup_response = client.look_up_order_id(apple_order)
|
|
order_lookup_response = client.look_up_order_id(apple_order)
|
|
signed_transactions = order_lookup_response.signedTransactions
|
|
signed_transactions = order_lookup_response.signedTransactions
|
|
if signed_transactions:
|
|
if signed_transactions:
|
|
- transaction_payload = signed_data_verifier.verify_and_decode_signed_transaction(signed_transactions[0])
|
|
|
|
- transaction_id = transaction_payload.transactionId
|
|
|
|
- orders_qs = orders_qs.filter(transaction_id=transaction_id)
|
|
|
|
- if InAppRefund.objects.filter(orderID=order_id).exists():
|
|
|
|
- return response.json(174)
|
|
|
|
|
|
+ transaction_ids = []
|
|
|
|
+ for signed_transaction in signed_transactions:
|
|
|
|
+ transaction_payload = signed_data_verifier.verify_and_decode_signed_transaction(signed_transaction)
|
|
|
|
+ transaction_id = transaction_payload.transactionId
|
|
|
|
+ transaction_ids.append(transaction_id)
|
|
|
|
+ orders_qs = orders_qs.filter(transaction_id__in=transaction_ids)
|
|
else:
|
|
else:
|
|
return response.json(800)
|
|
return response.json(800)
|
|
if not orders_qs.exists():
|
|
if not orders_qs.exists():
|
|
return response.json(173, "订单不存在")
|
|
return response.json(173, "订单不存在")
|
|
-
|
|
|
|
- uid = orders_qs[0].UID
|
|
|
|
- order_id = orders_qs[0].orderID
|
|
|
|
- transaction_id = orders_qs[0].transaction_id
|
|
|
|
- app_type = orders_qs[0].app_type
|
|
|
|
- now_time = int(time.time())
|
|
|
|
- InAppRefund.objects.create(
|
|
|
|
- uid=uid, transaction_id=transaction_id,
|
|
|
|
- orderID=order_id, refund_progress=4, app_type=app_type,
|
|
|
|
- created_time=now_time, updated_time=now_time)
|
|
|
|
|
|
+ for order in orders_qs:
|
|
|
|
+ uid = order.UID
|
|
|
|
+ order_id = order.orderID
|
|
|
|
+ transaction_id = order.transaction_id
|
|
|
|
+ now_time = int(time.time())
|
|
|
|
+ if not InAppRefund.objects.filter(transaction_id=transaction_id).exists():
|
|
|
|
+ if app_type:
|
|
|
|
+ InAppRefund.objects.create(
|
|
|
|
+ uid=uid, transaction_id=transaction_id,
|
|
|
|
+ orderID=order_id, refund_progress=4, app_type=app_type,
|
|
|
|
+ created_time=now_time, updated_time=now_time)
|
|
|
|
+ else:
|
|
|
|
+ InAppRefund.objects.create(
|
|
|
|
+ uid=uid, transaction_id=transaction_id,
|
|
|
|
+ orderID=order_id, refund_progress=4,
|
|
|
|
+ created_time=now_time, updated_time=now_time)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
|
|
|
|
|
|
|