hmrc / vat-api

Apache License 2.0
66 stars 17 forks source link

Can't get the /financial-details endpoint working in the sandbox #994

Closed ddaddy closed 1 year ago

ddaddy commented 1 year ago

I use the /penalties endpoint in the sandbox environment with Gov-Test-Scenario=LATE_SUBMISSION and get the following response:

{
    lateSubmissionPenalty =     {
        details =         (
                        {
                appealInformation =                 (
                                        {
                        appealLevel = "appeal-first-tier-tribunal";
                        appealStatus = "under-appeal";
                    }
                );
                communicationsDate = "2023-05-03";
                lateSubmissions =                 (
                                        {
                        lateSubmissionID = 1054011;
                        taxPeriodDueDate = "2023-04-31";
                        taxPeriodEndDate = "2023-03-31";
                        taxPeriodStartDate = "2022-04-01";
                        taxReturnStatus = Open;
                    }
                );
                penaltyCategory = point;
                penaltyCreationDate = "2023-05-01";
                penaltyExpiryDate = "2025-05-01";
                penaltyNumber = 00001;
                penaltyOrder = 1;
                penaltyStatus = active;
            }
        );
        summary =         {
            activePenaltyPoints = 1;
            inactivePenaltyPoints = 0;
            penaltyChargeAmount = 0;
            periodOfComplianceAchievement = "2023-05-01";
            regimeThreshold = 2;
        };
    };
    totalisations =     {
        lateSubmissionPenaltyTotalValue = 0;
    };
}

I then try to use the /financial-details endpoint using the lateSubmissionID in the URL:

https://test-api.service.hmrc.gov.uk/organisations/vat/110271825/financial-details/1054011

but I get the error CHARGE_REFERENCE_INVALID.

I have tried multiple test scenarios, DEFAULT, LATE_SUBMISSION, CHARGE_LATE_SUBMISSION_PENALTIES but no matter what reference or ID I use from the returned penalties, I always get the CHARGE_REFERENCE_INVALID error from the financial endpoint.

Am I using this wrong?

DDCTLS-DEV-TEAM commented 1 year ago

HI @ddaddy,

To use the financial details endpoint you require a penalty charge reference from the penalties endpoint. You only get a charge reference in a lateSubmissionPenalty when it is a threshold penalty or a charge (in the case of a late submission penalty that is a chargeReference field).

If you are referring to a latePaymentPenalty then you need the penaltyChargeReference from the penalty you want more info about.

Any more problems please feel free to raise a new issue here

ddaddy commented 1 year ago

Thanks. So I changed the sandbox to return LATE_PAYMENT and get this:

{
    latePaymentPenalty =     {
        details =         (
                        {
                appealInformation =                 (
                                        {
                        appealLevel = "appeal-first-tier-tribunal";
                        appealStatus = "under-appeal";
                    }
                );
                communicationsDate = "2022-07-17";
                latePaymentPenalty1HigherRateCalculationAmount = "704.96";
                latePaymentPenalty1HigherRatePercentage = 4;
                latePaymentPenalty1LowerRateCalculationAmount = "463.15";
                latePaymentPenalty1LowerRatePercentage = 2;
                latePaymentPenalty2Days = 8;
                latePaymentPenalty2Percentage = 2;
                penaltyAmountAccruing = 4018;
                penaltyAmountOutstanding = "7014.84";
                penaltyAmountPaid = "4507.2";
                penaltyAmountPosted = "1045.1";
                penaltyCategory = LPP2;
                penaltyChargeCreationDate = "2022-07-15";
                penaltyChargeDueDate = "2022-07-31";
                penaltyChargeReference = 1004784;
                penaltyStatus = accruing;
                principalChargeBillingFrom = "2022-04-01";
                principalChargeBillingTo = "2022-06-30";
                principalChargeDocNumber = 10023852;
                principalChargeDueDate = "2022-07-15";
                principalChargeLatestClearing = 1006568;
                principalChargeReference = 000154513;
                timeToPay =                 (
                                        {
                        timeToPayEndDate = "2023-05-01";
                        timeToPayStartDate = "2023-03-01";
                    }
                );
            }
        );
    };
    totalisations =     {
        latePaymentPenaltyEstimateTotal = "4762.36";
        latePaymentPenaltyPostedTotal = "805.21";
        penalisedPrincipalTotal = "7014.02";
    };
}

