package gw.plugin.billing uses gw.api.locale.DisplayKey uses gw.lang.Deprecated /** * Helper class to set localized values for a {@link PaymentPreviewItem}'s * {@code Type}, and if set {@code ChargeCategory} attributes. * * @deprecated Localization will be implicit in the 9.0 and later Billing System Plugin. */ @Deprecated(:value="Localization will be implicit in the 9.0 and later Billing System Plugin",:version="9.0.0") class PaymentPreviewItemLocalizationHelper { /** * Localize a {@link PaymentPreviewItem}'s {@link PaymentPreviewItem#getType() * Type}, and if set, {@link PaymentPreviewItem#getChargeCategory() * ChargeCategory} values. * * @param the {@link PaymentPreviewItem} whose values are to be localized. * @return The specified {@link PaymentPreviewItem}. */ static function localizeForDisplay(previewItem : PaymentPreviewItem) : PaymentPreviewItem { previewItem.setTypeDisplay(localizeType(previewItem.Type)) if (previewItem.ChargeCategory != null) { previewItem.setChargeCategoryDisplay( localizeChargeCategory(previewItem.ChargeCategory)) } return previewItem } private static function localizeType(invoiceItemType : String) : String { return DisplayKey.get( "Web.Policy.Payment.PreviewPayments.Type." + invoiceItemType) } private static function localizeChargeCategory(chargeCategory : String) : String { return DisplayKey.get( "Web.Policy.Payment.PreviewPayments.ChargeCategory." + chargeCategory) } }