6

我构建了 Intents Extension,我正在处理 INSendMoneyIntent,我说:

寄 25 欧元给约翰·史密斯

应用确认后的响应

这是您的 <Your_App> 付款 25.00 美元。您要发送吗?

Intent 包含正确的货币 iso 3 代码 - EUR,那么为什么 siri 在付款确认中显示错误的货币?

返回意图

INSendPaymentIntentResponse *reponse = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
completion(reponse);
4

2 回答 2

6

您需要在您的回复中添加一个 paymentRecord

(void)confirmSendPayment:(INSendPaymentIntent *)intent

像这样:

INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeReady userActivity:userActivity];
response.paymentRecord = [[INPaymentRecord alloc] initWithPayee:intent.payee payer:nil currencyAmount:intent.currencyAmount paymentMethod:nil note:intent.note status:INPaymentStatusPending];
completion(response);
于 2016-09-19T15:18:59.963 回答
1

同意朱利叶斯的回答,但它没有显示在哪里设置货币。您可以创建一个方法

- (INPaymentRecord *) getPaymentRecord:(INSendPaymentIntent *)intent
{
    INCurrencyAmount *currAmount = [[INCurrencyAmount alloc] initWithAmount: intent.currencyAmount currencyCode:@"ZAR"];
    INPaymentMethod *paymentMethod = [[INPaymentMethod alloc] initWithType:INPaymentMethodTypeCredit name:@"" identificationHint:@"" icon:nil];
    INPaymentRecord *paymentRecord = [[INPaymentRecord alloc] initWithPayee:nil payer:nil currencyAmount: intent.currencyAmount paymentMethod:paymentMethod note:nil status:INPaymentStatusCompleted ];
return paymentRecord;

}

然后从委托方法中,您只需在上述两个语句之间插入 paymentrecord 分配:

    INSendPaymentIntentResponse *response = [[INSendPaymentIntentResponse alloc] initWithCode:INSendPaymentIntentResponseCodeSuccess userActivity:nil];

    **response.paymentRecord = [self getPaymentRecord:intent];**

    completion(response);
于 2016-10-19T09:25:01.703 回答