Skip to content
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed No image thumbnails leaded on 404 page - @andrzejewsky (#3955)
- Fixed Stock logic not working with manage_stock set to false - @andrzejewsky - (#3957)
- Support old price format in `ProductPrice` - @gibkigonzo (#3978)
- Fixed product bundle comparison condition - @gk-daniel (#4004)
- Fixed product bundle comparison condition - @gk-daniel (#4004)
- Keep registered payment methods after `syncTotals` - @grimasod (#4020)

## [1.11.0] - 2019.12.20

Expand Down
12 changes: 9 additions & 3 deletions core/modules/cart/store/actions/totalsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import * as types from '@vue-storefront/core/modules/cart/store/mutation-types'
import { Logger } from '@vue-storefront/core/lib/logger'
import { CartService } from '@vue-storefront/core/data-resolver'
import {
preparePaymentMethodsToSync,
prepareShippingInfoForUpdateTotals,
createOrderData,
createShippingInfoData
} from '@vue-storefront/core/modules/cart/helpers'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'

const totalsActions = {
async getTotals (context, { addressInformation, hasShippingInformation }) {
Expand All @@ -15,7 +17,7 @@ const totalsActions = {

return CartService.getTotals()
},
async overrideServerTotals ({ commit, getters, dispatch }, { addressInformation, hasShippingInformation }) {
async overrideServerTotals ({ commit, getters, rootGetters, dispatch }, { addressInformation, hasShippingInformation }) {
const { resultCode, result } = await dispatch('getTotals', { addressInformation, hasShippingInformation })

if (resultCode === 200) {
Expand All @@ -34,8 +36,12 @@ const totalsActions = {

// we received payment methods as a result of this call, updating state
if (result.payment_methods && getters.canUpdateMethods) {
const backendPaymentMethods = result.payment_methods.map(method => ({ ...method, is_server_method: true }))
dispatch('checkout/replacePaymentMethods', backendPaymentMethods, { root: true })
const { uniqueBackendMethods, paymentMethods } = preparePaymentMethodsToSync(
result.payment_methods.map(method => ({ ...method, is_server_method: true })),
rootGetters['checkout/getNotServerPaymentMethods']
)
dispatch('checkout/replacePaymentMethods', paymentMethods, { root: true })
EventBus.$emit('set-unique-payment-methods', uniqueBackendMethods)
}

return
Expand Down