Skip to content

change pmme info button to text#6032

Draft
gbirch-stripe wants to merge 3 commits intomasterfrom
gbirch/pmme-learn-more-change
Draft

change pmme info button to text#6032
gbirch-stripe wants to merge 3 commits intomasterfrom
gbirch/pmme-learn-more-change

Conversation

@gbirch-stripe
Copy link
Collaborator

@gbirch-stripe gbirch-stripe commented Jan 30, 2026

/// - Parameters:
/// - template: The promotional text to be displayed, including a placeholder if needed (e.g. "Buy now or pay later with {partner}")
/// - substitution: An optional tuple containing the placeholder text from the template to be replaced and the partner logo image to replace it with.
static func bnplPromoString(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Separated this back out into two separate implementations — one for PMME and one for the afterpay header. They do pretty different things at this point, and the afterpay one is about to be removed and replaced with PMME anyways

This comment was marked as spam.

verticalFittingPriority: .fittingSizeLevel
)
label.bounds = CGRect(origin: .zero, size: size)
STPSnapshotVerifyView(label, identifier: identifier, file: file, line: line)

This comment was marked as spam.

Comment on lines 16 to 88

This comment was marked as spam.

@@ -0,0 +1,103 @@
//

This comment was marked as spam.


// Originally based on https://stackoverflow.com/questions/26105803/center-nstextattachment-image-next-to-single-line-uilabel
private static func boundsOfImage(font: UIFont, uiImage: UIImage, additionalScale: CGFloat) -> CGRect {
let scaledSize = uiImage.sizeMatchingFont(font, additionalScale: additionalScale)

This comment was marked as spam.

@@ -25,7 +25,12 @@ extension PaymentMethodMessagingElement {
let legalDisclosure = paymentPlan.content.legalDisclosure?.message

This comment was marked as spam.

@@ -16,71 +16,71 @@
@MainActor

This comment was marked as spam.

Comment on lines 16 to 65
@MainActor
class NSAttributedStringStripeSnapshotTests: STPSnapshotTestCase {

func testBnplPromoString_UILabel_ImageAsset() {
func testPmmePromoString_UILabel_ImageAsset() {
let template = "Buy now or pay later with <img/>"
let image = Image.affirm_copy.makeImage()
let attributedString = NSMutableAttributedString.bnplPromoString(
let attributedString = NSMutableAttributedString.pmmePromoString(
font: .boldSystemFont(ofSize: 20),
textColor: UIColor(red: 0.2, green: 0.4, blue: 0.8, alpha: 1.0),
infoIconColor: UIColor.purple,
template: template,
substitution: ("<img/>", image)
substitution: ("<img/>", image),
infoMessage: "Learn more"
)

let label = UILabel()
label.attributedText = attributedString
label.numberOfLines = 0

verify(label)
}

func testBnplPromoString_UILabel_SystemImage() {
func testPmmePromoString_UILabel_SystemImage() {
let template = "4 interest-free payments of $12.50 with {partner}"
let systemImage = UIImage(systemName: "creditcard.fill")!
let attributedString = NSMutableAttributedString.bnplPromoString(
let attributedString = NSMutableAttributedString.pmmePromoString(
font: .systemFont(ofSize: 14),
textColor: .darkGray,
infoIconColor: UIColor.red,
template: template,
substitution: ("{partner}", systemImage)
substitution: ("{partner}", systemImage),
infoMessage: "Learn more"
)

let label = UILabel()
label.attributedText = attributedString
label.numberOfLines = 0

verify(label)
}

func testBnplPromoString_UILabel_NoSubstitution() {
func testPmmePromoString_UILabel_NoSubstitution() {
let template = "Flexible payment options available"
let attributedString = NSMutableAttributedString.bnplPromoString(
let attributedString = NSMutableAttributedString.pmmePromoString(
font: .italicSystemFont(ofSize: 14),
textColor: UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0),
infoIconColor: UIColor.green,
template: template,
substitution: nil
substitution: nil,
infoMessage: "Learn more"
)

let label = UILabel()

This comment was marked as spam.

Rightpartners

This comment was marked as spam.

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