PPOTOAuth2SwitchRequest.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // PPOTOAuth2SwitchRequest.m
  3. // PayPalOneTouch
  4. //
  5. // Copyright © 2014 PayPal, Inc. All rights reserved.
  6. //
  7. #import "PPOTOAuth2SwitchRequest.h"
  8. #if __has_include("PPOTMacros.h")
  9. #import "PPOTMacros.h"
  10. #else
  11. #import <PayPalUtils/PPOTMacros.h>
  12. #endif
  13. @implementation PPOTOAuth2SwitchRequest
  14. - (NSDictionary *)payloadDictionary {
  15. NSMutableDictionary *payload = [[super payloadDictionary] mutableCopy];
  16. if (self.scope.count) {
  17. payload[kPPOTAppSwitchScopesKey] = [self.scope componentsJoinedByString:@" "];
  18. }
  19. if (self.customURL.length) {
  20. payload[kPPOTAppSwitchEnvironmentURLKey] = self.customURL;
  21. }
  22. if (self.privacyURL.length) {
  23. payload[kPPOTAppSwitchPrivacyURLKey] = self.privacyURL;
  24. }
  25. if (self.agreementURL.length) {
  26. payload[kPPOTAppSwitchAgreementURLKey] = self.agreementURL;
  27. }
  28. if (self.merchantName.length) {
  29. // update name, the reason it can be localized or maybe more complete and shortcuted for better display
  30. payload[kPPOTAppSwitchAppNameKey] = self.merchantName;
  31. }
  32. return payload;
  33. }
  34. @end