gpt4 book ai didi

ios6 - PayPal MPL iOS SDK 中的无效参数小计

转载 作者:太空宇宙 更新时间:2023-11-03 16:34:09 24 4
gpt4 key购买 nike

当我尝试通过 PayPal MPL 处理自适应支付交易时,出现“无效参数小计”错误。如果金额 < 10000 则效果很好,但如果金额 > 10000 则效果不佳。这是我的代码

    -(void)processSplitPaymentWithAdminPayPalId:(NSString*)adminId sellerPayPalId:(NSString*)sellerId withAdminPercentage:(NSNumber*)adminPercentage forTotalAmount:(NSNumber*)totalAmount andShippingCharges:(NSNumber*)shippingCharges
{
DLog(@"!!!--------------------------------------");
DLog(@"AdminID: %@",adminId);
DLog(@"SellerID: %@",sellerId);
DLog(@"Admin Percentage: %@",adminPercentage);
DLog(@"Total Amount: %@",totalAmount);
DLog(@"Shipping Charges: %@",shippingCharges);
DLog(@"!!!--------------------------------------");

PayPal *ppMEP = [PayPal getPayPalInst];
ppMEP.shippingEnabled = FALSE;
ppMEP.dynamicAmountUpdateEnabled = FALSE;
ppMEP.feePayer = FEEPAYER_EACHRECEIVER;
PayPalAdvancedPayment *payment = [[[PayPalAdvancedPayment alloc] init] autorelease];
payment.paymentCurrency = @"AUD";

payment.receiverPaymentDetails = [NSMutableArray array];

NSArray *emails = nil;
if ([adminPercentage doubleValue]>0.0) {
emails = [[NSArray alloc]initWithObjects:adminId,sellerId, nil];
}
else {
emails = [[NSArray alloc]initWithObjects:sellerId, nil];
}


for (int i = 0; i < emails.count; i++)
{
PayPalReceiverPaymentDetails *details = [[[PayPalReceiverPaymentDetails
alloc] init] autorelease];

details.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];

float adminAmount = [adminPercentage floatValue];
float sellerAmount = [totalAmount floatValue] - adminAmount;

switch (i) {
case 0:
if (emails.count>1) {
// Admin commission
details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",adminAmount]];
NSLog(@"Admin commission::details.subTotal: %@",details.subTotal);
details.description = @"Amount paid to Admin as a Commission";
details.merchantName = [NSString stringWithFormat:@"%@",ADMIN];
}
else {
// Seller amount
details.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%@",shippingCharges]];
details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",sellerAmount]];
NSLog(@"Seller amount 1::details.subTotal: %@",details.subTotal);
details.description = [NSString stringWithFormat:@"Amount paid to Seller :%@",self.product.sellerName];
details.merchantName = [NSString stringWithFormat:@"%@ : %@",SELLER,self.product.sellerName];
}
break;
case 1:
// Seller amount
details.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%@",shippingCharges]];
details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",sellerAmount]];
NSLog(@"Seller amount 2::details.subTotal: %@",details.subTotal);
details.description = [NSString stringWithFormat:@"Amount paid to Seller :%@",self.product.sellerName];
details.merchantName = [NSString stringWithFormat:@"%@ : %@",SELLER,self.product.sellerName];
break;
default:
break;
}
details.recipient = [emails objectAtIndex:i];
[payment.receiverPaymentDetails addObject:details];
}
[ppMEP advancedCheckoutWithPayment:payment];
[emails release];
}

这是我用来处理交易的值

2013-07-24 11:28:20.234 AppName[6602:907] !!!--------------------------------------
2013-07-24 11:28:20.236 AppName[6602:907] AdminID: admin@gmail.com
2013-07-24 11:28:20.237 AppName[6602:907] SellerID: seller@gmail.com
2013-07-24 11:28:20.239 AppName[6602:907] Admin Percentage: 2.30
2013-07-24 11:28:20.240 AppName[6602:907] Total Amount: 30000
2013-07-24 11:28:20.241 AppName[6602:907] Shipping Charges: 0
2013-07-24 11:28:20.242 AppName[6602:907] !!!--------------------------------------

当我打印管理员和卖家的小计时,它会显示以下值

2013-07-24 12:21:44.685 AppName[6720:907] Admin commission::details.subTotal: 2.3
2013-07-24 12:21:44.687 AppName[6720:907] Seller amount 2::details.subTotal: 29997.7

所以总数是 29997.7+2.3 = 30000,这是正确的。那为什么我会收到这个错误?

我遇到了这个问题 iOS - PayPal integration - "Invalid parameter Subtotal" error这告诉我有 10000 的限制。这个限制是否导致了我这个错误?

我在 Paypal 的 LIVE ENVIRONMENT 中遇到此错误。 谢谢。

更新我用 AU$12700 测试了新交易,我得到了同样的错误。所以我认为这是一个限制问题。谁能证实这一点?

最佳答案

关于ios6 - PayPal MPL iOS SDK 中的无效参数小计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17827245/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com