SiriKit payment confirmation currency is always US$

一曲冷凌霜 提交于 2019-12-07 02:41:13

问题


I build Intents Extension and I'm handling INSendMoneyIntent and I'm saying:

Send 25€ to John Smith

response after app confrimation

Here's your <Your_App> payment for US$25.00. Do you want to send it?

Intent contains proper currency iso 3 code - EUR, so why siri displays wrong currency in payment confirmation?

returning intent

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

回答1:


You need to add a paymentRecord to your response in

(void)confirmSendPayment:(INSendPaymentIntent *)intent

like so:

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);



回答2:


Agree with Julius' answer but it doesn't show where to set the currency. You can create a method

- (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;

}

And then from the delegate method you just slot the paymentrecord assignment between your above two statements:

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

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

    completion(response);


来源:https://stackoverflow.com/questions/39122198/sirikit-payment-confirmation-currency-is-always-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!