nicolasgomollon / AppSales-Mobile

AppSales allows iOS and Mac App Store developers to download and analyze their daily and weekly sales reports from iTunes Connect.
39 stars 10 forks source link

Initial payment download, exception crash #31

Closed ddaddy closed 5 years ago

ddaddy commented 7 years ago

When I reinstall the app from scratch and refresh, on the initial loading of Payments it crashes. (I have temporarily hardcoded an accessToken so it can download latest reports).

It seems to download 1 payment which shows up, but the next payment seems to be Null.

        amount = "0.00";
        bankName = "";
        currency = GBP;
        isPaymentExpected = 0;
        lastFourDigitOfBankAccountNumber = "";
        maskedBankAccount = "";
        paidOrExpectingPaymentDate = "";
        proceedsByRegion =         (
                        {
                adjustmentAmount = 0;
                availableReportTypes =                 (
                                        {
                        displayKey = "ITC.Financial.MZPaymentConsolidation.reportType.FINANCIAL_REPORT";
                        name = "FINANCIAL_REPORT";
                    }
                );
                beginBalance = "";
                earned = "0.00";
                exchangeRate = "";
                inputTax = 0;
                proceeds = 0;
                regionCurrency =                 {
                    currencyCode = NOK;
                    regionCurrencyId = 10060;
                    regionId = 10040;
                    regionName = Norway;
                    regionNameKey = "ITC.Financial.MZPaymentConsolidation.region.NO";
                };
                taxesAndFees = 0;
                total = "0.00";
                totalOwed = "0.00";
                unitsSold = 0;
                withHoldingTax = 0;
            },
                        {
                adjustmentAmount = 0;
                availableReportTypes =                 (
                                        {
                        displayKey = "ITC.Financial.MZPaymentConsolidation.reportType.FINANCIAL_REPORT";
                        name = "FINANCIAL_REPORT";
                    }
                );
                beginBalance = "";
                earned = "0.00";
                exchangeRate = "";
                inputTax = 0;
                proceeds = 0;
                regionCurrency =                 {
                    currencyCode = TWD;
                    regionCurrencyId = 10066;
                    regionId = 10046;
                    regionName = Taiwan;
                    regionNameKey = "ITC.Financial.MZPaymentConsolidation.region.TW";
                };
                taxesAndFees = 0;
                total = "0.00";
                totalOwed = "0.00";
                unitsSold = 0;
                withHoldingTax = 0;
            }
        );
        rejectMessageKey = "<null>";
        returnMessage = "<null>";
        status = "PENDING_PAYMENT";
    }
screen shot 2017-07-29 at 12 22 50
ddaddy commented 7 years ago

It might be caused by me having 2 Vendor ID's associated with this account as I previously changed from Independent to Company.

ddaddy commented 7 years ago

I can't do a pull request to fix this, but I have the fix. In ReportDownloadOperation.m line 457 NSDate *paidOrExpectedDate = [dateFormatter dateFromString:payment[@"paidOrExpectingPaymentDate"]];

Sometimes paidOrExpectingPaymentDate = "<null>" so dateFromString is causing a crash.

So before that line, please add

if (payment[@"paidOrExpectingPaymentDate"] == [NSNull null]) {
    continue;
}
ddaddy commented 7 years ago

I've created a pull request for this fix.

nicolasgomollon commented 5 years ago

Merged.