diff --git a/.auditrc b/.auditrc index c37bf8c1..3fa278e1 100644 --- a/.auditrc +++ b/.auditrc @@ -2,6 +2,4 @@ exports.exceptions = [ // Add exceptions to audit script: // // Severity: low, lodash (< 4.17.5), used heavily in our CRA fork // "https://npmjs.com/advisories/577", - // Temporarily skip warning about axios until SDK is updated - "https://npmjs.com/advisories/880", ]; diff --git a/CHANGELOG.md b/CHANGELOG.md index 70e3f22f..22c1b4cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,15 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX +- [fix] `stripeCardToken` didn't update when the user tried to book the same listing for a second + time. This update will clear the old cardtoken from Redux store when redirecting to + `TransactionPage`. [#1114](https://github.com/sharetribe/flex-template-web/pull/1114) - [fix] In `LineItemProviderCommissionMaybe.js` file check that `providerCommissionLineItem` exists. In default transaction process the `providerCommissionLineItem` can be expected to be there but if the process is using only customer commission there will be error. [#1112](https://github.com/sharetribe/flex-template-web/pull/1112) -- [security] Update Flex SDK version to v1.4.1. The new version updates depencencies with security issues - [#1111](https://github.com/sharetribe/flex-template-web/pull/1111) +- [security] Update Flex SDK version to v1.4.1. The new version updates depencencies with security + issues [#1111](https://github.com/sharetribe/flex-template-web/pull/1111) - [fix] Fix a bug in showing review links. Because of the bug the second review link was not visible in `ActivityFeed`. [#1106](https://github.com/sharetribe/flex-template-web/pull/1106) - [fix] Emptying the priceFilter component in the searchPage caused a page breaking error. diff --git a/src/containers/CheckoutPage/CheckoutPage.js b/src/containers/CheckoutPage/CheckoutPage.js index 3ce296d8..680f9faf 100644 --- a/src/containers/CheckoutPage/CheckoutPage.js +++ b/src/containers/CheckoutPage/CheckoutPage.js @@ -38,7 +38,7 @@ import { setInitialValues, speculateTransaction, } from './CheckoutPage.duck'; -import { createStripePaymentToken } from '../../ducks/stripe.duck.js'; +import { createStripePaymentToken, clearStripePaymentToken } from '../../ducks/stripe.duck.js'; import config from '../../config'; import { storeData, storedData, clearData } from './CheckoutPageSessionHelpers'; @@ -152,6 +152,7 @@ export class CheckoutPageComponent extends Component { sendOrderRequest, sendOrderRequestAfterEnquiry, speculatedTransaction, + onClearStripePaymentToken, dispatch, } = this.props; @@ -190,6 +191,7 @@ export class CheckoutPageComponent extends Component { const orderDetailsPath = pathByRouteName('OrderDetailsPage', routes, { id: orderId.uuid, }); + onClearStripePaymentToken(); clearData(STORAGE_KEY); history.push(orderDetailsPath); }) @@ -606,6 +608,7 @@ const mapDispatchToProps = dispatch => ({ dispatch(initiateOrderAfterEnquiry(transactionId, params)), fetchSpeculatedTransaction: params => dispatch(speculateTransaction(params)), onCreateStripePaymentToken: params => dispatch(createStripePaymentToken(params)), + onClearStripePaymentToken: () => dispatch(clearStripePaymentToken()), }); const CheckoutPage = compose( diff --git a/src/ducks/stripe.duck.js b/src/ducks/stripe.duck.js index 1a7716a0..b158807c 100644 --- a/src/ducks/stripe.duck.js +++ b/src/ducks/stripe.duck.js @@ -22,6 +22,8 @@ export const CREATE_PAYMENT_TOKEN_REQUEST = 'app/stripe/CREATE_PAYMENT_TOKEN_REQ export const CREATE_PAYMENT_TOKEN_SUCCESS = 'app/stripe/CREATE_PAYMENT_TOKEN_SUCCESS'; export const CREATE_PAYMENT_TOKEN_ERROR = 'app/stripe/CREATE_PAYMENT_TOKEN_ERROR'; +export const CLEAR_PAYMENT_TOKEN = 'app/stripe/CLEAR_PAYMENT_TOKEN'; + // ================ Reducer ================ // const initialState = { @@ -112,6 +114,8 @@ export default function reducer(state = initialState, action = {}) { case CREATE_PAYMENT_TOKEN_ERROR: console.error(payload); return { ...state, stripePaymentTokenError: payload, stripePaymentTokenInProgress: false }; + case CLEAR_PAYMENT_TOKEN: + return { ...state, stripePaymentToken: null }; default: return state; @@ -184,6 +188,10 @@ export const createPaymentTokenError = payload => ({ error: true, }); +export const clearPaymentToken = () => ({ + type: CLEAR_PAYMENT_TOKEN, +}); + // ================ Thunks ================ // // Util: rename address fields to match Stripe API specifications @@ -515,3 +523,7 @@ export const createStripePaymentToken = params => dispatch => { throw e; }); }; + +export const clearStripePaymentToken = () => dispatch => { + dispatch(clearPaymentToken()); +};