-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(router): Payment link api contract change #2975
Conversation
…/juspay/hyperswitch into payment-link-api-contract-change
let merchant_surcharge_configs = | ||
if let Some((attempt, payment_intent)) = payment_attempt.as_ref().zip(payment_intent) { | ||
if let Some((payment_attempt, payment_intent, business_profile)) = | ||
combine_options!(payment_attempt_ref, payment_intent, business_profile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this what zip does?
You can do something like
combine_options!(payment_attempt_ref, payment_intent, business_profile) | |
payment_attempt_ref.zip(payment_intent).zip(business_profile).map(|(a,b),c| (a,b,c)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when it comes to zipping 3 or more options, we would need to make use of nested tuples. With this macro, only single tuple is needed. looks cleaner.
With zip: if let Some(((value1, value2), value3)) = opt1.zip(opt2).zip(opt3)
.
With combine_options: if let Some((value1, value2, value3)) = combine_options!(opt1, opt2, opt3)
.find_payment_link_by_payment_link_id(&payment_link_id) | ||
.await | ||
.to_not_found_response(errors::ApiErrorResponse::PaymentLinkNotFound)?; | ||
|
||
let status = check_payment_link_status(payment_link_object.fulfilment_time); | ||
let status = check_payment_link_status(payment_link_config.fulfilment_time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this is none, use unwrap_or
and then pass the default value. I see that session_expiry
is being already calculated below, use the same value instead of checking this.
}; | ||
|
||
let theme = payment_create_link_config | ||
.clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use as_ref
here and then clone the inner value. You can do the same for a lot of clones below. Fight the compiler
let business_profile = if let Some(business_profile) = | ||
core_utils::validate_and_get_business_profile( | ||
db, | ||
request.profile_id.as_ref(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass Some(profile_id)
…/juspay/hyperswitch into payment-link-api-contract-change
* 'main' of github.com:juspay/hyperswitch: feat(pm_list): add required fields for Ideal (#3183) refactor: pass customer object to `make_pm_data` (#3246) feat(Connector): [VOLT] Add support for Payments Webhooks (#3155) fix(users): Added merchant name is list merchants (#3289) fix(outgoingwebhookevents): Throw an error when outgoing webhook events env var not found (#3291) fix(wasm): fix failing `wasm-pack build` for `euclid_wasm` (#3284) ci: add workflow to create stable SemVer tag for a given CalVer tag (#3285) fix(connector): [BOA, Cybersource] capture error_code (#3239) fix(connector): [BOA/CYB] Fix Metadata Error (#3283) chore(version): 2024.01.08.0 fix: introduce net_amount field in payment response (#3115) ci(postman): Adyen assertion fix for expired card test case (#3279) feat(connector): Add Revoke mandate flow (#3261) refactor(drainer): change logic for trimming the stream and refactor for modularity (#3128) fix(router): Payment link api contract change (#2975) feat(pm_list): add required fields for eps (#3169) refactor(api_lock): allow api lock on psync only when force sync is true (#3242) fix(router): multiple incremental_authorizations with kv enabled (#3185) feat(payments): add payment id in all the payment logs (#3142) ci: add reusable workflow to create nightly tags in CalVer format (#3247)
Type of Change
Description
Changed payment link api-contract to more optimised api-contract for merchants to use.
From
To
Additional Changes
Motivation and Context
How did you test it?
Test Case
Checklist
cargo +nightly fmt --all
cargo clippy