Skip to content

Commit

Permalink
fix: 🐛 试用或购买插件后直接安装插件 (#1360)
Browse files Browse the repository at this point in the history
  • Loading branch information
luolu-lg committed Oct 18, 2022
1 parent 11c138b commit d1d43fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/v1/pages/app_manage/app_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
global_actions={
'next': actions.NextAction(
name="已支付",
path="/api/v1/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/",
path="/api/v1/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/extensions/{uuid}/",
method=actions.FrontActionMethod.GET
),
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1/pages/extension_manage/extension_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
global_actions={
'next': actions.NextAction(
name="已支付",
path="/api/v1/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/",
path="/api/v1/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/extensions/{uuid}/",
method=actions.FrontActionMethod.GET
),
}
Expand Down
9 changes: 7 additions & 2 deletions api/v1/views/arkstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,23 @@ def get_order_payment_arkstore_extension(request, tenant_id: str, order_no: str)
return {'data': resp}


@api.get("/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/", tags=['方舟商店'],
@api.get("/tenant/{tenant_id}/arkstore/purchase/order/{order_no}/payment_status/extensions/{uuid}/", tags=['方舟商店'],
response={
200: PaymentStatus,
202: ResponseSchema,
})
@operation(roles=[TENANT_ADMIN, PLATFORM_ADMIN])
def get_order_payment_status_arkstore_extension(request, tenant_id: str, order_no: str):
def get_order_payment_status_arkstore_extension(request, tenant_id: str, order_no: str, uuid: str):
token = request.user.auth_token
tenant = Tenant.objects.get(id=tenant_id)
access_token = get_arkstore_access_token(tenant, token)
resp = order_payment_status_arkstore_extension(access_token, order_no)
if resp.get('code') == '0' and not resp.get('appid'):
return 202, {'data': resp}
else:
# install extension
if resp.get('trade_state') == 'SUCCESS':
install_arkstore_extension(tenant, token, uuid)
return 200, resp


Expand Down Expand Up @@ -578,6 +581,8 @@ def create_order_arkstore_extension_trial(request, tenant_id: str, uuid: str):
resp = trial_arkstore_extension(access_token, uuid)
if resp.get('code') == '10003':
return ErrorDict(ErrorCode.TRIAL_EXTENSION_TWICE)
# install extension
install_arkstore_extension(tenant, token, uuid)
return {'data': resp}


Expand Down

0 comments on commit d1d43fc

Please sign in to comment.