Added api methods for payments
This commit is contained in:
parent
72ebd235ec
commit
46e9124f81
@ -12,6 +12,10 @@ import ButtonContainer from "./sub-components/button-container";
|
||||
import ContactContainer from "./sub-components/contact-container";
|
||||
import {
|
||||
setLicense /*getPortalCultures*/,
|
||||
getSalesEmail,
|
||||
getHelpUrl,
|
||||
getBuyUrl,
|
||||
getCurrentLicense,
|
||||
} from "../../../store/payments/actions";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import moment from "moment";
|
||||
@ -51,8 +55,17 @@ class Body extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
getSalesEmail,
|
||||
getHelpUrl,
|
||||
getBuyUrl,
|
||||
getCurrentLicense,
|
||||
} = this.props;
|
||||
this.props.currentProductId !== "payments" &&
|
||||
this.props.setCurrentProductId("payments");
|
||||
getSalesEmail();
|
||||
getHelpUrl();
|
||||
getBuyUrl();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
@ -169,4 +182,8 @@ export default connect(mapStateToProps, {
|
||||
setLicense,
|
||||
setCurrentProductId,
|
||||
// getPortalCultures,
|
||||
getSalesEmail,
|
||||
getHelpUrl,
|
||||
getBuyUrl,
|
||||
getCurrentLicense,
|
||||
})(withRouter(PaymentsEnterprise));
|
||||
|
@ -2,8 +2,39 @@ import { api, store } from "asc-web-common";
|
||||
// const { setLicenseUpload } = store.wizard.actions;
|
||||
// const { setIsConfirmLoaded } = store.confirm.actions;
|
||||
import { setLicenseUpload } from "../wizard/actions";
|
||||
import { SET_IS_MACHINE_NAME } from "./actions";
|
||||
const { setTimezones, setPortalCultures } = store.auth.actions;
|
||||
|
||||
export const SET_SALES_EMAIL = "SET_SALES_EMAIL";
|
||||
export const SET_HELP_URL = "SET_HELP_URL";
|
||||
export const SET_BUY_URL = "SET_BUY_URL";
|
||||
export const SET_CURRENT_LICENSE = "SET_CURRENT_LICENSE";
|
||||
export function setSalesEmail(salesEmail) {
|
||||
return {
|
||||
type: SET_SALES_EMAIL,
|
||||
salesEmail,
|
||||
};
|
||||
}
|
||||
export function setHelpUrl(helpUrl) {
|
||||
return {
|
||||
type: SET_HELP_URL,
|
||||
helpUrl,
|
||||
};
|
||||
}
|
||||
export function setBuyUrl(buyUrl) {
|
||||
return {
|
||||
type: SET_BUY_URL,
|
||||
buyUrl,
|
||||
};
|
||||
}
|
||||
|
||||
export function setCurrentLicense(currentLicense) {
|
||||
return {
|
||||
type: SET_CURRENT_LICENSE,
|
||||
currentLicense,
|
||||
};
|
||||
}
|
||||
|
||||
export function setLicense(confirmKey, data) {
|
||||
return (dispatch) => {
|
||||
return api.settings
|
||||
@ -12,18 +43,33 @@ export function setLicense(confirmKey, data) {
|
||||
};
|
||||
}
|
||||
|
||||
// export function getPortalCultures() {
|
||||
// return (dispatch) => {
|
||||
// return api.settings.getPortalCultures().then((cultures) => {
|
||||
// dispatch(setPortalCultures(cultures));
|
||||
// });
|
||||
// };
|
||||
// }
|
||||
export function getSalesEmail() {
|
||||
return (dispatch) => {
|
||||
return api.settings.getPaymentSettings().then((settings) => {
|
||||
dispatch(setSalesEmail(settings.salesEmail));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// export function getPortalTimezones() {
|
||||
// return (dispatch) => {
|
||||
// return api.settings.getPortalTimezones().then((timezones) => {
|
||||
// dispatch(setTimezones(timezones));
|
||||
// });
|
||||
// };
|
||||
// }
|
||||
export function getHelpUrl() {
|
||||
return (dispatch) => {
|
||||
return api.settings.getPaymentSettings().then((settings) => {
|
||||
dispatch(setHelpUrl(settings.feedbackAndSupportUrl));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function getBuyUrl() {
|
||||
return (dispatch) => {
|
||||
return api.settings.getPaymentSettings().then((settings) => {
|
||||
dispatch(setBuyUrl(settings.buyUrl));
|
||||
});
|
||||
};
|
||||
}
|
||||
export function getCurrentLicense() {
|
||||
return (dispatch) => {
|
||||
return api.settings.getPaymentSettings().then((settings) => {
|
||||
dispatch(setCurrentLicense(settings.currentLicense));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
// import {} from "./actions";
|
||||
import {
|
||||
SET_SALES_EMAIL,
|
||||
SET_HELP_URL,
|
||||
SET_BUY_URL,
|
||||
SET_CURRENT_LICENSE,
|
||||
} from "./actions";
|
||||
|
||||
const initialState = {
|
||||
salesEmail: "sales@onlyoffice.com",
|
||||
helpUrl: "https://helpdesk.onlyoffice.com",
|
||||
buyUrl: "http://www.onlyoffice.com/post.ashx?type=buyenterprise",
|
||||
salesEmail: "sgsg",
|
||||
helpUrl: "34",
|
||||
buyUrl: "",
|
||||
standaloneMode: true,
|
||||
currentLicense: {
|
||||
expiresDate: new Date("2021-09-01T23:59:59.000Z"),
|
||||
@ -13,7 +18,26 @@ const initialState = {
|
||||
|
||||
const paymentsReducer = (state = initialState, action) => {
|
||||
switch (action.type) {
|
||||
// case
|
||||
case SET_SALES_EMAIL:
|
||||
return Object.assign({}, state, {
|
||||
salesEmail: action.salesEmail,
|
||||
});
|
||||
case SET_HELP_URL:
|
||||
return Object.assign({}, state, {
|
||||
helpUrl: action.helpUrl,
|
||||
});
|
||||
case SET_BUY_URL:
|
||||
return Object.assign({}, state, {
|
||||
buyUrl: action.buyUrl,
|
||||
});
|
||||
case SET_CURRENT_LICENSE:
|
||||
return Object.assign({}, state, {
|
||||
currentLicense: {
|
||||
...state.currentLicense,
|
||||
expiresDate: action.currentLicense.date,
|
||||
trialMode: action.currentLicense.trial,
|
||||
},
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
@ -1,159 +1,170 @@
|
||||
import { request } from "../client";
|
||||
|
||||
export function getSettings() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/settings.json"
|
||||
});
|
||||
}
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/settings.json"
|
||||
});
|
||||
}
|
||||
|
||||
export function getPortalCultures() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/settings/cultures.json"
|
||||
});
|
||||
}
|
||||
|
||||
export function getPortalPasswordSettings(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/security/password"
|
||||
};
|
||||
export function getPortalCultures() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/settings/cultures.json"
|
||||
});
|
||||
}
|
||||
|
||||
if(confirmKey)
|
||||
options.headers = { confirm: confirmKey };
|
||||
export function getPortalPasswordSettings(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/security/password"
|
||||
};
|
||||
|
||||
return request(options);
|
||||
}
|
||||
if (confirmKey) options.headers = { confirm: confirmKey };
|
||||
|
||||
export function getPortalTimezones(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/timezones.json"
|
||||
};
|
||||
return request(options);
|
||||
}
|
||||
|
||||
if(confirmKey)
|
||||
options.headers = { confirm: confirmKey };
|
||||
export function getPortalTimezones(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/timezones.json"
|
||||
};
|
||||
|
||||
return request(options);
|
||||
}
|
||||
if (confirmKey) options.headers = { confirm: confirmKey };
|
||||
|
||||
export function setLanguageAndTime(lng, timeZoneID) {
|
||||
return request({
|
||||
method: "put",
|
||||
url: "/settings/timeandlanguage.json",
|
||||
data: { lng, timeZoneID }
|
||||
});
|
||||
}
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function setGreetingSettings(title) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/greetingsettings.json`,
|
||||
data: { title }
|
||||
});
|
||||
}
|
||||
|
||||
export function restoreGreetingSettings() {
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/greetingsettings/restore.json`
|
||||
});
|
||||
}
|
||||
|
||||
export function getLogoText() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/logotext.json`
|
||||
});
|
||||
}
|
||||
export function getLogoSizes() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/sizes.json`
|
||||
});
|
||||
}
|
||||
|
||||
export function getLogoUrls() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/logos.json`
|
||||
});
|
||||
}
|
||||
export function setLanguageAndTime(lng, timeZoneID) {
|
||||
return request({
|
||||
method: "put",
|
||||
url: "/settings/timeandlanguage.json",
|
||||
data: { lng, timeZoneID }
|
||||
});
|
||||
}
|
||||
|
||||
export function getCurrentCustomSchema(id) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `settings/customschemas/${id}.json`
|
||||
});
|
||||
}
|
||||
export function setGreetingSettings(title) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/greetingsettings.json`,
|
||||
data: { title }
|
||||
});
|
||||
}
|
||||
|
||||
export function sendRecoverRequest(email, message) {
|
||||
const data = { email, message };
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/sendadmmail`,
|
||||
data
|
||||
});
|
||||
}
|
||||
export function restoreGreetingSettings() {
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/greetingsettings/restore.json`
|
||||
});
|
||||
}
|
||||
|
||||
export function sendRegisterRequest(email) {
|
||||
const data = { email };
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/sendjoininvite`,
|
||||
data
|
||||
});
|
||||
}
|
||||
export function getLogoText() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/logotext.json`
|
||||
});
|
||||
}
|
||||
export function getLogoSizes() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/sizes.json`
|
||||
});
|
||||
}
|
||||
|
||||
export function getMachineName(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/machine.json"
|
||||
};
|
||||
export function getLogoUrls() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/whitelabel/logos.json`
|
||||
});
|
||||
}
|
||||
|
||||
if ( confirmKey )
|
||||
options.headers = { confirm: confirmKey };
|
||||
export function getCurrentCustomSchema(id) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `settings/customschemas/${id}.json`
|
||||
});
|
||||
}
|
||||
|
||||
return request(options);
|
||||
}
|
||||
export function sendRecoverRequest(email, message) {
|
||||
const data = { email, message };
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/sendadmmail`,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export function setPortalOwner( email, pwd, lng, timeZone, confirmKey = null, analytics ) {
|
||||
const options = {
|
||||
method: "put",
|
||||
url: "/settings/wizard/complete.json",
|
||||
data: {
|
||||
email: email,
|
||||
export function sendRegisterRequest(email) {
|
||||
const data = { email };
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/settings/sendjoininvite`,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
export function getMachineName(confirmKey = null) {
|
||||
const options = {
|
||||
method: "get",
|
||||
url: "/settings/machine.json"
|
||||
};
|
||||
|
||||
if (confirmKey) options.headers = { confirm: confirmKey };
|
||||
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function setPortalOwner(
|
||||
email,
|
||||
pwd,
|
||||
lng,
|
||||
timeZone,
|
||||
confirmKey = null,
|
||||
analytics
|
||||
) {
|
||||
const options = {
|
||||
method: "put",
|
||||
url: "/settings/wizard/complete.json",
|
||||
data: {
|
||||
email: email,
|
||||
pwd: pwd,
|
||||
lng: lng,
|
||||
timeZone: timeZone,
|
||||
analytics: analytics
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if ( confirmKey ) {
|
||||
options.headers = { confirm: confirmKey};
|
||||
}
|
||||
return request(options);
|
||||
if (confirmKey) {
|
||||
options.headers = { confirm: confirmKey };
|
||||
}
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getIsLicenseRequired() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/settings/license/required.json"
|
||||
});
|
||||
}
|
||||
|
||||
export function setLicense(confirmKey = null, data) {
|
||||
const options = {
|
||||
method: "post",
|
||||
url: `/settings/license`,
|
||||
data
|
||||
};
|
||||
|
||||
if (confirmKey) {
|
||||
options.headers = { confirm: confirmKey };
|
||||
}
|
||||
|
||||
export function getIsLicenseRequired() {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/settings/license/required.json'
|
||||
})
|
||||
}
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function setLicense(confirmKey = null, data) {
|
||||
const options = {
|
||||
method: "post",
|
||||
url: `/settings/license`,
|
||||
data
|
||||
}
|
||||
|
||||
if ( confirmKey ) {
|
||||
options.headers = { confirm: confirmKey }
|
||||
}
|
||||
|
||||
return request(options);
|
||||
}
|
||||
export function getPaymentSettings() {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/settings/payment.json`
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user