-
Notifications
You must be signed in to change notification settings - Fork 9
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 #323 from Adyen/feature/addIdealComponent
Added support of iDEAL to the Instant Component.
- Loading branch information
Showing
8 changed files
with
237 additions
and
28 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
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
37 changes: 37 additions & 0 deletions
37
.../com/adyen/checkout/flutter/components/instant/advanced/IdealComponentAdvancedCallback.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,37 @@ | ||
package com.adyen.checkout.flutter.components.instant.advanced | ||
|
||
import ComponentCommunicationModel | ||
import ComponentFlutterInterface | ||
import com.adyen.checkout.components.core.ComponentError | ||
import com.adyen.checkout.components.core.PaymentComponentData | ||
import com.adyen.checkout.flutter.components.base.ComponentAdvancedCallback | ||
import com.adyen.checkout.flutter.utils.Constants | ||
import com.adyen.checkout.ideal.IdealComponentState | ||
import org.json.JSONObject | ||
|
||
class IdealComponentAdvancedCallback( | ||
private val componentFlutterApi: ComponentFlutterInterface, | ||
private val componentId: String, | ||
private val hideLoadingBottomSheet: () -> Unit, | ||
) : ComponentAdvancedCallback<IdealComponentState>(componentFlutterApi, componentId) { | ||
override fun onSubmit(state: IdealComponentState) { | ||
val data = PaymentComponentData.SERIALIZER.serialize(state.data) | ||
val submitData = | ||
JSONObject().apply { | ||
put(Constants.ADVANCED_PAYMENT_DATA_KEY, data) | ||
put(Constants.ADVANCED_EXTRA_DATA_KEY, null) | ||
} | ||
val model = | ||
ComponentCommunicationModel( | ||
ComponentCommunicationType.ONSUBMIT, | ||
componentId = componentId, | ||
data = submitData.toString(), | ||
) | ||
componentFlutterApi.onComponentCommunication(model) {} | ||
} | ||
|
||
override fun onError(componentError: ComponentError) { | ||
hideLoadingBottomSheet() | ||
super.onError(componentError) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...in/com/adyen/checkout/flutter/components/instant/session/IdealComponentSessionCallback.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,25 @@ | ||
package com.adyen.checkout.flutter.components.instant.session | ||
|
||
import ComponentFlutterInterface | ||
import com.adyen.checkout.components.core.ComponentError | ||
import com.adyen.checkout.components.core.action.Action | ||
import com.adyen.checkout.flutter.components.base.ComponentSessionCallback | ||
import com.adyen.checkout.ideal.IdealComponentState | ||
import com.adyen.checkout.sessions.core.SessionPaymentResult | ||
|
||
class IdealComponentSessionCallback( | ||
private val componentFlutterApi: ComponentFlutterInterface, | ||
private val componentId: String, | ||
private val onActionCallback: (Action) -> Unit, | ||
private val hideLoadingBottomSheet: () -> Unit, | ||
) : ComponentSessionCallback<IdealComponentState>(componentFlutterApi, componentId, onActionCallback) { | ||
override fun onError(componentError: ComponentError) { | ||
hideLoadingBottomSheet() | ||
super.onError(componentError) | ||
} | ||
|
||
override fun onFinished(result: SessionPaymentResult) { | ||
hideLoadingBottomSheet() | ||
super.onFinished(result) | ||
} | ||
} |
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
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
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
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