Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mitchtabian/e0e47cdde8e74fcfb27a052627a9bce0 to your computer and use it in GitHub Desktop.
Save mitchtabian/e0e47cdde8e74fcfb27a052627a9bce0 to your computer and use it in GitHub Desktop.
override fun create(
workingItem: WorkingItem,
cartId: String?,
transactionInfo: TransactionInfo
): ItemConfigurationFlowHandlerReadWrite {
check(!workingItem.isItemPartOfCombo) {
"Use 'createForItemInCombo' for items that are part of a combo."
}
workingItem.lockConfiguration = transactionInfo.isItemLocked
workingItem.selectedVariation = getDefaultVariationIfNeeded(
variations = workingItem.sellableVariations,
skipConfigureItemDetailScreenSetting = workingItem.skipConfigureItemDetailScreenSetting,
currentSelectedVariation = workingItem.selectedVariation,
checkDefaultVariationAvailability = features.latest(SHOW_ITEM_COUNT_ON_TILES).value,
)
// Only set seating, course or quantity if we are not editing an item already in the cart.
if (cartId == null) {
workingItem.maybeOverrideQuantity()
workingItem.maybeSetSeating()
workingItem.maybeSelectCourse(
isStraightFire = workingItem.isStraightFireItem,
sortType = cartLayoutRepository.selectedCartSortType
)
}
val cartItem = workingItem.finish()
val (index, _) = transaction.findItemAndIndex(cartId!!)
val configureItemState = ConfigureOrderItemState.loadedOrderItemState(
voidCompSettings,
configureItemHost,
currencyCode,
index,
orderItemBundleKey,
cartItem
)
return createV2(
configureItemState = configureItemState,
transactionInfo = transactionInfo,
shouldSkipVariationStep = false,
priceAdjustmentAmountsForCombo = emptyMap(),
allowSeatChangesPostFire = itemConfigFlowFlags.canReassignSeatsPostFire,
cartIdForItemWithAppliedCombo = null,
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment