Untitled
unknown
plain_text
20 days ago
2.7 kB
4
Indexable
fun completeWithMasterPass( masterPassInfoPurchase: MasterPassInfoPurchase? = null, threeDSecure: Boolean = false ) = viewModelScope.launch { _loadingFlow.emit(true) launch pay@{ masterPassInfoPurchase?.let { val placeOrder = PlaceOrder( cartId = LoginConstant.CART_CODE, paymentDetails = PaymentDetails( installmentCount = selectedInstallments?.count.toString(), masterPassInfo = masterPassInfoPurchase, paymentModeOption = PaymentModeOption(code = PaymentType.MASTERPASS_GLOBAL.code), appliedGiftCard = cart?.appliedGiftCard, appliedGiftCardTotalPrice = if ((cart?.appliedGiftCardTotalPrice?.value ?: 0.0) > 0 ) cart?.appliedGiftCardTotalPrice?.value else null ), threeDSecure = threeDSecure ) completeWithPlaceOrder(placeOrder) return@pay } sendPaymentInfoEvent(paymentMethod = "masterpass") masterPassInitPurchaseFromService().onSuccess { masterPassAccount -> MasterPassInfo.setMacroMerchantId(masterPassAccount?.macroMerchantId) purchaseFromMasterPassService(masterPassAccount).onSuccess { if (it == null) return@pay val newMasterPassInfoPurchase = MasterPassInfoPurchase( msisdn = LoginConstant.USER_ID, transactionId = it.refNo, token = it.token, cardUniqueId = "" ) val placeOrder = PlaceOrder( cartId = LoginConstant.CART_CODE, paymentDetails = PaymentDetails( installmentCount = selectedInstallments?.count.toString(), masterPassInfo = newMasterPassInfoPurchase, paymentModeOption = PaymentModeOption(code = PaymentType.MASTERPASS_GLOBAL.code), appliedGiftCard = cart?.appliedGiftCard, appliedGiftCardTotalPrice = if ((cart?.appliedGiftCardTotalPrice?.value ?: 0.0) > 0 ) cart?.appliedGiftCardTotalPrice?.value else null ), threeDSecure = threeDSecure ) completeWithPlaceOrder(placeOrder) } } }.join() }
Editor is loading...
Leave a Comment