/
ExtendedAmountType.m
executable file
·72 lines (55 loc) · 1.82 KB
/
ExtendedAmountType.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// ExtendedAmountType.m
// ANMobilePaymentLib
//
// Created by Authorize.Net on 3/21/11.
// Copyright 2011 none. All rights reserved.
//
#import "ExtendedAmountType.h"
#import "NSString+stringWithXMLTag.h"
#import "NSString+stringValueOfXMLElement.h"
@implementation ExtendedAmountType
@synthesize amount;
@synthesize name;
@synthesize amountDescription;
+ (ExtendedAmountType *)extendedAmountType {
ExtendedAmountType *e = [[ExtendedAmountType alloc] init];
return e;
}
- (id) init {
self = [super init];
if (self) {
self.amount = nil;
self.name = nil;
self.amountDescription = nil;
}
return self;
}
- (NSString *) description {
NSString * s = [NSString stringWithFormat:@""
"ExtendedAmountType.amount = %@\n"
"ExtendedAmountType.name = %@\n"
"ExtendedAmountType.amountDescription = %@\n",
self.amount,
self.name,
self.amountDescription];
return s;
}
- (NSString *)stringOfXMLRequest {
NSString *s = [NSString stringWithFormat:@""
@"%@" //amount
@"%@" //name
@"%@", //amountDescription
[NSString stringWithXMLTag:@"amount" andValue:self.amount],
[NSString stringWithXMLTag:@"name" andValue:self.name],
[NSString stringWithXMLTag:@"description" andValue:self.amountDescription]];
return s;
}
+ (ExtendedAmountType *)buildExtendedAmountType:(GDataXMLElement *)element {
ExtendedAmountType *a = [ExtendedAmountType extendedAmountType];
a.amount = [NSString stringValueOfXMLElement:element withName:@"amount"];
a.name = [NSString stringValueOfXMLElement:element withName:@"name"];
a.amountDescription = [NSString stringValueOfXMLElement:element withName:@"description"];
return a;
}
@end