Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 试用或购买插件后直接安装插件 #1360

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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