【发布时间】:2014-06-01 09:19:42
【问题描述】:
大家好,我是这个专业网站的新手。实际上,我在 PayPal iOS SDK 2.0.5 中遇到了问题。这个 sdk 是从 github 下载的,现在当我尝试登录 paypal 时,它没有进行身份验证 谁能告诉为什么会发生这种情况,并且付款也没有从个人帐户转移到企业帐户中 谢谢 请帮帮我
这是链接 https://github.com/paypal/PayPal-iOS-SDK/archive/master.zip
#define kPayPalEnvironment PayPalEnvironmentNoNetwork
@interface ZZMainViewController ()
@property(nonatomic, strong, readwrite) IBOutlet UIButton *payNowButton;
@property(nonatomic, strong, readwrite) IBOutlet UIButton *payFutureButton;
@property(nonatomic, strong, readwrite) IBOutlet UIView *successView;
@property(nonatomic, strong, readwrite) PayPalConfiguration *payPalConfig;
@end
@implementation ZZMainViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"PayPal SDK Demo";
// Set up payPalConfig
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = YES;
_payPalConfig.languageOrLocale = @"en";
_payPalConfig.merchantName = @"Awesome Shirts, Inc.";
_payPalConfig.merchantPrivacyPolicyURL = [NSURL URLWithString:@"https://www.paypal.com/webapps/mpp/ua/privacy-full"];
_payPalConfig.merchantUserAgreementURL = [NSURL URLWithString:@"https://www.paypal.com/webapps/mpp/ua/useragreement-full"];
// Setting the languageOrLocale property is optional.
//
// If you do not set languageOrLocale, then the PayPalPaymentViewController will present
// its user interface according to the device's current language setting.
//
// Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
// locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
// to use that language/locale.
//
// For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];
// Do any additional setup after loading the view, typically from a nib.
self.successView.hidden = YES;
// use default environment, should be Production in real life
self.environment = kPayPalEnvironment;
NSLog(@"PayPal iOS SDK version: %@", [PayPalMobile libraryVersion]);
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:YES];
// Preconnect to PayPal early
[PayPalMobile preconnectWithEnvironment:self.environment];
}
#pragma mark - Receive Single Payment
- (IBAction)pay {
// Remove our last completed payment, just for demo purposes.
self.resultText = nil;
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:@"9.95"];
payment.currencyCode = @"USD";
payment.shortDescription = @"Hipster t-shirt";
if (!payment.processable) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
}
// Update payPalConfig re accepting credit cards.
self.payPalConfig.acceptCreditCards = self.acceptCreditCards;
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfig
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment {
NSLog(@"PayPal Payment Success!");
self.resultText = [completedPayment description];
[self showSuccess];
[self sendCompletedPaymentToServer:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
NSLog(@"PayPal Payment Canceled");
self.resultText = nil;
self.successView.hidden = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark Proof of payment validation
- (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
// TODO: Send completedPayment.confirmation to server
NSLog(@"Here is your proof of payment:\n\n%@\n\nSend this to your server for c onfirmation and fulfillment.", completedPayment.confirmation);
}
#pragma mark - Authorize Future Payments
- (IBAction)getUserAuthorization:(id)sender {
PayPalFuturePaymentViewController *futurePaymentViewController = [[PayPalFuturePaymentViewController alloc] initWithConfiguration:self.payPalConfig delegate:self];
[self presentViewController:futurePaymentViewController animated:YES completion:nil];
}
#pragma mark PayPalFuturePaymentDelegate methods
- (void)payPalFuturePaymentViewController:(PayPalFuturePaymentViewController *)futurePaymentViewController didAuthorizeFuturePayment:(NSDictionary *)futurePaymentAuthorization {
NSLog(@"PayPal Future Payment Authorization Success!");
self.resultText = futurePaymentAuthorization[@"code"];
[self showSuccess];
[self sendAuthorizationToServer:futurePaymentAuthorization];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)payPalFuturePaymentDidCancel:(PayPalFuturePaymentViewController *)futurePaymentViewController {
NSLog(@"PayPal Future Payment Authorization Canceled");
self.successView.hidden = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)sendAuthorizationToServer:(NSDictionary *)authorization {
// TODO: Send authorization to server
NSLog(@"Here is your authorization:\n\n%@\n\nSend this to your server to complete future payment setup.", authorization);
}
#pragma mark - Helpers
- (void)showSuccess {
self.successView.hidden = NO;
self.successView.alpha = 1.0f;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:2.0];
self.successView.alpha = 0.0f;
[UIView commitAnimations];
}
#pragma mark - Flipside View Controller
- (void)flipsideViewControllerDidFinish:(ZZFlipsideViewController *)controller {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[self dismissViewControllerAnimated:YES completion:nil];
} else {
[self.flipsidePopoverController dismissPopoverAnimated:YES];
self.flipsidePopoverController = nil;
}
}
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
self.flipsidePopoverController = nil;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"pushSettings"]) {
[[segue destinationViewController] setDelegate:self];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIPopoverController *popoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
self.flipsidePopoverController = popoverController;
popoverController.delegate = self;
}
}
}
- (IBAction)togglePopover:(id)sender {
if (self.flipsidePopoverController) {
[self.flipsidePopoverController dismissPopoverAnimated:YES];
self.flipsidePopoverController = nil;
} else {
[self performSegueWithIdentifier:@"showAlternate" sender:sender];
}
}
@end
【问题讨论】:
-
你的代码在哪里? (捂脸)
-
实际上这个sdk记录了任何电子邮件和用户ID...我从developer.paypal.com/webapps/developer/docs/integration/mobile/…这里下载了这个sdk
-
这里是来自 PayPal 的戴夫。看起来您只是在尝试运行 PayPal iOS SDK 附带的示例应用程序,对吧?至少,这是您粘贴到问题中的代码。如果是这种情况,请提供您在运行应用程序时所遵循的具体步骤,并说明哪些行为与您的预期不符。或者,如果您已将 SDK 集成到您自己的应用程序中,请显示相关代码(来自您的应用程序)。然后,请提供您在运行应用程序时遵循的具体步骤,并说明哪些行为不是您所期望的。谢谢!
-
是的,你说得对,我只是想运行 paypal ios SDK 附带的示例应用程序,当我运行这个应用程序时,它会询问电子邮件 ID 和密码,当我在其中输入任何内容时这两个盒子然后它接受。现在我想知道为什么这不验证电子邮件 ID 和密码,为什么不给出错误电子邮件 ID 和密码的错误消息。
-
实际上我是第一次实施贝宝,所以我对此不太了解,所以请指导我谢谢