BTThreeDSecureAdditionalInformation.m 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #import "BTThreeDSecureAdditionalInformation_Internal.h"
  2. #import "BTThreeDSecurePostalAddress_Internal.h"
  3. @implementation BTThreeDSecureAdditionalInformation
  4. - (NSDictionary *)asParameters {
  5. NSMutableDictionary *parameters = [@{} mutableCopy];
  6. if (self.shippingAddress) {
  7. [parameters addEntriesFromDictionary:[self.shippingAddress asParametersWithPrefix:@"shipping"]];
  8. }
  9. [self insertIfExists:self.shippingMethodIndicator key:@"shippingMethodIndicator" dictionary:parameters];
  10. [self insertIfExists:self.productCode key:@"productCode" dictionary:parameters];
  11. [self insertIfExists:self.deliveryTimeframe key:@"deliveryTimeframe" dictionary:parameters];
  12. [self insertIfExists:self.deliveryEmail key:@"deliveryEmail" dictionary:parameters];
  13. [self insertIfExists:self.reorderIndicator key:@"reorderIndicator" dictionary:parameters];
  14. [self insertIfExists:self.preorderIndicator key:@"preorderIndicator" dictionary:parameters];
  15. [self insertIfExists:self.preorderDate key:@"preorderDate" dictionary:parameters];
  16. [self insertIfExists:self.giftCardAmount key:@"giftCardAmount" dictionary:parameters];
  17. [self insertIfExists:self.giftCardCurrencyCode key:@"giftCardCurrencyCode" dictionary:parameters];
  18. [self insertIfExists:self.giftCardCount key:@"giftCardCount" dictionary:parameters];
  19. [self insertIfExists:self.accountAgeIndicator key:@"accountAgeIndicator" dictionary:parameters];
  20. [self insertIfExists:self.accountCreateDate key:@"accountCreateDate" dictionary:parameters];
  21. [self insertIfExists:self.accountChangeIndicator key:@"accountChangeIndicator" dictionary:parameters];
  22. [self insertIfExists:self.accountChangeDate key:@"accountChangeDate" dictionary:parameters];
  23. [self insertIfExists:self.accountPwdChangeIndicator key:@"accountPwdChangeIndicator" dictionary:parameters];
  24. [self insertIfExists:self.accountPwdChangeDate key:@"accountPwdChangeDate" dictionary:parameters];
  25. [self insertIfExists:self.shippingAddressUsageIndicator key:@"shippingAddressUsageIndicator" dictionary:parameters];
  26. [self insertIfExists:self.shippingAddressUsageDate key:@"shippingAddressUsageDate" dictionary:parameters];
  27. [self insertIfExists:self.transactionCountDay key:@"transactionCountDay" dictionary:parameters];
  28. [self insertIfExists:self.transactionCountYear key:@"transactionCountYear" dictionary:parameters];
  29. [self insertIfExists:self.addCardAttempts key:@"addCardAttempts" dictionary:parameters];
  30. [self insertIfExists:self.accountPurchases key:@"accountPurchases" dictionary:parameters];
  31. [self insertIfExists:self.fraudActivity key:@"fraudActivity" dictionary:parameters];
  32. [self insertIfExists:self.shippingNameIndicator key:@"shippingNameIndicator" dictionary:parameters];
  33. [self insertIfExists:self.paymentAccountIndicator key:@"paymentAccountIndicator" dictionary:parameters];
  34. [self insertIfExists:self.paymentAccountAge key:@"paymentAccountAge" dictionary:parameters];
  35. [self insertIfExists:self.addressMatch key:@"addressMatch" dictionary:parameters];
  36. [self insertIfExists:self.accountID key:@"accountId" dictionary:parameters];
  37. [self insertIfExists:self.ipAddress key:@"ipAddress" dictionary:parameters];
  38. [self insertIfExists:self.orderDescription key:@"orderDescription" dictionary:parameters];
  39. [self insertIfExists:self.taxAmount key:@"taxAmount" dictionary:parameters];
  40. [self insertIfExists:self.userAgent key:@"userAgent" dictionary:parameters];
  41. [self insertIfExists:self.authenticationIndicator key:@"authenticationIndicator" dictionary:parameters];
  42. [self insertIfExists:self.installment key:@"installment" dictionary:parameters];
  43. [self insertIfExists:self.purchaseDate key:@"purchaseDate" dictionary:parameters];
  44. [self insertIfExists:self.recurringEnd key:@"recurringEnd" dictionary:parameters];
  45. [self insertIfExists:self.recurringFrequency key:@"recurringFrequency" dictionary:parameters];
  46. [self insertIfExists:self.sdkMaxTimeout key:@"sdkMaxTimeout" dictionary:parameters];
  47. [self insertIfExists:self.workPhoneNumber key:@"workPhoneNumber" dictionary:parameters];
  48. return [parameters copy];
  49. }
  50. - (void)insertIfExists:(NSString *)param key:(NSString *)key dictionary:(NSMutableDictionary *)dictionary{
  51. if (param != nil && key != nil && dictionary != nil) {
  52. dictionary[key] = param;
  53. }
  54. }
  55. @end