Skip to content
Open
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
112 changes: 59 additions & 53 deletions src/actions/ticket-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
EXPORT_PAGE_SIZE_100,
TEN
} from "../utils/constants";
import { snackbarErrorHandler, snackbarSuccessHandler } from "./base-actions";

export const REQUEST_TICKETS = "REQUEST_TICKETS";
export const RECEIVE_TICKETS = "RECEIVE_TICKETS";
Expand Down Expand Up @@ -1186,6 +1187,7 @@ export const deleteRefundPolicy =

export const getPaymentProfiles =
(
term = "",
page = DEFAULT_CURRENT_PAGE,
perPage = DEFAULT_PER_PAGE,
order = "id",
Expand All @@ -1195,6 +1197,7 @@ export const getPaymentProfiles =
const { currentSummitState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
const filter = [];

dispatch(startLoading());

Expand All @@ -1204,19 +1207,30 @@ export const getPaymentProfiles =
access_token: accessToken
};

if (term) {
const escapedTerm = escapeFilterValue(term);
filter.push(
`provider=@${escapedTerm},id=@${escapedTerm},application_type=@${escapedTerm}`
);
}

// order
if (order != null && orderDir != null) {
const orderDirSign = orderDir === DEFAULT_ORDER_DIR ? "+" : "-";
params.order = `${orderDirSign}${order}`;
}

if (filter.length > 0) {
params["filter[]"] = filter;
}

return getRequest(
createAction(REQUEST_PAYMENT_PROFILES),
createAction(RECEIVE_PAYMENT_PROFILES),

`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles`,
authErrorHandler,
{ page, perPage, order, orderDir }
snackbarErrorHandler,
{ term, page, perPage, order, orderDir }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand All @@ -1232,41 +1246,34 @@ export const savePaymentProfile = (entity) => async (dispatch, getState) => {
};

if (entity.id) {
putRequest(
return putRequest(
createAction(UPDATE_PAYMENT_PROFILE),
createAction(PAYMENT_PROFILE_UPDATED),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${entity.id}`,
entity,
authErrorHandler,
snackbarErrorHandler,
entity
)(params)(dispatch).then(() => {
dispatch(
showSuccessMessage(
T.translate("edit_payment_profile.payment_profile_saved")
)
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("edit_payment_profile.payment_profile_saved")
})
);
});
return;
}

const success_message = {
title: T.translate("general.done"),
html: T.translate("edit_payment_profile.payment_profile_created"),
type: "success"
};

postRequest(
return postRequest(
createAction(UPDATE_PAYMENT_PROFILE),
createAction(PAYMENT_PROFILE_ADDED),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles`,
entity,
authErrorHandler
)(params)(dispatch).then((payload) => {
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(
showMessage(success_message, () => {
history.push(
`/app/summits/${currentSummit.id}/payment-profiles/${payload.response.id}`
);
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("edit_payment_profile.payment_profile_created")
})
);
});
Expand All @@ -1287,7 +1294,7 @@ export const deletePaymentProfile =
createAction(PAYMENT_PROFILE_DELETED)({ paymentProfileId }),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}`,
null,
authErrorHandler
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand All @@ -1309,7 +1316,7 @@ export const getPaymentProfile =
null,
createAction(RECEIVE_PAYMENT_PROFILE),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}`,
authErrorHandler
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down Expand Up @@ -1347,7 +1354,7 @@ export const getPaymentFeeTypes =
createAction(RECEIVE_PAYMENT_FEE_TYPES),

`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}/fee-types`,
authErrorHandler,
snackbarErrorHandler,
{ page, perPage, order, orderDir }
)(params)(dispatch).then(() => {
dispatch(stopLoading());
Expand All @@ -1366,45 +1373,44 @@ export const savePaymentFeeType = (entity) => async (dispatch, getState) => {
access_token: accessToken
};

dispatch(startLoading());

if (entity.id) {
putRequest(
return putRequest(
createAction(UPDATE_PAYMENT_FEE_TYPE),
createAction(PAYMENT_FEE_TYPE_UPDATED),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}/fee-types/${entity.id}`,
entity,
authErrorHandler,
snackbarErrorHandler,
entity
)(params)(dispatch).then(() => {
dispatch(
showSuccessMessage(
T.translate("edit_payment_fee_type.payment_fee_type_saved")
)
);
});
return;
)(params)(dispatch)
.then(() => {
dispatch(
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("edit_payment_fee_type.payment_fee_type_saved")
})
);
})
.finally(() => dispatch(stopLoading()));
}

const success_message = {
title: T.translate("general.done"),
html: T.translate("edit_payment_fee_type.payment_fee_type_created"),
type: "success"
};

postRequest(
return postRequest(
createAction(UPDATE_PAYMENT_FEE_TYPE),
createAction(PAYMENT_FEE_TYPE_ADDED),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}/fee-types`,
entity,
authErrorHandler
)(params)(dispatch).then(() => {
dispatch(
showMessage(success_message, () => {
history.push(
`/app/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}`
);
})
);
});
snackbarErrorHandler
)(params)(dispatch)
.then(() => {
dispatch(
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("edit_payment_fee_type.payment_fee_type_created")
})
);
})
.finally(() => dispatch(stopLoading()));
};

export const deletePaymentFeeType =
Expand All @@ -1425,7 +1431,7 @@ export const deletePaymentFeeType =
createAction(PAYMENT_FEE_TYPE_DELETED)({ paymentFeeTypeId }),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}/fee-types/${paymentFeeTypeId}`,
null,
authErrorHandler
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand All @@ -1450,7 +1456,7 @@ export const getPaymentFeeType =
null,
createAction(RECEIVE_PAYMENT_FEE_TYPE),
`${window.PURCHASES_API_URL}/api/v1/summits/${currentSummit.id}/payment-profiles/${paymentProfileId}/fee-types/${paymentFeeTypeId}`,
authErrorHandler
snackbarErrorHandler
)(params)(dispatch).then(() => {
dispatch(stopLoading());
});
Expand Down
8 changes: 7 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1922,9 +1922,13 @@
"active": "Is Active?",
"payment_profiles_list": "Payment Profiles List",
"payment_profiles": "Payment Profiles",
"payment_profile": "Payment Profile",
"add_payment_profile": "Add Payment Profile",
"no_payment_profiles": "No Payment Profiles found for current search criteria.",
"remove_warning": "Are you sure you want to delete this Payment Profile?"
"remove_warning": "Are you sure you want to delete profile #{name}",
"placeholders": {
"search_profiles": "Search payment profiles"
}
},
"edit_payment_profile": {
"payment_profile": "Payment Profile",
Expand All @@ -1944,7 +1948,9 @@
"send_email_receipt": "Send Stripe Email receipt?",
"merchant_account_id": "Merchant Account Id",
"payment_type_fee": "Payment Type Fee",
"payment_type_fees": "Payment Type Fees",
"new_fee_type": "Add New Fee Type",
"save_fee_type": "Save Fee Type",
"payment_type_fee_name": "Name",
"payment_type_fee_kind": "Kind",
"payment_type_fee_method": "Method",
Expand Down
29 changes: 1 addition & 28 deletions src/layouts/payment-profile-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import T from "i18n-react/dist/i18n-react";
import { Breadcrumb } from "react-breadcrumbs";
import Restrict from "../routes/restrict";

import PaymentProfileListPage from "../pages/tickets/payment-profile-list-page";
import EditPaymentProfilePage from "../pages/tickets/edit-payment-profile-page";
import PaymentProfileListPage from "../pages/tickets/payment-profile/payment-profile-list-page";
import NoMatchPage from "../pages/no-match-page";
import EditPaymentFeeTypePage from "../pages/tickets/edit-payment-fee-type-page";

const PaymentProfileLayout = ({ match }) => (
<div>
Expand All @@ -32,31 +30,6 @@ const PaymentProfileLayout = ({ match }) => (
/>
<Switch>
<Route strict exact path={match.url} component={PaymentProfileListPage} />
<Route
strict
exact
path={`${match.url}/new`}
component={EditPaymentProfilePage}
/>
<Route
strict
exact
path={`${match.url}/:payment_profile_id(\\d+)`}
component={EditPaymentProfilePage}
/>
<Route
strict
exact
path={`${match.url}/:payment_profile_id(\\d+)/payment-fee-type/new`}
component={EditPaymentFeeTypePage}
/>
<Route
strict
exact
path={`${match.url}/:payment_profile_id(\\d+)/payment-fee-type/:payment_fee_type_id(\\d+)`}
component={EditPaymentFeeTypePage}
/>

<Route component={NoMatchPage} />
</Switch>
</div>
Expand Down
81 changes: 0 additions & 81 deletions src/pages/tickets/edit-payment-fee-type-page.js

This file was deleted.

Loading
Loading