any platform. • One of our apps has multiple payment gateways. Users can make the payment with any gateway. • After the payment gateway auth, there will go to the business logic.
in app. - At this time, it’s easy to maintain state like success, failure, retry - Later, we decided to add another payment gateways, In this time, we have a problem about state management. - Maintaining different flows for each gateway will drain the code management system. - So let’s create a flow that works uniquely for all gateways.
hierarchies, when a value can have one of the types from a limited set, but cannot have any other type. They are, in a sense, an extension of enum classes: the set of values for an enum type is also restricted, but each enum constant exists only as a single instance, whereas a subclass of a sealed class can have multiple instances which can contain state.”
is PrchaseResult.GoogplayBilling.Fail -> { } is PrchaseResult.GoogplayBilling.Retry -> { } is PrchaseResult.GoogplayBilling.PurchaseAcknowledgement.Sucess - is PrchaseResult.GoogplayBilling.PurchaseAcknowledgement.Fail -> // PayYouMoney Billing related is PrchaseResult.PayYouMoney.Sucess -> { } is PrchaseResult.PayYouMoney.Fail -> { } is PrchaseResult.PayYouMoney.Retry -> { } is PrchaseResult.PayYouMoney.PurchaseAcknowledgement.Sucess -> { is PrchaseResult.PayYouMoney.PurchaseAcknowledgement.Fail -> { } // Stripe Billing related is PrchaseResult.Stripe.Sucess -> { } is PrchaseResult.Stripe.Fail -> { } is PrchaseResult.Stripe.Retry -> { } is PrchaseResult.Stripe.PurchaseAcknowledgement.Sucess -> { } is PrchaseResult.Stripe.PurchaseAcknowledgement.Fail -> { } }