getBrandingDetails method
Future<void>
getBrandingDetails(
)
Implementation
Future<void> getBrandingDetails() async {
loaderController.add(true);
String? encodedMerchantId = CryptoUtils.encrypt(
MerchantConstants.merchantId, KeywordConstants.internalKey);
await appRepository.getMerchantBrandingDetails(encodedMerchantId!).then(
(Response response) async {
//debugPrint('Get merchant branding details api response is ${response.body}');
MerchantBrandingDetailsResponse merchantBrandingDetailsResponse =
MerchantBrandingDetailsResponse.fromJson(json.decode(response.body));
if (merchantBrandingDetailsResponse.merchantBrandingDetails.isNotEmpty) {
String? strMerchantBrandingDetails = CryptoUtils.decrypt(
merchantBrandingDetailsResponse.merchantBrandingDetails,
MerchantConstants.merchantKey);
if (strMerchantBrandingDetails != null) {
MerchantBrandingDetails merchantBrandingDetails =
MerchantBrandingDetails.fromJson(
json.decode(strMerchantBrandingDetails));
//debugPrint('Decoded Merchant branding details are ${merchantBrandingDetails.integrationType}');
await SharedPreferenceUtils.saveMerchantDetails(
merchantBrandingDetails.logo,
merchantBrandingDetails.integrationType,
merchantBrandingDetails.merchantThemeDetails.headingBgColor,
merchantBrandingDetails.merchantThemeDetails.bgColor,
merchantBrandingDetails.merchantThemeDetails.menuColor,
merchantBrandingDetails.merchantThemeDetails.footerColor);
}
}
loaderController.add(false);
}, onError: (dynamic e) {
loaderController.add(false);
//debugPrint('Get merchant branding details api exception is ${e.toString()}');
});
}