39 lines
910 B
Mathematica
39 lines
910 B
Mathematica
|
|
//
|
||
|
|
// KBPayProductModel.m
|
||
|
|
// keyBoard
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "KBPayProductModel.h"
|
||
|
|
#import <MJExtension/MJExtension.h>
|
||
|
|
|
||
|
|
@implementation KBPayProductModel
|
||
|
|
|
||
|
|
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
|
||
|
|
return @{
|
||
|
|
@"identifier": @"id",
|
||
|
|
@"productDescription": @"description",
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSString *)coinsDisplayText {
|
||
|
|
NSString *name = self.name ?: @"";
|
||
|
|
NSString *unit = self.unit ?: @"";
|
||
|
|
if (name.length && unit.length) {
|
||
|
|
return [NSString stringWithFormat:@"%@ %@", name, unit];
|
||
|
|
}
|
||
|
|
if (name.length) { return name; }
|
||
|
|
if (unit.length) { return unit; }
|
||
|
|
return @"";
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSString *)priceDisplayText {
|
||
|
|
NSString *currency = self.currency ?: @"";
|
||
|
|
double priceValue = self.price;
|
||
|
|
if (currency.length > 0) {
|
||
|
|
return [NSString stringWithFormat:@"%@%.2f", currency, priceValue];
|
||
|
|
}
|
||
|
|
return [NSString stringWithFormat:@"%.2f", priceValue];
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|