store: add subscription-plan stubs for specific SKUs

This commit is contained in:
Luna 2021-08-29 17:09:57 -03:00
parent d2cca438ab
commit 9cdb79b084
1 changed files with 117 additions and 4 deletions

View File

@ -17,12 +17,125 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from quart import Blueprint
from quart import Blueprint, jsonify
from pathlib import Path
bp = Blueprint("store", __name__)
SKU_STUBS = {
521842865731534868: [
{
"id": "511651856145973248",
"name": "Nitro Monthly (Legacy)",
"interval": 1,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521842865731534868",
"currency": "usd",
"price": 499,
"price_tier": None,
},
{
"id": "511651860671627264",
"name": "Nitro Yearly (Legacy)",
"interval": 2,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521842865731534868",
"currency": "usd",
"price": 4999,
"price_tier": None,
},
],
521846918637420545: [
{
"id": "511651871736201216",
"name": "Nitro Classic Monthly",
"interval": 1,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521846918637420545",
"currency": "usd",
"price": 499,
"price_tier": None,
},
{
"id": "511651876987469824",
"name": "Nitro Classic Yearly",
"interval": 2,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521846918637420545",
"currency": "usd",
"price": 4999,
"price_tier": None,
},
],
521847234246082599: [
{
"id": "511651880837840896",
"name": "Nitro Monthly",
"interval": 1,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521847234246082599",
"currency": "usd",
"price": 999,
"price_tier": None,
},
{
"id": "511651885459963904",
"name": "Nitro Yearly",
"interval": 2,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "521847234246082599",
"currency": "usd",
"price": 9999,
"price_tier": None,
},
{
"id": "642251038925127690",
"name": "Nitro Quarterly",
"interval": 1,
"interval_count": 3,
"tax_inclusive": True,
"sku_id": "521847234246082599",
"currency": "usd",
"price": 2997,
"price_tier": None,
},
],
590663762298667008: [
{
"id": "590665532894740483",
"name": "Server Boost Monthly",
"interval": 1,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "590663762298667008",
"currency": "usd",
"price": 499,
"price_tier": None,
},
{
"id": "590665538238152709",
"name": "Server Boost Yearly",
"interval": 2,
"interval_count": 1,
"tax_inclusive": True,
"sku_id": "590663762298667008",
"currency": "usd",
"price": 4999,
"price_tier": None,
},
],
}
@bp.route("/published-listings/skus/<sku_id>/subscription-plans")
async def _stub_sku_plans(sku_id):
return []
@bp.route("/published-listings/skus/<int:sku_id>/subscription-plans")
async def _stub_sku_plans(sku_id: int):
stub_subscriptions = SKU_STUBS.get(sku_id)
if stub_subscriptions is None:
return "", 404
return jsonify(stub_subscriptions)