-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10732 from woocommerce/issue/10721-blaze-payment-…
…summary [Blaze] Payment summary screen
- Loading branch information
Showing
21 changed files
with
664 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
WooCommerce/src/main/kotlin/com/woocommerce/android/model/CreditCardType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.woocommerce.android.model | ||
|
||
import androidx.annotation.DrawableRes | ||
import com.woocommerce.android.R | ||
|
||
enum class CreditCardType { | ||
VISA, | ||
MASTERCARD, | ||
UNIONPAY, | ||
JCB, | ||
DISCOVER, | ||
DINERS, | ||
AMEX, | ||
UNKNOWN; | ||
|
||
val icon: Int | ||
@DrawableRes | ||
get() = when (this) { | ||
VISA -> R.drawable.credit_card_visa | ||
MASTERCARD -> R.drawable.credit_card_mastercard | ||
UNIONPAY -> R.drawable.credit_card_unionpay | ||
JCB -> R.drawable.credit_card_jcb | ||
DISCOVER -> R.drawable.credit_card_discover | ||
DINERS -> R.drawable.credit_card_diners | ||
AMEX -> R.drawable.credit_card_amex | ||
UNKNOWN -> R.drawable.credit_card_placeholder | ||
} | ||
|
||
companion object { | ||
fun fromString(string: String): CreditCardType { | ||
return when (string.lowercase()) { | ||
"visa" -> VISA | ||
"mastercard" -> MASTERCARD | ||
"unionpay" -> UNIONPAY | ||
"jcb" -> JCB | ||
"discover" -> DISCOVER | ||
"diners" -> DINERS | ||
"amex" -> AMEX | ||
else -> UNKNOWN | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
.../com/woocommerce/android/ui/blaze/creation/payment/BlazeCampaignPaymentSummaryFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.woocommerce.android.ui.blaze.creation.payment | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.viewModels | ||
import androidx.navigation.fragment.findNavController | ||
import com.woocommerce.android.ui.base.BaseFragment | ||
import com.woocommerce.android.ui.compose.composeView | ||
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground | ||
import com.woocommerce.android.ui.main.AppBarStatus | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class BlazeCampaignPaymentSummaryFragment : BaseFragment() { | ||
override val activityAppBarStatus: AppBarStatus | ||
get() = AppBarStatus.Hidden | ||
|
||
private val viewModel: BlazeCampaignPaymentSummaryViewModel by viewModels() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
return composeView { | ||
WooThemeWithBackground { | ||
BlazeCampaignPaymentSummaryScreen(viewModel) | ||
} | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
handleEvents() | ||
} | ||
|
||
private fun handleEvents() { | ||
viewModel.event.observe(viewLifecycleOwner) { event -> | ||
when (event) { | ||
MultiLiveEvent.Event.Exit -> findNavController().navigateUp() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.