Swift 3 Paypal付款未处理

时间:2016-11-02 06:55:10

标签: ios swift paypal

Swift 2 Paypal演示

https://github.com/paypal/PayPal-iOS-SDK/tree/master/SampleApp-Swift/PayPal-iOS-SDK-Sample-App

@NgModule({
  declarations: [
    MyAppComponent
    ...
  ],
  providers: [],
  imports: [CdfMediaModule],
  exports: [
    MyAppComponent
    ...
  ]
})
export class AppModule {
}

Swift 3改变

if (payment.processable) 
{
  let paymentViewController = PayPalPaymentViewController(payment: payment,    configuration: payPalConfig, delegate: self)
  present(paymentViewController!, animated: true, completion: nil)
}

else 
{

   print("Payment not processalbe: \(payment)")
}

swift 3回复是

    if (payment?.processable)!
    {
        let paymentViewController = PayPalPaymentViewController(payment: payment, configuration: payPalConfig, delegate: self)
        present(paymentViewController!, animated: true, completion: nil)
    }      
   else
    {
      print("Payment not processalbe: \(payment)")
    }

它在swift 2中正常工作但我按照swift 3改为代码

  PayPal SDK: PayPalPayment not processable: if paymentDetails are provided, then subtotal must be positive.
Payment not processalbe: Optional(

   CurrencyCode: USD
   Amount: 8.49
   Short Description: Hipster Clothing
   Intent: sale
   Processable: No
   Display: $8.49
   Confirmation: (null)
   Details: Subtotal: 0, Shipping: 5.99, Tax: 2.5
   Shipping Address: (null)
   Invoice Number: (null)
   Custom: (null)
   Soft Descriptor: (null)
   BN code: (null)
   Item: 'Optional({2|Old jeans with holes|84.99|USD|Hip-0037})'
   Item: 'Optional({1|Free rainbow patch|0.00|USD|Hip-00066})'
   Item: 'Optional({1|Long-sleeve plaid shirt (mustache not   included)|37.99|USD|Hip-00291})')



if (payment.processable) 

如果我按照swift 3使用它,那么响应高于swift3的更多更改。

0 个答案:

没有答案