Skip to content
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

Add Alma as a new payment method to Android PaymentSheet #7302

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## XX.XX.XX - 2023-XX-XX

### PaymentSheet
* [ADDED][7302](https://github.com/stripe/stripe-android/pull/7302) PaymentSheet now supports Alma for PaymentIntents in private beta.

## 20.30.2 - 2023-09-13

### PaymentSheet
Expand Down
1 change: 1 addition & 0 deletions payments-core/api/payments-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -3760,6 +3760,7 @@ public final class com/stripe/android/model/PaymentMethod$Type : java/lang/Enum,
public static final field Affirm Lcom/stripe/android/model/PaymentMethod$Type;
public static final field AfterpayClearpay Lcom/stripe/android/model/PaymentMethod$Type;
public static final field Alipay Lcom/stripe/android/model/PaymentMethod$Type;
public static final field Alma Lcom/stripe/android/model/PaymentMethod$Type;
public static final field AmazonPay Lcom/stripe/android/model/PaymentMethod$Type;
public static final field AuBecsDebit Lcom/stripe/android/model/PaymentMethod$Type;
public static final field BacsDebit Lcom/stripe/android/model/PaymentMethod$Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ constructor(
requiresMandate = false,
hasDelayedSettlement = false
),
Alma(
"alma",
isReusable = false,
isVoucher = false,
requiresMandate = false,
hasDelayedSettlement = false
),
MobilePay(
"mobilepay",
isReusable = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="400dp"
android:height="172.85dp"
android:viewportWidth="400"
android:viewportHeight="172.85">
<path
android:pathData="M80.25,43.11c-1.8,0.21 -6.18,1.58 -6.58,2.06 -0.05,0.05 -0.46,0.31 -0.92,0.58 -3.56,2.04 -7,6.24 -9.15,11.18 -1.39,3.2 -1.58,3.73 -2.36,6.58 -0.34,1.24 -0.8,2.89 -1.03,3.67a93.99,93.99 0,0 0,-0.49 1.75c-0.05,0.18 -0.33,1.23 -0.64,2.33a3396.83,3396.83 0,0 0,-3 10.83,662.91 662.91,0 0,1 -1.9,6.83 180.89,180.89 0,0 0,-0.75 2.67c-0.12,0.46 -0.53,1.96 -0.92,3.33a653.8,653.8 0,0 0,-0.92 3.33c-0.12,0.46 -0.46,1.66 -0.74,2.67 -1.07,3.82 -1.55,5.54 -1.88,6.75 -0.19,0.69 -0.52,1.85 -0.73,2.58 -0.21,0.73 -0.61,2.16 -0.88,3.17 -0.54,2.03 -0.88,3.23 -2.43,8.75 -1.65,5.86 -1.94,7 -1.84,7.17 0.16,0.26 17.67,0.22 17.86,-0.05 0.09,-0.12 0.41,-0.92 0.71,-1.79 0.6,-1.72 1.45,-3.5 2.19,-4.63 0.26,-0.4 0.47,-0.76 0.47,-0.81 0,-0.49 3.08,-3.79 4.67,-5 2.55,-1.95 6.28,-3.72 8.67,-4.12 0.23,-0.04 0.9,-0.16 1.5,-0.28 2.28,-0.44 6.66,-0.21 9.5,0.5 1.51,0.38 5.43,2.05 5.83,2.5 0.05,0.05 0.29,0.2 0.54,0.33 3.32,1.71 7.76,7.69 9.05,12.18 0.17,0.6 0.39,1.14 0.49,1.21 0.35,0.25 17.92,0.15 17.92,-0.1 0,-0.12 -0.11,-0.59 -0.25,-1.04l-0.27,-0.9a25.26,25.26 0,0 1,-0.31 -1.17c-0.2,-0.8 -0.19,-0.78 -0.59,-2.17 -0.14,-0.5 -0.41,-1.44 -0.58,-2.08a200.99,200.99 0,0 0,-1.18 -4.25,125.53 125.53,0 0,1 -0.58,-2.08 643.85,643.85 0,0 0,-2.5 -9,199.3 199.3,0 0,1 -0.74,-2.67 267.89,267.89 0,0 0,-0.83 -3,386.15 386.15,0 0,1 -1.17,-4.25c-0.26,-0.96 -0.63,-2.31 -0.83,-3a781.52,781.52 0,0 1,-1.76 -6.25c-0.39,-1.4 -1.42,-5.15 -1.5,-5.42 -0.04,-0.14 -0.3,-1.08 -0.57,-2.08a203.79,203.79 0,0 0,-0.74 -2.67c-0.14,-0.46 -0.59,-2.11 -1.01,-3.67 -0.96,-3.55 -2.32,-8.41 -2.86,-10.2 -0.22,-0.75 -0.44,-1.5 -0.47,-1.67 -0.18,-0.88 -1.58,-4.35 -2.54,-6.29 -4.37,-8.81 -12.07,-13.33 -20.97,-12.31m56.08,43.94v42.46l8.88,-0.04 8.88,-0.04 0.04,-42.37 0.04,-42.37 -8.92,-0.04 -8.92,-0.05v42.46M84.26,60.15c1.68,0.76 2.19,1.87 4.01,8.77 0.15,0.55 0.37,1.34 0.49,1.75 0.12,0.41 0.46,1.65 0.75,2.75 0.83,3.15 0.93,3.54 1.56,5.83 0.55,2.01 1.48,5.47 2.04,7.54 0.13,0.48 0.34,1.27 0.47,1.75 0.44,1.62 0.95,3.54 1.02,3.79 0.03,0.14 0.3,1.11 0.59,2.17 0.29,1.05 0.66,2.44 0.82,3.08 0.17,0.64 0.51,1.9 0.76,2.8 0.56,1.99 0.53,2.02 -0.79,1 -1.66,-1.29 -3.58,-2.35 -5.47,-3.03a31.23,31.23 0,0 1,-0.92 -0.35c-2.72,-1.11 -8.94,-1.31 -12.25,-0.39 -3.41,0.94 -5.25,1.88 -8.85,4.53 -0.28,0.21 -0.29,0.19 -0.14,-0.33 0.09,-0.31 0.32,-1.12 0.51,-1.81l0.56,-2.08c0.12,-0.46 0.37,-1.4 0.55,-2.08a561.56,561.56 0,0 1,1.64 -6.08c0.13,-0.46 0.26,-0.95 0.3,-1.08 0.11,-0.44 1.07,-4.04 1.43,-5.33 0.19,-0.69 0.49,-1.77 0.66,-2.42 0.17,-0.64 0.44,-1.62 0.59,-2.17 0.15,-0.55 0.38,-1.38 0.5,-1.83 0.2,-0.77 0.61,-2.32 1.16,-4.33 0.12,-0.46 0.35,-1.28 0.5,-1.83 0.15,-0.55 0.31,-1.13 0.34,-1.29 1.77,-8.05 3.89,-10.8 7.18,-9.31m114.4,1.29c-11.83,1.32 -20.61,9.31 -23.25,21.16 -1.03,4.61 -1,3.71 -1,26.23l-0,20.58 8.88,0.04c7.02,0.03 8.9,-0 8.96,-0.17 0.04,-0.12 0.1,-9.66 0.12,-21.21l0.04,-21 0.45,-1.34c3.59,-10.58 18.21,-9.88 20.83,1 0.15,0.62 0.22,6.31 0.29,21.75l0.09,20.92 8.87,0.04 8.87,0.04 0.06,-20.96c0.06,-20.68 0.06,-20.98 0.41,-22.13 1.76,-5.9 6.56,-8.96 12.57,-8 0.74,0.12 2.66,0.74 2.81,0.91 0.05,0.05 0.29,0.19 0.55,0.3 1.65,0.72 3.76,3.29 4.63,5.62 0.74,1.98 0.72,1.43 0.81,23.25l0.09,20.92h17.67l0.03,-20.42c0.03,-22.75 0.02,-22.92 -1.22,-27.33 -3.24,-11.52 -10.83,-18.45 -22.06,-20.13 -2.56,-0.38 -6.93,-0.1 -10.75,0.7 -2.35,0.49 -6.67,2.62 -8.68,4.26 -0.28,0.23 -0.76,0.61 -1.07,0.83 -1.07,0.8 -2.86,2.79 -3.95,4.38l-0.77,1.13 -0.58,-0.88c-1.31,-1.99 -3.86,-4.58 -5.88,-5.96 -0.32,-0.22 -0.63,-0.46 -0.68,-0.54 -0.2,-0.29 -4.29,-2.25 -5.57,-2.67 -3.48,-1.15 -8.34,-1.71 -11.58,-1.35m116.83,-0.06c-0.05,0.05 -0.46,0.11 -0.92,0.13 -4.12,0.17 -11.28,3.02 -14.63,5.82l-0.95,0.79c-2.13,1.76 -6.5,6.71 -6.5,7.36 0,0.09 -0.1,0.26 -0.23,0.39 -0.13,0.13 -0.4,0.56 -0.61,0.97 -0.21,0.41 -0.42,0.78 -0.48,0.82 -0.67,0.52 -3.12,7.03 -3.7,9.83 -0.09,0.41 -0.23,1.05 -0.32,1.42 -0.09,0.37 -0.27,1.66 -0.4,2.88 -2.45,22.85 14.2,41.68 34.53,39.04 2.06,-0.27 2.03,-0.26 2.15,-0.39 0.06,-0.06 0.27,-0.12 0.46,-0.12 3.79,-0.03 12.13,-5.53 15.66,-10.32l0.76,-1.04 0.04,5.22 0.04,5.22 8.38,0.04 8.38,0.04V63h-17.83l-0,4.54 -0,4.54 -0.43,-0.5c-2,-2.33 -5.08,-5.08 -6.73,-5.99 -0.32,-0.18 -0.62,-0.37 -0.66,-0.43 -0.71,-0.94 -6.87,-3.09 -10.33,-3.6 -0.82,-0.12 -5.59,-0.27 -5.67,-0.18m9.1,16.96c12.6,2.26 18.6,16.35 11.85,27.82 -3.07,5.22 -9.29,8.45 -15.61,8.11 -10.26,-0.55 -18.03,-10.72 -16.17,-21.14 0.11,-0.62 0.2,-1.17 0.19,-1.21 -0,-0.05 0.11,-0.4 0.25,-0.8 0.14,-0.39 0.28,-0.82 0.31,-0.96 0.08,-0.34 0.96,-2.4 1.08,-2.5 0.05,-0.05 0.19,-0.3 0.3,-0.56 2.56,-5.82 11,-9.98 17.79,-8.76"
android:fillColor="#fc5424"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="400dp"
android:height="172.85dp"
android:viewportWidth="400"
android:viewportHeight="172.85">
<path
android:fillColor="#FF000000"
android:pathData="M80.86,43.07c-8.62,0.82 -15.14,6.92 -18.7,17.51 -0.29,0.87 -4.71,16.63 -9.82,35.03 -5.11,18.4 -9.31,33.53 -9.34,33.62 -0.05,0.16 0.43,0.17 8.98,0.17h9.03l0.46,-1.39c3.15,-9.58 11.37,-15.6 21.3,-15.6 9.89,0 18.04,5.95 21.25,15.53l0.47,1.42 9.04,0.03c8.58,0.02 9.04,0.02 8.99,-0.15 -0.03,-0.09 -4.25,-15.27 -9.37,-33.72 -9.39,-33.78 -9.73,-34.98 -10.63,-37.2 -4.31,-10.65 -12.11,-16.14 -21.66,-15.23m55.47,43.94v42.38h17.77V44.63h-17.77v42.38m-52.16,-26.93c0.99,0.37 1.78,1.34 2.45,2.98 0.27,0.66 10.76,39.28 10.69,39.37 -0.01,0.02 -0.34,-0.23 -0.73,-0.56 -7.7,-6.46 -19.74,-6.47 -27.63,-0.03 -0.4,0.33 -0.74,0.58 -0.75,0.57 -0.04,-0.05 10.32,-38.36 10.56,-39.03 1.05,-2.99 3.02,-4.19 5.4,-3.3m114.46,1.4c-1.55,0.18 -2.16,0.27 -3.2,0.49 -10.54,2.15 -18.18,10.63 -20.37,22.6 -0.62,3.37 -0.58,2.08 -0.62,24.44l-0.03,20.39h17.87l0.03,-20.83c0.03,-19.64 0.04,-20.87 0.2,-21.56 1.35,-5.64 5.2,-8.76 10.76,-8.73 5.45,0.02 9.41,3.41 10.56,9.03 0.16,0.77 0.17,2.32 0.2,21.46l0.03,20.63h17.76l0.03,-20.58c0.04,-22.6 -0.01,-21 0.61,-23.02 3.03,-9.99 17.22,-10.15 20.5,-0.24 0.74,2.24 0.69,0.48 0.72,23.36l0.03,20.48h17.77l-0.03,-20.43c-0.03,-22.23 -0,-20.94 -0.57,-24.19 -2.48,-14.27 -12.64,-23.34 -26.13,-23.34 -9.1,0 -16.42,3.65 -21.26,10.61 -0.6,0.86 -0.54,0.85 -1,0.16 -3.75,-5.7 -9.8,-9.41 -17.17,-10.53 -0.95,-0.14 -5.86,-0.27 -6.7,-0.17m116.31,0.01c-20.25,2.15 -33.17,24.17 -26.85,45.79 7.36,25.16 36.88,32.24 51.71,12.4l0.58,-0.77 0.03,5.24 0.03,5.24h16.7V63.09h-17.77l-0.03,4.53 -0.03,4.53 -0.68,-0.83c-5.66,-6.89 -14.96,-10.75 -23.68,-9.83m10.19,16.92c10.52,2.28 16.69,13.31 13.23,23.68 -4.68,14.06 -22.69,16.66 -30.87,4.46 -7.36,-10.98 -1.01,-26.2 11.8,-28.28 1.31,-0.21 4.56,-0.14 5.84,0.14"
android:fillType="evenOdd"/>
</vector>
1 change: 1 addition & 0 deletions payments-ui-core/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<string name="stripe_paymentsheet_payment_method_affirm">Affirm</string>
<string name="stripe_paymentsheet_payment_method_revolut_pay">Revolut Pay</string>
<string name="stripe_paymentsheet_payment_method_amazon_pay">Amazon Pay</string>
<string name="stripe_paymentsheet_payment_method_alma">Alma</string>
<string name="stripe_paymentsheet_payment_method_mobile_pay">MobilePay</string>
<string name="stripe_paymentsheet_payment_method_zip">Zip</string>
<string name="stripe_paymentsheet_payment_method_blik">BLIK</string>
Expand Down
26 changes: 26 additions & 0 deletions payments-ui-core/src/main/assets/lpms.json
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,32 @@
}
}
},
{
"type": "alma",
"async": false,
"selector_icon": {
"light_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-alma_dark-9adee7a095478e23c76054e7fcb4c275.png",
"dark_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-alma_light-41fe66ba84194788e98548aa6e749c79.png"
},
"fields": [
],
"next_action_spec": {
"confirm_response_status_specs": {
"requires_action": {
"type": "redirect_to_url"
}
},
"post_confirm_handling_pi_status_specs": {
"succeeded": {
"type": "finished"
},
"requires_action": {
"type": "canceled"
}
}
}
},

