-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPLPayment.m
53 lines (46 loc) · 1.41 KB
/
PLPayment.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
//
// PLPayment.m
// Plate
//
// Created by Emile Baizel on 8/5/14.
// Copyright (c) 2014 Plate SF. All rights reserved.
//
#import "PLPayment.h"
@implementation PLPayment
@synthesize name;
@synthesize cardNumber;
@synthesize cardType;
@synthesize expiryMonth;
@synthesize expiryYear;
@synthesize lastFourDigits;
@synthesize paymentId;
@synthesize cvv;
- (void)readFromJSONDictionary:(NSDictionary *)d
{
self.name = [d objectForKey:@"name"];
self.lastFourDigits = [d objectForKey:@"lastFourDigits"];
self.paymentId = [d objectForKey:@"paymentId"];
self.cardType = [d objectForKey:@"cardType"];
self.cvv = [d objectForKey:@"cvv"];
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:name forKey:@"name"];
[aCoder encodeObject:lastFourDigits forKey:@"lastFourDigits"];
[aCoder encodeObject:cardType forKey:@"cardType"];
[aCoder encodeObject:paymentId forKey:@"paymentId"];
[aCoder encodeObject:cvv forKey:@"cvv"];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self) {
[self setName:[aDecoder decodeObjectForKey:@"name"]];
[self setLastFourDigits:[aDecoder decodeObjectForKey:@"lastFourDigits"]];
[self setCardType:[aDecoder decodeObjectForKey:@"cardType"]];
[self setPaymentId:[aDecoder decodeObjectForKey:@"paymentId"]];
[self setCvv:[aDecoder decodeObjectForKey:@"cvv"]];
}
return self;
}
@end