Skip to content

Commit

Permalink
update payment intent for card pre authorization - setup off session …
Browse files Browse the repository at this point in the history
…future usage
  • Loading branch information
fupelaqu committed Sep 6, 2024
1 parent 04a4288 commit cbab679
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,11 @@ trait CardCommandHandler
.orElse(
internalClientId
)
log.info(s"pay in with card pre authorized: $entityId -> ${asJson(cmd)}")
val maybeTransaction = paymentAccount.transactions
.filter(t => t.`type` == Transaction.TransactionType.PRE_AUTHORIZATION)
.filter(t =>
t.`type` == Transaction.TransactionType.PRE_AUTHORIZATION
) //TODO check it
.find(_.id == preAuthorizationId)
maybeTransaction match {
case None =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ trait StripeCardApi extends CardApi { _: StripeContext =>
s"${config.preAuthorizeCardReturnUrl}/${preAuthorizationTransaction.orderUuid}?preAuthorizationIdParameter=payment_intent&registerCard=${preAuthorizationTransaction.registerCard
.getOrElse(false)}&printReceipt=${preAuthorizationTransaction.printReceipt.getOrElse(false)}"
)
.setSetupFutureUsage(
PaymentIntentCreateParams.SetupFutureUsage.OFF_SESSION
) // For off-session payments
.setTransferGroup(preAuthorizationTransaction.orderUuid)
.putMetadata("order_uuid", preAuthorizationTransaction.orderUuid)
.putMetadata("transaction_type", "pre_authorization")
Expand Down Expand Up @@ -318,7 +321,7 @@ trait StripeCardApi extends CardApi { _: StripeContext =>

status match {
case "requires_action"
if paymentIntent.getNextAction.getType == "redirect_to_url" && mayRequired3DS =>
if paymentIntent.getNextAction.getType == "redirect_to_url" /*&& mayRequired3DS*/ =>
transaction = transaction.copy(
status = Transaction.TransactionStatus.TRANSACTION_CREATED,
//The URL you must redirect your customer to in order to authenticate the payment.
Expand Down

0 comments on commit cbab679

Please sign in to comment.