55namespace Jolicode \WalletKit \Builder ;
66
77use Jolicode \WalletKit \Builder \Internal \BarcodeMapper ;
8- use Jolicode \WalletKit \Builder \Internal \ColorMapper ;
98use Jolicode \WalletKit \Builder \Internal \CommonWalletState ;
109use Jolicode \WalletKit \Builder \Internal \SamsungBarcodeMapper ;
10+ use Jolicode \WalletKit \Common \Color ;
1111use Jolicode \WalletKit \Exception \ApplePlatformContextRequiredException ;
1212use Jolicode \WalletKit \Exception \GooglePlatformContextRequiredException ;
1313use Jolicode \WalletKit \Exception \SamsungPlatformContextRequiredException ;
@@ -52,43 +52,23 @@ public function withGoogleBarcodeOverride(?GoogleBarcode $barcode): static
5252 return $ this ;
5353 }
5454
55- public function withAppleBackgroundColor (? string $ color ): static
55+ public function withBackgroundColor (? Color $ color ): static
5656 {
57- $ this ->common ->appleBackgroundColor = $ color ;
57+ $ this ->common ->backgroundColor = $ color ;
5858
5959 return $ this ;
6060 }
6161
62- public function withGoogleHexBackgroundColor (? string $ hex ): static
62+ public function withForegroundColor (? Color $ color ): static
6363 {
64- $ this ->common ->googleHexBackgroundColor = $ hex ;
64+ $ this ->common ->foregroundColor = $ color ;
6565
6666 return $ this ;
6767 }
6868
69- /**
70- * Sets Apple background from RGB and, when parsable, derives Google hex automatically unless hex was set explicitly.
71- */
72- public function withBackgroundColorRgb (string $ appleRgb ): static
73- {
74- $ this ->common ->appleBackgroundColor = $ appleRgb ;
75- if (null === $ this ->common ->googleHexBackgroundColor ) {
76- $ this ->common ->googleHexBackgroundColor = ColorMapper::appleRgbToGoogleHex ($ appleRgb );
77- }
78-
79- return $ this ;
80- }
81-
82- public function withAppleForegroundColor (?string $ color ): static
69+ public function withLabelColor (?Color $ color ): static
8370 {
84- $ this ->common ->appleForegroundColor = $ color ;
85-
86- return $ this ;
87- }
88-
89- public function withAppleLabelColor (?string $ color ): static
90- {
91- $ this ->common ->appleLabelColor = $ color ;
71+ $ this ->common ->labelColor = $ color ;
9272
9373 return $ this ;
9474 }
@@ -211,10 +191,9 @@ protected function primaryGoogleBarcode(): ?GoogleBarcode
211191 return BarcodeMapper::fromFirstAppleBarcode ($ this ->common ->appleBarcodes );
212192 }
213193
214- protected function resolvedGoogleHex (): ?string
194+ protected function resolvedBackgroundColor (): ?Color
215195 {
216- return $ this ->common ->googleHexBackgroundColor
217- ?? ColorMapper::appleRgbToGoogleHex ($ this ->common ->appleBackgroundColor );
196+ return $ this ->common ->backgroundColor ;
218197 }
219198
220199 protected function resolvedGoogleReviewStatus (): ReviewStatusEnum
@@ -279,9 +258,9 @@ protected function createApplePass(\Jolicode\WalletKit\Pass\Apple\Model\PassType
279258 appLaunchURL: $ this ->common ->appLaunchURL ,
280259 webServiceURL: $ this ->common ->webServiceURL ,
281260 authenticationToken: $ this ->common ->authenticationToken ,
282- backgroundColor: $ this ->common ->appleBackgroundColor ,
283- foregroundColor: $ this ->common ->appleForegroundColor ,
284- labelColor: $ this ->common ->appleLabelColor ,
261+ backgroundColor: $ this ->common ->backgroundColor ,
262+ foregroundColor: $ this ->common ->foregroundColor ,
263+ labelColor: $ this ->common ->labelColor ,
285264 groupingIdentifier: $ this ->common ->groupingIdentifier ,
286265 expirationDate: $ this ->common ->appleExpirationDate ,
287266 voided: $ this ->common ->appleVoided ,
@@ -295,12 +274,6 @@ protected function primarySamsungBarcode(): ?SamsungBarcode
295274 return SamsungBarcodeMapper::fromFirstAppleBarcode ($ this ->common ->appleBarcodes );
296275 }
297276
298- protected function resolvedSamsungHexColor (): ?string
299- {
300- return $ this ->common ->googleHexBackgroundColor
301- ?? ColorMapper::appleRgbToGoogleHex ($ this ->common ->appleBackgroundColor );
302- }
303-
304277 /**
305278 * Builds the Samsung {@see Card} envelope shared by all verticals.
306279 */
0 commit comments