Open steveetm opened 5 months ago
Thanks for posting this stack trace, it is very useful. Do you have an idea of what method is in frame 6, apparently invoked via the completion callback of +[SMPSumUpSDK didCreateCheckout:error:fromViewController:completion:]
?
Honestly, not sure. We are using cordova, so it could be even cordova related stuff. But I can show you how we initiate the pay process in our plugin:
-(void) pay:(CDVInvokedUrlCommand *)command {
NSDecimal total = [(NSNumber*)[command.arguments objectAtIndex:0] decimalValue];
NSString* currency = [command.arguments objectAtIndex:1];
NSString* title = [command.arguments objectAtIndex:2];
CDVPluginResult* pluginResult = nil;
SMPCheckoutRequest *request = [SMPCheckoutRequest requestWithTotal:[NSDecimalNumber decimalNumberWithDecimal:total] title:title
currencyCode:currency
paymentOptions:SMPPaymentOptionAny];
[request setSkipScreenOptions:SMPSkipScreenOptionSuccess];
[SMPSumUpSDK checkoutWithRequest:request fromViewController:self.viewController completion:^(SMPCheckoutResult *result, NSError *error) {
CDVPluginResult* pluginResult = nil;
if (result.success) {
NSDictionary *card = result.additionalInfo[@"card"];
NSDictionary *dict = @{
@"transaction_code" : result.additionalInfo[@"transaction_code"],
@"card_type" : card[@"type"],
@"merchant_code" : result.additionalInfo[@"merchant_code"],
@"amount" : result.additionalInfo[@"amount"],
@"tip_amount" : result.additionalInfo[@"tip_amount"],
@"vat_amount" : result.additionalInfo[@"vat_amount"],
@"currency" : result.additionalInfo[@"currency"],
@"status" : result.additionalInfo[@"status"],
@"payment_type" : result.additionalInfo[@"payment_type"],
@"entry_mode" : result.additionalInfo[@"entry_mode"],
@"installments" : result.additionalInfo[@"installments"],
};
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict];
} else {
NSInteger errorCode = [error code];
NSDictionary *dict = @{
@"code" : @(errorCode),
@"message" : @"",
};
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dict];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
if (![SMPSumUpSDK checkoutInProgress]) {
NSDictionary *dict = @{
@"code" : @51,
@"message" : @""
};
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:dict];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
}
Hope you can spot something there. There is nothing too much there tho, the plugin is not too fancy, it can login/logout, open settings, and start payment process.
NSDictionary
will crash if you try to initialize any of its key's values to nil
.
Probably, for some reason, one or more entries are not present in result.additionalInfo
, and then when you try to retrieve them the dictionary returns nil
, which you then try to put into the new dictionary, but as it can't take nil
values, it crashes.
There are two things here.
Firstly, I would recommend rewriting it to add each key-value pair to the new dictionary only if the value is not nil
. One way to do this would be something like:
NSMutableDictionary *dict = [NSMutableDictionary new];
if (myValue != nil) {
[dict setValue:myValue forKey:@"MyKey"];
}
.
.
.
The second thing is we need to find out what is missing from result.additionalInfo
, and whether this is expected behavior from the SumUp SDK or not.
Thanks.
We don't really want to experiment with the workaround until we know what is the actual problem, as we use values from additionalInfo
, no idea how we should handle if the data we rely on is missing.
Waiting for the result of your investigation what is actually changed in the results and how to workaround that if those are breaking changes.
We have discovered that the previously available installments
is missing from additionalInfo
. Is there any strong reason why it was removed?
We are still investigating the cause of this change in our backend and will get back to you soon. Thanks for your patience on this.
We found that a changeover to a new system on the backend seems to be causing this issue. We switched back to the original system as a test and the installments key came back. We need more information from you to confirm this was the problem in your case. Could you please supply a (ideally non-test) Merchant ID (MID) where the issue occurred? You can post it here, or email it via integration@sumup.com with a reference to this ticket.
MCH9U6N3 MEMNUREP MZAYAP MFRGYZQF
These merchant ids were definitely affected. I'll try to test it again with the old code as time permits, thanks for the update.
@steveetm for these merchants we changed the backend to use the original system (around 4PM yesterday, Berlin time), until we have a proper fix, which is still in progress. If you have more MIDs to fix, please let us know.
@steveetm is this still an issue? I would like to close this.
Using SDK 4.4.0, everything was fine, since card reader got a firmware update it constantly crashing after payment finished. crashlog.txt SumUp Air software version: 2.0.0.7 Blutooth software: 0.0.7.30