-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add promo badge in horizontal and vertical mode
- Loading branch information
1 parent
27ced44
commit b0d3f24
Showing
9 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
StripePaymentSheet/StripePaymentSheet/Source/PaymentSheet/PaymentMethodIncentive.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// PaymentMethodIncentive.swift | ||
// StripePaymentSheet | ||
// | ||
// Created by Till Hellmund on 11/19/24. | ||
// | ||
|
||
import Foundation | ||
@_spi(STP) import StripePayments | ||
|
||
struct PaymentMethodIncentive { | ||
|
||
private let identifier: String | ||
let displayText: String | ||
|
||
func takeIfAppliesTo(_ paymentMethodType: PaymentSheet.PaymentMethodType) -> PaymentMethodIncentive? { | ||
switch paymentMethodType { | ||
case .stripe, .external: | ||
return nil | ||
case .instantDebits, .linkCardBrand: | ||
return identifier == "link_instant_debits" ? self : nil | ||
} | ||
} | ||
} | ||
|
||
extension PaymentMethodIncentive { | ||
|
||
init?(from incentive: LinkConsumerIncentive) { | ||
guard let displayText = incentive.incentiveDisplayText else { | ||
return nil | ||
} | ||
|
||
self.identifier = incentive.incentiveParams.paymentMethod | ||
self.displayText = displayText | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters