-
Notifications
You must be signed in to change notification settings - Fork 1
PIMOB: 2109: Allow injection of cardholder name field in paymentformConfig #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chintan-soni-cko
merged 2 commits into
master
from
feature/PIMOB-2109_allow_injection_cardholdername_in_paymentformconfig
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
16 changes: 0 additions & 16 deletions
16
frames/src/main/java/com/checkout/frames/screen/paymentform/PaymentFormConfig.kt
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package com.checkout.frames.screen.paymentform | ||
|
|
||
| import android.content.Context | ||
| import androidx.annotation.VisibleForTesting | ||
| import androidx.lifecycle.ViewModel | ||
| import androidx.lifecycle.ViewModelProvider | ||
| import com.checkout.base.model.CardScheme | ||
|
|
@@ -9,6 +10,7 @@ import com.checkout.frames.di.base.InjectionClient | |
| import com.checkout.frames.di.base.Injector | ||
| import com.checkout.frames.di.injector.FramesInjector | ||
| import com.checkout.frames.api.PaymentFlowHandler | ||
| import com.checkout.frames.screen.paymentform.model.PrefillData | ||
| import javax.inject.Inject | ||
|
|
||
| internal class PaymentFormViewModel @Inject internal constructor() : ViewModel() { | ||
|
|
@@ -20,19 +22,20 @@ internal class PaymentFormViewModel @Inject internal constructor() : ViewModel() | |
| private val context: Context, | ||
| private val environment: Environment, | ||
| private val paymentFlowHandler: PaymentFlowHandler, | ||
| private val supportedCardSchemes: List<CardScheme> = emptyList() | ||
| private val supportedCardSchemes: List<CardScheme> = emptyList(), | ||
| private val prefillData: PrefillData? = null | ||
| ) : ViewModelProvider.Factory, InjectionClient { | ||
|
|
||
| @Inject | ||
| lateinit var viewModel: PaymentFormViewModel | ||
|
|
||
| private lateinit var injector: Injector | ||
| @VisibleForTesting | ||
| lateinit var injector: Injector | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make it |
||
|
|
||
| @Suppress("UNCHECKED_CAST") | ||
| override fun <T : ViewModel> create(modelClass: Class<T>): T { | ||
| injector = FramesInjector.create( | ||
| publicKey, context, environment, | ||
| paymentFlowHandler, supportedCardSchemes | ||
| publicKey, context, environment, paymentFlowHandler, supportedCardSchemes, prefillData | ||
| ) | ||
|
|
||
| injector.inject(this) | ||
|
|
||
15 changes: 15 additions & 0 deletions
15
frames/src/main/java/com/checkout/frames/screen/paymentform/model/BillingFormAddress.kt
This file contains hidden or 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,15 @@ | ||
| package com.checkout.frames.screen.paymentform.model | ||
|
|
||
| import com.checkout.tokenization.model.Address | ||
| import com.checkout.tokenization.model.Phone | ||
|
|
||
| /** | ||
| * @param name - represent the cardHolderName in Billing form | ||
| * @param address - [Address] represent the payment source owner's billing address in Billing form | ||
| * @param phone - [Phone] represent the payment source owner's billing phone in Billing form | ||
| */ | ||
| public data class BillingFormAddress @JvmOverloads constructor( | ||
| val name: String? = null, | ||
| val address: Address? = null, | ||
| val phone: Phone? = null, | ||
| ) |
26 changes: 26 additions & 0 deletions
26
frames/src/main/java/com/checkout/frames/screen/paymentform/model/PaymentFormConfig.kt
This file contains hidden or 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,26 @@ | ||
| package com.checkout.frames.screen.paymentform.model | ||
|
|
||
| import android.content.Context | ||
| import com.checkout.base.model.CardScheme | ||
| import com.checkout.base.model.Environment | ||
| import com.checkout.frames.style.screen.PaymentFormStyle | ||
| import com.checkout.frames.api.PaymentFlowHandler | ||
|
|
||
| /** | ||
| * @param publicKey - used for client-side authentication in the SDK | ||
| * @param context - represent the application context | ||
| * @param environment - [Environment] represent the environment for tokenization | ||
| * @param style - [PaymentFormStyle] represent the style for PaymentForm | ||
| * @param paymentFlowHandler - [PaymentFlowHandler] represent the handler for PaymentForm | ||
| * @param supportedCardSchemeList - represent the supported card schemes [CardScheme] in PaymentForm | ||
| * @param prefillData - [PrefillData] represent the data for prefill in the PaymentForm | ||
| */ | ||
| public data class PaymentFormConfig @JvmOverloads constructor( | ||
| public val publicKey: String, | ||
| public val context: Context, | ||
| public val environment: Environment, | ||
| public var style: PaymentFormStyle, | ||
| public val paymentFlowHandler: PaymentFlowHandler, | ||
| public var supportedCardSchemeList: List<CardScheme> = emptyList(), | ||
| public val prefillData: PrefillData? = null | ||
| ) |
10 changes: 10 additions & 0 deletions
10
frames/src/main/java/com/checkout/frames/screen/paymentform/model/PrefillData.kt
This file contains hidden or 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,10 @@ | ||
| package com.checkout.frames.screen.paymentform.model | ||
|
|
||
| /** | ||
| * @param cardHolderName - represent the cardHolderName in PaymentDetail form | ||
| * @param billingFormAddress - [BillingFormAddress] represent the payment source owner's full billing address | ||
| */ | ||
| public data class PrefillData @JvmOverloads constructor( | ||
| public val cardHolderName: String? = null, | ||
| public val billingFormAddress: BillingFormAddress? = null | ||
| ) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.