I use the penaltyChargeReference of 1004784 in the financial endpoint, but still get the error CHARGE_REFERENCE_INVALID

ddaddy commented 1 year ago

THRESHOLD_LATE_SUBMISSION_PENALTIES returns:

{
    lateSubmissionPenalty =     {
        details =         (
                        {
                appealInformation =                 (
                                        {
                        appealLevel = "statutory-review";
                        appealStatus = "appeal-rejected";
                    }
                );
                communicationsDate = "2023-02-03";
                expiryReason = appeal;
                lateSubmissions =                 (
                                        {
                        lateSubmissionID = 1054011;
                        returnReceiptDate = "2023-03-01";
                        taxPeriodDueDate = "2023-01-31";
                        taxPeriodEndDate = "2022-12-31";
                        taxPeriodStartDate = "2022-10-01";
                        taxReturnStatus = Open;
                    }
                );
                penaltyCategory = point;
                penaltyCreationDate = "2023-02-01";
                penaltyExpiryDate = "2025-02-01";
                penaltyNumber = 00001;
                penaltyOrder = 1;
                penaltyStatus = active;
            },
                        {
                communicationsDate = "2023-08-03";
                expiryReason = appeal;
                lateSubmissions =                 (
                                        {
                        lateSubmissionID = 203651;
                        returnReceiptDate = "2023-08-14";
                        taxPeriodDueDate = "2023-07-31";
                        taxPeriodEndDate = "2023-06-30";
                        taxPeriodStartDate = "2023-04-01";
                        taxReturnStatus = Fulfilled;
                    }
                );
                penaltyCategory = point;
                penaltyCreationDate = "2023-08-01";
                penaltyExpiryDate = "2025-08-01";
                penaltyNumber = 00002;
                penaltyOrder = 2;
                penaltyStatus = active;
            },
                        {
                communicationsDate = "2023-11-03";
                expiryReason = appeal;
                lateSubmissions =                 (
                                        {
                        lateSubmissionID = 203651;
                        returnReceiptDate = "2023-11-10";
                        taxPeriodDueDate = "2023-10-31";
                        taxPeriodEndDate = "2023-09-30";
                        taxPeriodStartDate = "2023-07-01";
                        taxReturnStatus = Fulfilled;
                    }
                );
                penaltyCategory = point;
                penaltyCreationDate = "2023-11-01";
                penaltyExpiryDate = "2025-11-01";
                penaltyNumber = 00003;
                penaltyOrder = 3;
                penaltyStatus = active;
            },
                        {
                chargeAmount = 200;
                chargeDueDate = "2024-02-28";
                chargeOutstandingAmount = 200;
                chargeReference = 4052141;
                communicationsDate = "2024-02-03";
                expiryReason = appeal;
                lateSubmissions =                 (
                                        {
                        lateSubmissionID = 203651;
                        taxPeriodDueDate = "2024-01-31";
                        taxPeriodEndDate = "2023-12-31";
                        taxPeriodStartDate = "2023-10-01";
                        taxReturnStatus = Fulfilled;
                    }
                );
                penaltyCategory = threshold;
                penaltyCreationDate = "2024-02-01";
                penaltyExpiryDate = "2026-02-01";
                penaltyNumber = 00004;
                penaltyOrder = 4;
                penaltyStatus = active;
            }
        );
        summary =         {
            activePenaltyPoints = 4;
            inactivePenaltyPoints = 0;
            penaltyChargeAmount = 200;
            periodOfComplianceAchievement = "2025-02-01";
            regimeThreshold = 4;
        };
    };
    totalisations =     {
        lateSubmissionPenaltyTotalValue = 200;
    };
}

and again, the returned chargeReference of 4052141 returns CHARGE_REFERENCE_INVALID

DDCTLS-DEV-TEAM commented 1 year ago

Hi @ddaddy

The Stub has been redeployed to sandbox. the charge references should now be of the correct format. regex: ^X[a-zA-Z]\d{12}+$ example XS198765432110

if you retry you should now get something of the above format and that will remedy the error

ddaddy commented 1 year ago

Working now :)

Thanks for the speedy fix.