mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Add PaymentResultPage.
This commit is contained in:
parent
ca87dd7dea
commit
55a84644e1
@ -48,6 +48,7 @@ import ProductEditPage from "./ProductEditPage";
|
||||
import ProductBuyPage from "./ProductBuyPage";
|
||||
import PaymentListPage from "./PaymentListPage";
|
||||
import PaymentEditPage from "./PaymentEditPage";
|
||||
import PaymentResultPage from "./PaymentResultPage";
|
||||
import AccountPage from "./account/AccountPage";
|
||||
import HomePage from "./basic/HomePage";
|
||||
import CustomGithubCorner from "./CustomGithubCorner";
|
||||
@ -529,6 +530,7 @@ class App extends Component {
|
||||
<Route exact path="/products/:productName/buy" render={(props) => this.renderLoginIfNotLoggedIn(<ProductBuyPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/payments" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentListPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/payments/:paymentName" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentEditPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/payments/:paymentName/result" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentResultPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/records" render={(props) => this.renderLoginIfNotLoggedIn(<RecordListPage account={this.state.account} {...props} />)}/>
|
||||
<Route exact path="/.well-known/openid-configuration" render={(props) => <OdicDiscoveryPage />}/>
|
||||
<Route path="" render={() => <Result status="404" title="404 NOT FOUND" subTitle={i18next.t("general:Sorry, the page you visited does not exist.")}
|
||||
|
@ -201,11 +201,12 @@ class PaymentListPage extends BaseListPage {
|
||||
title: i18next.t("general:Action"),
|
||||
dataIndex: '',
|
||||
key: 'op',
|
||||
width: '170px',
|
||||
width: '240px',
|
||||
fixed: (Setting.isMobile()) ? "false" : "right",
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<div>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/payments/${record.name}/result`)}>{i18next.t("payment:Result")}</Button>
|
||||
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/payments/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||
<Popconfirm
|
||||
title={`Sure to delete payment: ${record.name} ?`}
|
||||
|
115
web/src/PaymentResultPage.js
Normal file
115
web/src/PaymentResultPage.js
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright 2022 The Casdoor Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import {Button, Result, Spin} from 'antd';
|
||||
import * as PaymentBackend from "./backend/PaymentBackend";
|
||||
import * as Setting from "./Setting";
|
||||
import i18next from "i18next";
|
||||
|
||||
class PaymentResultPage extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
classes: props,
|
||||
paymentName: props.match.params.paymentName,
|
||||
payment: null,
|
||||
};
|
||||
}
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
this.getPayment();
|
||||
}
|
||||
|
||||
getPayment() {
|
||||
PaymentBackend.getPayment("admin", this.state.paymentName)
|
||||
.then((payment) => {
|
||||
this.setState({
|
||||
payment: payment,
|
||||
});
|
||||
|
||||
if (payment.state === "Created") {
|
||||
setTimeout(() => this.getPayment(), 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const payment = this.state.payment;
|
||||
|
||||
if (payment === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (payment.state === "Paid") {
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
Setting.renderHelmet(payment)
|
||||
}
|
||||
<Result
|
||||
status="success"
|
||||
title={`${i18next.t("payment:You have successfully completed the payment")}: ${payment.productName}`}
|
||||
subTitle={i18next.t("payment:Please click the below button to return to the original website")}
|
||||
extra={[
|
||||
<Button type="primary" key="returnUrl" onClick={() => {
|
||||
Setting.goToLink(payment.returnUrl);
|
||||
}}>
|
||||
{i18next.t("payment:Return to Website")}
|
||||
</Button>
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
} else if (payment.state === "Created") {
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
Setting.renderHelmet(payment)
|
||||
}
|
||||
<Result
|
||||
status="info"
|
||||
title={`${i18next.t("payment:The payment is still under processing")}: ${payment.productName}, ${i18next.t("payment:the current state is")}: ${payment.state}, ${i18next.t("payment:please wait for a few seconds...")}`}
|
||||
subTitle={i18next.t("payment:Please click the below button to return to the original website")}
|
||||
extra={[
|
||||
<Spin size="large" tip={i18next.t("payment:Processing...")} />,
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
Setting.renderHelmet(payment)
|
||||
}
|
||||
<Result
|
||||
status="error"
|
||||
title={`${i18next.t("payment:The payment has failed")}: ${payment.productName}, ${i18next.t("payment:the current state is")}: ${payment.state}`}
|
||||
subTitle={i18next.t("payment:Please click the below button to return to the original website")}
|
||||
extra={[
|
||||
<Button type="primary" key="returnUrl" onClick={() => {
|
||||
Setting.goToLink(payment.returnUrl);
|
||||
}}>
|
||||
{i18next.t("payment:Return to Website")}
|
||||
</Button>
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default PaymentResultPage;
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "Aktionen",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "Actions",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "Actions",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "アクション",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "Actions",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "Currency - Tooltip",
|
||||
"Edit Payment": "Edit Payment",
|
||||
"New Payment": "New Payment",
|
||||
"Please click the below button to return to the original website": "Please click the below button to return to the original website",
|
||||
"Price": "Price",
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Processing...": "Processing...",
|
||||
"Product": "Product",
|
||||
"Product - Tooltip": "Product - Tooltip",
|
||||
"Result": "Result",
|
||||
"Return to Website": "Return to Website",
|
||||
"State": "State",
|
||||
"State - Tooltip": "State - Tooltip",
|
||||
"The payment has failed": "The payment has failed",
|
||||
"The payment is still under processing": "The payment is still under processing",
|
||||
"Type": "Type",
|
||||
"Type - Tooltip": "Type - Tooltip"
|
||||
"Type - Tooltip": "Type - Tooltip",
|
||||
"You have successfully completed the payment": "You have successfully completed the payment",
|
||||
"please wait for a few seconds...": "please wait for a few seconds...",
|
||||
"the current state is": "the current state is"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "Действия",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "Price - Tooltip",
|
||||
"Quantity": "Quantity",
|
||||
"Quantity - Tooltip": "Quantity - Tooltip",
|
||||
"Return URL": "Return URL",
|
||||
"Return URL - Tooltip": "Return URL - Tooltip",
|
||||
"SKU": "SKU",
|
||||
"Sold": "Sold",
|
||||
"Sold - Tooltip": "Sold - Tooltip",
|
||||
|
@ -259,14 +259,23 @@
|
||||
"Currency - Tooltip": "如USD(美元),CNY(人民币)等",
|
||||
"Edit Payment": "编辑付款",
|
||||
"New Payment": "添加付款",
|
||||
"Please click the below button to return to the original website": "请点击下方按钮返回原网站",
|
||||
"Price": "价格",
|
||||
"Price - Tooltip": "商品价格",
|
||||
"Processing...": "正在处理...",
|
||||
"Product": "商品",
|
||||
"Product - Tooltip": "商品名称",
|
||||
"Result": "结果",
|
||||
"Return to Website": "返回原网站",
|
||||
"State": "状态",
|
||||
"State - Tooltip": "交易状态",
|
||||
"The payment has failed": "支付失败",
|
||||
"The payment is still under processing": "支付正在处理",
|
||||
"Type": "支付方式",
|
||||
"Type - Tooltip": "商品购买时的支付方式"
|
||||
"Type - Tooltip": "商品购买时的支付方式",
|
||||
"You have successfully completed the payment": "支付成功",
|
||||
"please wait for a few seconds...": "请稍后...",
|
||||
"the current state is": "当前状态为"
|
||||
},
|
||||
"permission": {
|
||||
"Actions": "动作",
|
||||
@ -301,6 +310,8 @@
|
||||
"Price - Tooltip": "价格 - 工具提示",
|
||||
"Quantity": "库存",
|
||||
"Quantity - Tooltip": "库存 - 工具提示",
|
||||
"Return URL": "返回URL",
|
||||
"Return URL - Tooltip": "返回URL - 工具提示",
|
||||
"SKU": "货号",
|
||||
"Sold": "售出",
|
||||
"Sold - Tooltip": "售出 - 工具提示",
|
||||
|
Loading…
x
Reference in New Issue
Block a user