{
"type": "mobilepay",
"async": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ internal val AmazonPayRequirement = PaymentMethodRequirements(
confirmPMFromCustomer = null
)

internal val AlmaRequirement = PaymentMethodRequirements(
piRequirements = emptySet(),
siRequirements = null,
confirmPMFromCustomer = null
)

internal val MobilePayRequirement = PaymentMethodRequirements(
piRequirements = emptySet(),
siRequirements = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.stripe.android.payments.financialconnections.IsFinancialConnectionsAv
import com.stripe.android.paymentsheet.forms.AffirmRequirement
import com.stripe.android.paymentsheet.forms.AfterpayClearpayRequirement
import com.stripe.android.paymentsheet.forms.AlipayRequirement
import com.stripe.android.paymentsheet.forms.AlmaRequirement
import com.stripe.android.paymentsheet.forms.AmazonPayRequirement
import com.stripe.android.paymentsheet.forms.AuBecsDebitRequirement
import com.stripe.android.paymentsheet.forms.BancontactRequirement
Expand Down Expand Up @@ -401,6 +402,17 @@ class LpmRepository constructor(
requirement = AmazonPayRequirement,
formSpec = LayoutSpec(sharedDataSpec.fields)
)
PaymentMethod.Type.Alma.code -> SupportedPaymentMethod(
code = "alma",
requiresMandate = false,
displayNameResource = R.string.stripe_paymentsheet_payment_method_alma,
iconResource = R.drawable.stripe_ic_paymentsheet_pm_alma,
lightThemeIconUrl = sharedDataSpec.selectorIcon?.lightThemePng,
darkThemeIconUrl = sharedDataSpec.selectorIcon?.darkThemePng,
tintIconOnSelection = false,
requirement = AlmaRequirement,
formSpec = LayoutSpec(sharedDataSpec.fields)
)
PaymentMethod.Type.MobilePay.code -> SupportedPaymentMethod(
code = "mobilepay",
requiresMandate = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.stripe.android.lpm

import androidx.test.ext.junit.runners.AndroidJUnit4
import com.stripe.android.BaseLpmTest
import com.stripe.android.test.core.Currency
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
internal class TestAlma : BaseLpmTest() {
private val alma = newUser.copy(
paymentMethod = lpmRepository.fromCode("alma")!!,
currency = Currency.EUR,
merchantCountryCode = "FR",
)

@Ignore("Complex authorization handling required")
jaynewstrom-stripe marked this conversation as resolved.
Show resolved Hide resolved
@Test
fun testAlma() {
testDriver.confirmNewOrGuestComplete(
testParameters = alma,
)
}

@Test
fun testAlmaInCustomFlow() {
testDriver.confirmCustom(
testParameters = alma,
)
}
}
49 changes: 49 additions & 0 deletions paymentsheet/src/test/resources/alma-support.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
lpm, hasCustomer, allowsDelayedPayment, intentSetupFutureUsage, intentHasShipping, intentLpms, supportCustomerSavedCard, formExists, formType, supportsAdding
alma, true, true, off_session, false, card/alma, false, false, not available, false
alma, true, true, off_session, false, card/eps/alma, false, false, not available, false
alma, true, false, off_session, false, card/alma, false, false, not available, false
alma, true, false, off_session, false, card/eps/alma, false, false, not available, false
alma, true, true, on_session, false, card/alma, false, false, not available, false
alma, true, true, on_session, false, card/eps/alma, false, false, not available, false
alma, true, false, on_session, false, card/alma, false, false, not available, false
alma, true, false, on_session, false, card/eps/alma, false, false, not available, false
alma, true, true, null, false, card/alma, false, true, oneTime, true
alma, true, true, null, false, card/eps/alma, false, true, oneTime, true
alma, true, false, null, false, card/alma, false, true, oneTime, true
alma, true, false, null, false, card/eps/alma, false, true, oneTime, true
alma, false, true, off_session, false, card/alma, false, false, not available, false
alma, false, true, off_session, false, card/eps/alma, false, false, not available, false
alma, false, false, off_session, false, card/alma, false, false, not available, false
alma, false, false, off_session, false, card/eps/alma, false, false, not available, false
alma, false, true, on_session, false, card/alma, false, false, not available, false
alma, false, true, on_session, false, card/eps/alma, false, false, not available, false
alma, false, false, on_session, false, card/alma, false, false, not available, false
alma, false, false, on_session, false, card/eps/alma, false, false, not available, false
alma, false, true, null, false, card/alma, false, true, oneTime, true
alma, false, true, null, false, card/eps/alma, false, true, oneTime, true
alma, false, false, null, false, card/alma, false, true, oneTime, true
alma, false, false, null, false, card/eps/alma, false, true, oneTime, true
alma, true, true, off_session, true, card/alma, false, false, not available, false
alma, true, true, off_session, true, card/eps/alma, false, false, not available, false
alma, true, false, off_session, true, card/alma, false, false, not available, false
alma, true, false, off_session, true, card/eps/alma, false, false, not available, false
alma, true, true, on_session, true, card/alma, false, false, not available, false
alma, true, true, on_session, true, card/eps/alma, false, false, not available, false
alma, true, false, on_session, true, card/alma, false, false, not available, false
alma, true, false, on_session, true, card/eps/alma, false, false, not available, false
alma, true, true, null, true, card/alma, false, true, oneTime, true
alma, true, true, null, true, card/eps/alma, false, true, oneTime, true
alma, true, false, null, true, card/alma, false, true, oneTime, true
alma, true, false, null, true, card/eps/alma, false, true, oneTime, true
alma, false, true, off_session, true, card/alma, false, false, not available, false
alma, false, true, off_session, true, card/eps/alma, false, false, not available, false
alma, false, false, off_session, true, card/alma, false, false, not available, false
alma, false, false, off_session, true, card/eps/alma, false, false, not available, false
alma, false, true, on_session, true, card/alma, false, false, not available, false
alma, false, true, on_session, true, card/eps/alma, false, false, not available, false
alma, false, false, on_session, true, card/alma, false, false, not available, false
alma, false, false, on_session, true, card/eps/alma, false, false, not available, false
alma, false, true, null, true, card/alma, false, true, oneTime, true
alma, false, true, null, true, card/eps/alma, false, true, oneTime, true
alma, false, false, null, true, card/alma, false, true, oneTime, true
alma, false, false, null, true, card/eps/alma, false, true, oneTime, true