即使在致电[PayPalMobile clearAllUserData]后,Paypal ios SDK也无法清除以前使用过的信用卡

时间:2014-07-26 05:08:36

标签: ios paypal card.io

我正在将Paypal ios SDK 2.1版集成到我的应用程序中,但遇到了问题。 即使我在付款完成后致电[PayPalMobile clearAllUserData],SDK似乎也会将过期的支付卡留在内存中。

@interface AirliftCartViewController : AirliftViewController <AVCaptureMetadataOutputObjectsDelegate, UITableViewDelegate, AirliftCartTotalsChangeDelegate, PayPalPaymentDelegate>
    @property (strong) AVCaptureSession * captureSession;
    @property (strong, nonatomic) UIView *cameraPreview;
    @property (nonatomic, strong, readwrite) PayPalConfiguration *payPalConfiguration;
    - (IBAction)initiateCreditCardCheckout:(id)sender;
@end
...
@implementation AirliftCartViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil timeout:(NSUInteger)timeoutInSeconds screenName:(NSString *)screenName
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil timeout:timeoutInSeconds screenName:@"AirliftCartView"];
    if (self) {
        // Custom initialization
        self.payPalConfiguration = [[PayPalConfiguration alloc] init];
        self.payPalConfiguration.rememberUser = NO;
    }

    return self;
}



- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController
{
    NSLog(@"payment cancelled!");
    // The payment was canceled; dismiss the PayPalPaymentViewController.
    [paymentViewController dismissViewControllerAnimated:YES completion:^{
        // clear all paypal user information
        [PayPalMobile clearAllUserData];
    }];
}

- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
    NSLog(@"Payment was successful");
    // Payment was processed successfully; send to server for verification and fulfillment.
    [self verifyCompletedPayment:completedPayment];

    // Dismiss the PayPalPaymentViewController.
    [paymentViewController dismissViewControllerAnimated:YES completion:^{

    // clear all paypal user information
    [PayPalMobile clearAllUserData];

    // emptycart
    [self.cartController emptyCart];

    // reset metadata
    [self.metaDataFound removeAllObjects];

}

- (IBAction)initiateCheckout:(id)sender {
    NSLog(@"checkout requested!");
    [PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];

    // present paypal payment
    PayPalPaymentViewController * payPalVC = [[PayPalPaymentViewController alloc]
                                          initWithPayment:[self.cartController getPayPalPaymentFromCart]
                                          configuration:self.payPalConfiguration delegate:self];

    [self presentViewController:payPalVC animated:YES completion:^{
        [self.captureSession stopRunning];
        [self.cameraPreview removeFromSuperview];
    }];
}


@end

我像这样展示PayPalPaymentViewController(因此我无法对其进行强烈的引用)

我的应用程序保留任何卡信息,任何人的想法都不能接受吗?

编辑:按要求添加用户步骤:

  • 用户选择要购买的产品,然后点击checkout按钮,该按钮具有initiateCheckout作为其动作。
  • 这会调出paypalpaymentviewcpntroller,它显示以前使用的卡作为唯一的支付选项(我第一次启动控制器时可以选择登录贝宝或使用卡)

编辑2:添加了captureSessioncameraPreview的属性声明以及展开的init定义

编辑3:添加了截图

initial checkout second checkout

2 个答案:

答案 0 :(得分:1)

戴夫来自PayPal。

几个问题:

(1)您的captureSessioncameraPreview发生了什么?

(2)从用户的角度来看,您能否提供一系列具体步骤来重现您的问题?

(3)SDK将卡数据保存在内存中的指示是什么?

(4)您运行的是哪个版本的SDK?我猜它是最新版本之一,2.1.5或2.1.6?

*编辑(2014年8月1日):最初描述的错误已在我们的latest release中修复。 *

答案 1 :(得分:0)

您还可以在PayPalConfiguration https://github.com/paypal/PayPal-iOS-SDK/blob/master/PayPalMobile/PayPalConfiguration.h#L57中设置remeberUser = NO,因此SDK甚至不会尝试保存任何内容。