I am trying to resolve the parameter for the INSendPaymentIntent such that the amount should never be less than zero. The build fails with an error in the else block saying
'/Users/xx/Documents/Appcelerator_Studio_Workspace/SiriTestApp/extensions/SiriTestApp/siritestapp/IntentHandler.swift:123:79: Cannot convert value of type 'NSDecimalNumber' to expected argument type 'INCurrencyAmount'.
It expects an INCurrencyAmount type object. What is the wrong in the code?
// Called when you need to resolve the currency amount to be transferred.
func resolveCurrencyAmount(forSendPayment intent: INSendPaymentIntent, with completion: @escaping (INCurrencyAmountResolutionResult) -> Void) {
// Resolve the currency amount.
if let currencyAmount = intent.currencyAmount, let amount = currencyAmount.amount{
if amount.intValue <= 0 {
// The amount needs to be a positive value.
completion(INCurrencyAmountResolutionResult.unsupported())
}else{
completion(INCurrencyAmountResolutionResult.success(with: amount ))
}
}
}