Changeset 202655 in webkit
- Timestamp:
- Jun 29, 2016 3:41:15 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202647 r202655 1 2016-06-29 Anders Carlsson <andersca@apple.com> 2 3 Add "type" and "paymentPass" properties in PaymentMethod 4 https://bugs.webkit.org/show_bug.cgi?id=159278 5 rdar://problem/26999112 6 7 Reviewed by Dean Jackson. 8 9 * Modules/applepay/cocoa/PaymentMethodCocoa.mm: 10 (WebCore::toString): 11 (WebCore::toDictionary): 12 1 13 2016-06-29 Nan Wang <n_wang@apple.com> 2 14 -
trunk/Source/WebCore/Modules/applepay/cocoa/PaymentMethodCocoa.mm
r202309 r202655 34 34 namespace WebCore { 35 35 36 static NSString *toString(PKPaymentPassActivationState paymentPassActivationState) 37 { 38 switch (paymentPassActivationState) { 39 case PKPaymentPassActivationStateActivated: 40 return @"activated"; 41 case PKPaymentPassActivationStateRequiresActivation: 42 return @"requiresActivation"; 43 case PKPaymentPassActivationStateActivating: 44 return @"activating"; 45 case PKPaymentPassActivationStateSuspended: 46 return @"suspended"; 47 case PKPaymentPassActivationStateDeactivated: 48 return @"deactivated"; 49 default: 50 return nil; 51 } 52 } 53 54 static RetainPtr<NSDictionary> toDictionary(PKPaymentPass *paymentPass) 55 { 56 auto result = adoptNS([[NSMutableDictionary alloc] init]); 57 58 [result setObject:paymentPass.primaryAccountIdentifier forKey:@"primaryAccountIdentifier"]; 59 [result setObject:paymentPass.primaryAccountNumberSuffix forKey:@"primaryAccountNumberSuffix"]; 60 if (NSString *deviceAccountIdentifier = paymentPass.deviceAccountIdentifier) 61 [result setObject:deviceAccountIdentifier forKey:@"deviceAccountIdentifier"]; 62 if (NSString *deviceAccountNumberSuffix = paymentPass.deviceAccountNumberSuffix) 63 [result setObject:deviceAccountNumberSuffix forKey:@"deviceAccountNumberSuffix"]; 64 if (NSString *activationState = toString(paymentPass.activationState)) 65 [result setObject:activationState forKey:@"activationState"]; 66 67 return result; 68 } 69 70 static NSString *toString(PKPaymentMethodType paymentMethodType) 71 { 72 switch (paymentMethodType) { 73 case PKPaymentMethodTypeDebit: 74 return @"debit"; 75 case PKPaymentMethodTypeCredit: 76 return @"credit"; 77 case PKPaymentMethodTypePrepaid: 78 return @"prepaid"; 79 case PKPaymentMethodTypeStore: 80 return @"store"; 81 default: 82 return nil; 83 } 84 } 85 36 86 RetainPtr<NSDictionary> toDictionary(PKPaymentMethod *paymentMethod) 37 87 { … … 43 93 if (NSString *network = paymentMethod.network) 44 94 [result setObject:network forKey:@"network"]; 95 96 if (NSString *paymentMethodType = toString(paymentMethod.type)) 97 [result setObject:paymentMethodType forKey:@"type"]; 98 99 if (PKPaymentPass *paymentPass = paymentMethod.paymentPass) 100 [result setObject:toDictionary(paymentPass).get() forKey:@"paymentPass"]; 45 101 46 102 return result;
Note: See TracChangeset
for help on using the changeset viewer.