fix(payment): move detectedBrandLogo computed property into correct scope inside PaymentCardView
12
pedi-foods/Darwin/Assets.xcassets/alelocard_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "alelocard_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/alelocard_logo.imageset/alelocard_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
12
pedi-foods/Darwin/Assets.xcassets/amexcard_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "amexcard_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/amexcard_logo.imageset/amexcard_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
12
pedi-foods/Darwin/Assets.xcassets/hipercard_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "hipercard_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/hipercard_logo.imageset/hipercard_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
12
pedi-foods/Darwin/Assets.xcassets/icon_pix.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "icon_pix.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/icon_pix.imageset/icon_pix.png
vendored
Normal file
|
After Width: | Height: | Size: 835 B |
12
pedi-foods/Darwin/Assets.xcassets/mastercard_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "mastercard_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/mastercard_logo.imageset/mastercard_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
12
pedi-foods/Darwin/Assets.xcassets/sodexo_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "sodexo_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/sodexo_logo.imageset/sodexo_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
12
pedi-foods/Darwin/Assets.xcassets/visacard_logo.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "visacard_logo.png",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pedi-foods/Darwin/Assets.xcassets/visacard_logo.imageset/visacard_logo.png
vendored
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
@@ -928,46 +928,6 @@ struct CardSelectionSheet: View {
|
|||||||
_selectedCardId = State(initialValue: savedCards.first(where: { $0.isDefault })?.id ?? savedCards.first?.id)
|
_selectedCardId = State(initialValue: savedCards.first(where: { $0.isDefault })?.id ?? savedCards.first?.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var detectedBrandLogo: String? {
|
|
||||||
let clean = cardNumber.filter(\.isNumber)
|
|
||||||
guard !clean.isEmpty else { return nil }
|
|
||||||
|
|
||||||
// Sodexo
|
|
||||||
if clean.hasPrefix("506766") || clean.hasPrefix("603389") {
|
|
||||||
return "sodexo_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alelo
|
|
||||||
if clean.hasPrefix("5067") || clean.hasPrefix("5078") || clean.hasPrefix("6278") || clean.hasPrefix("6367") {
|
|
||||||
return "alelocard_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hipercard
|
|
||||||
if clean.hasPrefix("3841") || clean.hasPrefix("606282") || clean.hasPrefix("637095") || clean.hasPrefix("637568") {
|
|
||||||
return "hipercard_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Visa
|
|
||||||
if clean.hasPrefix("4") {
|
|
||||||
return "visacard_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mastercard
|
|
||||||
if (51...55).contains(Int(clean.prefix(2)) ?? 0) {
|
|
||||||
return "mastercard_logo"
|
|
||||||
}
|
|
||||||
if let prefix4 = Int(clean.prefix(4)), (2221...2720).contains(prefix4) {
|
|
||||||
return "mastercard_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Amex
|
|
||||||
if clean.hasPrefix("34") || clean.hasPrefix("37") {
|
|
||||||
return "amexcard_logo"
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
// Header
|
// Header
|
||||||
@@ -1108,6 +1068,46 @@ struct PaymentCardView: View {
|
|||||||
@State var nickname = ""
|
@State var nickname = ""
|
||||||
@State var isSubmitting = false
|
@State var isSubmitting = false
|
||||||
|
|
||||||
|
private var detectedBrandLogo: String? {
|
||||||
|
let clean = cardNumber.filter(\.isNumber)
|
||||||
|
guard !clean.isEmpty else { return nil }
|
||||||
|
|
||||||
|
// Sodexo
|
||||||
|
if clean.hasPrefix("506766") || clean.hasPrefix("603389") {
|
||||||
|
return "sodexo_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alelo
|
||||||
|
if clean.hasPrefix("5067") || clean.hasPrefix("5078") || clean.hasPrefix("6278") || clean.hasPrefix("6367") {
|
||||||
|
return "alelocard_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hipercard
|
||||||
|
if clean.hasPrefix("3841") || clean.hasPrefix("606282") || clean.hasPrefix("637095") || clean.hasPrefix("637568") {
|
||||||
|
return "hipercard_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Visa
|
||||||
|
if clean.hasPrefix("4") {
|
||||||
|
return "visacard_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mastercard
|
||||||
|
if (51...55).contains(Int(clean.prefix(2)) ?? 0) {
|
||||||
|
return "mastercard_logo"
|
||||||
|
}
|
||||||
|
if let prefix4 = Int(clean.prefix(4)), (2221...2720).contains(prefix4) {
|
||||||
|
return "mastercard_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amex
|
||||||
|
if clean.hasPrefix("34") || clean.hasPrefix("37") {
|
||||||
|
return "amexcard_logo"
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
init(context: CardPaymentContext, appState: Binding<AppState>, onOrderCreated: @escaping (String, String?) -> Void) {
|
init(context: CardPaymentContext, appState: Binding<AppState>, onOrderCreated: @escaping (String, String?) -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self._appState = appState
|
self._appState = appState
|
||||||
|
|||||||