From 986018f2adedd7c1aca78ada1ab2fc1d66af5703 Mon Sep 17 00:00:00 2001 From: hyeon Date: Thu, 1 Aug 2024 15:34:19 +0900 Subject: [PATCH] Update message to send SKU by platform --- iap/api/purchase.py | 1 + worker/worker/handler.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/iap/api/purchase.py b/iap/api/purchase.py index efb3b2b..3febf54 100644 --- a/iap/api/purchase.py +++ b/iap/api/purchase.py @@ -279,6 +279,7 @@ def request_product(receipt_data: ReceiptSchema, "agent_addr": receipt.agent_addr, "avatar_addr": receipt.avatar_addr, "planet_id": receipt_data.planetId.decode(), + "package_name": receipt.package_name, })) logger.info(f"Voucher message: {resp['MessageId']}") diff --git a/worker/worker/handler.py b/worker/worker/handler.py index 2062e44..dfedaaf 100644 --- a/worker/worker/handler.py +++ b/worker/worker/handler.py @@ -13,7 +13,7 @@ from common import logger from common._crypto import Account from common._graphql import GQL -from common.enums import TxStatus +from common.enums import TxStatus, PackageName from common.models.product import Product from common.models.receipt import Receipt from common.utils.actions import create_unload_my_garages_action_plain_value @@ -106,7 +106,12 @@ def process(sess: Session, message: SQSMessageRecord, nonce: int = None) -> Tupl planet_id: PlanetID = PlanetID(bytes(message.body["planet_id"], 'utf-8')) agent_address = message.body.get("agent_addr") avatar_address = message.body.get("avatar_addr") - memo = json.dumps({"iap": {"g_sku": product.google_sku, "a_sku": product.apple_sku}}) + package_name = PackageName(message.body.get("package_name")) + memo = json.dumps({"iap": + {"g_sku": product.google_sku, + "a_sku": product.apple_sku_k if package_name == PackageName.NINE_CHRONICLES_K + else product.apple_sku} + }) # Through bridge if planet_id != CURRENT_PLANET: agent_address = planet_dict[planet_id]["agent"]