From d64105c595ec4d621635aea25e3eb8650752328f Mon Sep 17 00:00:00 2001 From: AnasNaouchi Date: Thu, 14 Nov 2024 14:31:54 +0700 Subject: [PATCH] Fix discover card and add unionPay --- .../Assets.xcassets/Credit Card/Contents.json | 6 +++--- .../Credit Card/Discover.imageset/Contents.json | 12 ++++++++++++ .../Credit Card/Discover.imageset/Discover.pdf | Bin 0 -> 3225 bytes .../Credit Card/UnionPay.imageset/Contents.json | 12 ++++++++++++ .../Credit Card/UnionPay.imageset/UnionPay.pdf | Bin 0 -> 15213 bytes OmiseSDK/Sources/Models/CardBrand.swift | 13 ++++++++++--- OmiseSDK/Sources/Models/PAN.swift | 12 +----------- .../TextFields/CardNumberTextField.swift | 6 ++++-- .../CreditCardPaymentController.swift | 4 ++++ 9 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Contents.json create mode 100644 OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Discover.pdf create mode 100644 OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/Contents.json create mode 100644 OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/UnionPay.pdf diff --git a/OmiseSDK/Resources/Assets.xcassets/Credit Card/Contents.json b/OmiseSDK/Resources/Assets.xcassets/Credit Card/Contents.json index da4a164c..73c00596 100644 --- a/OmiseSDK/Resources/Assets.xcassets/Credit Card/Contents.json +++ b/OmiseSDK/Resources/Assets.xcassets/Credit Card/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Contents.json b/OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Contents.json new file mode 100644 index 00000000..312e77d2 --- /dev/null +++ b/OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images": [ + { + "filename": "Discover.pdf", + "idiom": "universal" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Discover.pdf b/OmiseSDK/Resources/Assets.xcassets/Credit Card/Discover.imageset/Discover.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2e1fba7defce5ff2e0f05f1f3a923b9310f4828e GIT binary patch literal 3225 zcmbuCS6oxs7RFB!AR#Iegb)>&fK-7o2?PlPN(~Y;LWp!2LJ}~P1VfObQUpe7s47h^ zMUW~MR79*lK#Jl>Q3O;*kP^!UM?e{7xF=wn>%7g{FK4a2*0;aCpZ-U~!J4d({}GSG zV{urXZvfKN6p0068$B|FjooI&5HNyx{;MSihCe$LO8^^b$Q?V7Y%WVYAkM!ZTOvFA_$ zpUntHE)On`0IQqmIOHbE8u-~a?FApu>p+5v&WBqXKa2$UQky+Kjc<-`CQ zFR!4cK``8I5gvCLoKb=RP$(4kMG*WzK;TdqC<*QoQQ(0vsDva$;%|y5Kou^x0gsSZ zvvAB(Brpza(V)l0C*+)e*gv~G1gwRDswfx=*a;NwAPHHNaX0sxm-%;UYKt8E_wCc3 zi?6CVR%eqZ(hjvr7KY|o-z6pNW+IZ3l0Fc#)Hhsxd*uDtANY*JRrjM4YyWJxUDf$< zr&Go2cC&Zo#6@(&{7tE}|K!Y>c;90_-)iu4X}~fNIJ5tsd$>lXp=!2j0}A%KJ#zc> zUd)tH&e+yfmIY|J<&xxgzf6V6j^iLHzDbx$Kvq_ECcuKUxp-`3Nkl4Gzr`@6vb))G z!nAV4jbD%&Hfj@|Y-(HYuKp%>9i@VIJA|aaL#i{mL6L}j7N>psO*?J4O8)pI&e<$) zw>4I_`<2W4+%k;@eG=uUttxEh!Wc$n8G!G8WOnZ_vZZ&#!+@gk#O|yDmg8sx~eIxM4JV?ZQdpidxJ3L#lTt_XZPV zB2Kj(sDEt|60!O9;z+Ywy|X1!N>ZTHcX30oOOaRVA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r$%a;Z0rtB= zLihe6Kg7mc!|KsdW4ec}%Sq%~tabI#=Adz?TXI^BL5cqc>2~S|iLt@?$IDN|@c9X& zK4GXBFTW>1F@~;!ngfF`2E0{zU7<-DJCqm3XM#v8W>4B`+a5NH!?5H*2W9WSaa`7ftxG`pchwnGwdg-K3*fA_L7nR0|~FojQ{`u literal 0 HcmV?d00001 diff --git a/OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/Contents.json b/OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/Contents.json new file mode 100644 index 00000000..36ddf0ef --- /dev/null +++ b/OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images": [ + { + "filename": "UnionPay.pdf", + "idiom": "universal" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/UnionPay.pdf b/OmiseSDK/Resources/Assets.xcassets/Credit Card/UnionPay.imageset/UnionPay.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1760195650df0d85012ecce54caa7a3864bf89d8 GIT binary patch literal 15213 zcmcJ$Q-CGgvMyX^m(^w4wr$&(W!tumF00G7%`Usk>ay*+wbt6_oPE!Jxc|#P=F7~; z7?Cj|XU_aaM0}(QB4V_Rbc`^J1PlarMwT!kM9zZ}ZZ0KxgZD;n6NWsty z;6%XmrKkkM#|HzjHTi48U&sGB@o(LKrb%0vI1y+Qu>CcUK=&V+u$_yoGXdkjnPL84 zW;EoDECI&O1po5qZ=WO?30VHV`d>$X4SGo?0@nYQeEIZ0ZvCbBpKkrj>OW2>yBInD zy-G=&ua*5H6S8o2QUEv#+u7LL*#f?NAMlYd=G24HLUrO3q0#POHk zPR@=1LmL?Ptf5RV1(ju7|KGX~@BThL{s6ZCRaXomy80*(;BpaT@QHX4S&$_nsXp=E zQr5=k^x%x2HkL9*%4XI~#y=8YpwL1%_!y8#Q&);CjF=R~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&;K#U4aa5NPm#9Xg>U9#t%L*2@U*_kZ z`6IfDgT_yU^Y#)ghcN5@xLZY+f3`=4=S9J{$Y)SFy-A!Kd1ZYg({@3a7gLmnHr-+_ zJE>Vn`u;oxoGReXmhduse#?cbJ4F+j#dQ3P^~6kJ(sZd+(!8Hcdf8vvYzG_r4K~*1 zUfU=Ax_q8L6tEF?<%3%v$qQH0{F9#G)M6eQ+3Pjo4u#$I6Jg5_xBIadnb5mC@>Y%5 zE#%|t?S~KaNRR(jkF{>&bU66beClS^A@cQJS>1iD{7jL3;b(8H==skE_P-dB|JlI) z7jyETwsQqT$G;ee{}3+!raLMDoa|g2jlWo!f6*nC{!x3qfP|ue;fE8zT{uW|L)BHtBIY3<^Sqnr&eKLTV!Te zW&jc*Hs)0(2G<4Um1d^M$g0S@v?$t6tjR+h1qbT*303i*ad3A8n8Gl8F)bPXdl0a( zvNE$0e31hGTf|B5_g4bj|Be+TmK+oNpZ3HVyZ-(*fhN9VuS^~D3_V1OYd6_po* F`9Fu#l^6g3 literal 0 HcmV?d00001 diff --git a/OmiseSDK/Sources/Models/CardBrand.swift b/OmiseSDK/Sources/Models/CardBrand.swift index a2e873f8..2b074f5c 100644 --- a/OmiseSDK/Sources/Models/CardBrand.swift +++ b/OmiseSDK/Sources/Models/CardBrand.swift @@ -17,6 +17,8 @@ public enum CardBrand: String, CustomStringConvertible, Codable { case laser = "Laser" /// Maestro card newtwork brand case maestro = "Maestro" + /// UnionPay card network brand + case unionPay = "UnionPay" /// Discover card newtwork brand case discover = "Discover" @@ -28,7 +30,8 @@ public enum CardBrand: String, CustomStringConvertible, Codable { diners, laser, maestro, - discover + discover, + unionPay ] /// Regular expression pattern that can detect cards issued by the brand. @@ -48,8 +51,10 @@ public enum CardBrand: String, CustomStringConvertible, Codable { return "^(6304|670[69]|6771)" case .maestro: return "^(5[0,6-8]|6304|6759|676[1-3])" + case .unionPay: + return "^62\\d{14,17}$" case .discover: - return "^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)" + return "^(6011\\d{12,15}|65\\d{14,17}|64[4-9]\\d{13,16}|6221[2-9]\\d{11,14}|622[3-9]\\d{12,15})$" } } @@ -70,8 +75,10 @@ public enum CardBrand: String, CustomStringConvertible, Codable { return 16...19 case .maestro: return 12...19 + case .unionPay: + return 16...19 case .discover: - return 16...16 + return 16...19 } } diff --git a/OmiseSDK/Sources/Models/PAN.swift b/OmiseSDK/Sources/Models/PAN.swift index 568098a5..958e7a86 100644 --- a/OmiseSDK/Sources/Models/PAN.swift +++ b/OmiseSDK/Sources/Models/PAN.swift @@ -39,17 +39,7 @@ public struct PAN { /// The suggested of where the space should be displayed string indexes public var suggestedSpaceFormattedIndexes: IndexSet { - switch self { - case CardBrand.amex.pattern, "^5[6-8]": - return [ 4, 10 ] - case "^50": - return [ 4, 8 ] - case "^3[0,6,8-9]": - return [ 4, 10 ] - case "^[0-9]": - return [ 4, 8, 12 ] - default: return [] - } + return IndexSet(stride(from: 4, to: 19, by: 4)) } /// The last 4 digits of the PAN number diff --git a/OmiseSDK/Sources/Views/Components/TextFields/CardNumberTextField.swift b/OmiseSDK/Sources/Views/Components/TextFields/CardNumberTextField.swift index 82cec6e4..1498c235 100644 --- a/OmiseSDK/Sources/Views/Components/TextFields/CardNumberTextField.swift +++ b/OmiseSDK/Sources/Views/Components/TextFields/CardNumberTextField.swift @@ -119,7 +119,9 @@ public class CardNumberTextField: OmiseTextField { options: .regularExpression, range: nil) - let panLength = (self.pan.brand?.validLengths.upperBound ?? 16) - (self.text?.count ?? 0) + selectedTextLength + // Using the current detected upper bound for the current brand will cause problems when swtching from + // a brand that has an upper bound that is lower than that of the pasted detected card. (ex from visa to discover). So the upper bound will be set to the highest upper bound available for cards which is 19 + let panLength = 19 - (self.text?.count ?? 0) + selectedTextLength let maxPastingPANLength = min(pan.count, panLength) guard maxPastingPANLength > 0 else { return @@ -306,7 +308,7 @@ extension CardNumberTextField { guard range.length >= 0 else { return true } - let maxLength = (pan.brand?.validLengths.upperBound ?? 16) + let maxLength = (pan.brand?.validLengths.upperBound ?? 19) return maxLength >= (self.text?.count ?? 0) - range.length + string.count } diff --git a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentController.swift b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentController.swift index fab1dcbb..81e62894 100644 --- a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentController.swift +++ b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentController.swift @@ -547,6 +547,10 @@ class CreditCardPaymentController: UIViewController { cardBrandIconName = "AMEX" case .diners?: cardBrandIconName = "Diners" + case .unionPay: + cardBrandIconName = "UnionPay" + case .discover?: + cardBrandIconName = "Discover" default: cardBrandIconName = nil }