Skip to content

[APAM-563] add Session and modify intent confirm request to support simplifying flow#264

Open
ferdian-airwallex wants to merge 6 commits intofeature/APAM-561from
feature/APAM-563
Open

[APAM-563] add Session and modify intent confirm request to support simplifying flow#264
ferdian-airwallex wants to merge 6 commits intofeature/APAM-561from
feature/APAM-563

Conversation

@ferdian-airwallex
Copy link

everything is just new code but unused. this is the base necessity for the future tasks
note: the destination is APAM-561, which is actually a merged branch between APAM-551-2 and APAM-555
will recreate the APAM-561 branch from develop branch when the previous project is merged

val minPaymentAmount: Double? = null,
/**
* The first payment amount. Optional if payment agreement type is VARIABLE
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Would it be worth using BigDecimal here instead of Double? The rest of the SDK uses BigDecimal for monetary values (e.g. AirwallexSession.amount), and Double can introduce subtle precision issues with financial amounts. This would apply to fixedPaymentAmount, maxPaymentAmount, minPaymentAmount, and firstPaymentAmount.

/**
* The maximum payment amount that can be charged for a single payment.
* Optional if payment_amount_type is VARIABLE
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: paymentAmountType has constrained values (FIXED / VARIABLE) and periodUnit (line 112) has constrained values (DAY / WEEK / MONTH / YEAR). Would it make sense to use typed enums with a .value property here, similar to how NextTriggeredBy and MerchantTriggerReason are defined? That would give us compile-time safety and keep things consistent across the codebase.

private val paymentIntent: PaymentIntent,
private val countryCode: String,
private val googlePayOptions: GooglePayOptions? = null
) : ObjectBuilder<Session> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: I noticed that AirwallexPaymentSession (which the KDoc references as similar) implements PaymentIntentResolvableSession, but Session does not. This means the isExpressCheckout extension property and the PaymentIntentProvider / PaymentIntentSource patterns won't be available for Session instances.

Is this intentional for the simplifying flow? If so, it might be helpful to note that in the KDoc so future readers understand the distinction. Just want to make sure nothing was missed!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I just realized also while actually trying to use the Session in the next ticket. adding it soon!

* For example, period=1 and period_unit=MONTH means monthly billing.
* Required when merchant_trigger_reason = scheduled
*/
val period: Int? = null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PaymentSchedule is not aligned with the API documentation. There should only be period and period_unit according to the api doc. Is this intentional?

Image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol thanks I read it wrong, I thought the start_date & total_billing_cycles are under payment_schedule. I'll move those to TermOfUse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants