Skip to content

Commit

Permalink
LPD-40881 Enable virtual items with no shipping address to be process…
Browse files Browse the repository at this point in the history
…ed via Stripe
  • Loading branch information
CrescenzoRegaLF authored and brianchandotcom committed Nov 6, 2024
1 parent 4e1b081 commit a7cae9b
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,14 @@ private Session _createSession(
String.class
).block()));

sessionCreateParams = SessionCreateParams.builder(
SessionCreateParams.Builder builder = SessionCreateParams.builder(
).addAllLineItem(
_getLineItems(
orderJSONObject.getString("currencyCode"),
commercePaymentEntryJSONObject.getString("languageId"),
orderJSONObject.getJSONArray("orderItems"))
).addPaymentMethodType(
SessionCreateParams.PaymentMethodType.CARD
).addShippingOption(
_getShippingOption(
orderJSONObject.getString("currencyCode"),
orderJSONObject.getLong("shippingAmountValue"),
orderJSONObject.getString("shippingOption"))
).setCancelUrl(
commercePaymentEntryJSONObject.getString("cancelURL")
).setCurrency(
Expand All @@ -149,7 +144,17 @@ private Session _createSession(
SessionCreateParams.Mode.PAYMENT
).setSuccessUrl(
commercePaymentEntryJSONObject.getString("callbackURL")
).build();
);

if (orderJSONObject.getBoolean("shippable")) {
builder.addShippingOption(
_getShippingOption(
orderJSONObject.getString("currencyCode"),
orderJSONObject.getLong("shippingAmountValue"),
orderJSONObject.getString("shippingOption")));
}

sessionCreateParams = builder.build();
}
else {
sessionCreateParams = SessionCreateParams.builder(
Expand Down

0 comments on commit a7cae9b

Please sign in to comment.