Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#172989345] update status codes with last specs #1887

Merged
merged 4 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 34 additions & 29 deletions ts/features/bonusVacanze/mock/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
*/

import { FiscalCode, NonEmptyString } from "italia-ts-commons/lib/strings";
import { BonusActivationDsu } from "../../../../definitions/bonus_vacanze/BonusActivationDsu";
import { BonusActivationStatusEnum } from "../../../../definitions/bonus_vacanze/BonusActivationStatus";
import { BonusActivationWithQrCode } from "../../../../definitions/bonus_vacanze/BonusActivationWithQrCode";
import { Dsu } from "../../../../definitions/bonus_vacanze/Dsu";
import { EligibilityCheckSuccess } from "../../../../definitions/bonus_vacanze/EligibilityCheckSuccess";
import { StatusEnum } from "../../../../definitions/bonus_vacanze/EligibilityCheckSuccessEligible";
import { FamilyMember } from "../../../../definitions/bonus_vacanze/FamilyMember";
import { MaxBonusAmount } from "../../../../definitions/bonus_vacanze/MaxBonusAmount";
import { MaxBonusTaxBenefit } from "../../../../definitions/bonus_vacanze/MaxBonusTaxBenefit";

Expand All @@ -17,38 +18,42 @@ export const svgBase64: string =
export const pngBase64 =
"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAMLElEQVR4Xu3dQXLkVgwDUPv+h3Zqss7ouRpBfakb2dIkQRAQZbed+f75+fn52n9jYAz8JwPfM8iUMQb+zsAMMnWMgQsGZpDJYwzMINPAGHiNgV2Q13hb1ocwMIN8yKI35msMzCCv8basD2FgBvmQRW/M1xiYQV7jbVkfwsAM8iGL3pivMTCDvMbbsj6EgRnkQx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AvQgpUvASlf8TY+1dd8ab7mV3yvWOEr1vEFhvglkDQuflT/tIFmkFBgEoAWLIEofrp/ik/54q89/wwyg0ijUVwCVvEZ5OG/aiIBaMESiOKn+6f4lC/+2vPvguyCSKNRXAJW8RlkF0QauYxLgBJY1PwXycKnEsKv+spX/12QXRBpJIpLwCougau+8tV/BplBpJEoLgGruASu+spX/+MGEcB2PCU4zW/Pp/rCr3zFY4GGr+Bx/9OfpIvgdlwCEcFpfns+1Rd+5Ssu/pSf4ov7zyDZr5pogemCJKA0Lvxp/XT+FF/cfwaZQVITXOXHAt0rVnM9rq0nlBac5hth9yuEP+0u/lQ/xRf33wXZBZFIk3gs0F2QhP48V08oLTjNzyfIKgh/Vt1/j6P6KT7tj/13QXZBJJIkHgv03S9IQu4dcrVgPeGUn86Y9ld+ii/NF3/Cr3zhq39QKAB3j4vg9oLET9pf+erfjp/mfwbBhk8vSAKUwFP86t+Op/iVL/wzyAwijRyNS+DpA0LDzSAziDRyND6DHKXfzU8vSAjTJ6jy1b8dP83/LsguSFvjUf0ZJKKvn3x6QZpQFyDFr/7teIpf+cIfXxA1WHwMPJmBGeTJ2xv2OgMzSJ3iNXgyAzPIk7c37HUGZpA6xWvwZAZmkCdvb9jrDMwgdYrX4MkMzCBP3t6w1xmYQeoUr8GTGZhBnry9Ya8zMIPUKV6DJzMwgzx5e8NeZ2AGqVO8Bk9mYAZ58vaGvc7ADFKneA2ezMAM8uTtDXudgX8A87nObDaQd4gAAAAASUVORK5CYII=";

export const mockedElegibilityCheck: EligibilityCheckSuccess = {
family_members: [
{
name: "Mario" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "EFCMZZ80A12L720R" as FiscalCode
},
{
name: "Giulia" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "CDCMQQ81A12L721R" as FiscalCode
},
{
name: "Piero" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "ABCMYY82A12L722R" as FiscalCode
}
],
max_amount: 499 as MaxBonusAmount,
max_tax_benefit: 30 as MaxBonusTaxBenefit,
id: "d296cf6a-11f8-412b-972a-ede34d629680" as NonEmptyString,
status: StatusEnum.ELIGIBLE,
valid_before: new Date("2020-07-04T12:20:00.000Z")
};
const familyMembers: ReadonlyArray<FamilyMember> = [
{
name: "Mario" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "EFCMZZ80A12L720R" as FiscalCode
},
{
name: "Giulia" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "CDCMQQ81A12L721R" as FiscalCode
},
{
name: "Piero" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "ABCMYY82A12L722R" as FiscalCode
}
];

const dsuRequest: BonusActivationDsu = {
...mockedElegibilityCheck,
const dsuData: Dsu = {
request_id: "request_id" as NonEmptyString,
isee_type: "isee_id",
dsu_protocol_id: "dsu_protocol_id" as NonEmptyString,
dsu_created_at: "2020-05-25T00:00:00.000Z",
has_discrepancies: false
has_discrepancies: false,
family_members: familyMembers,
max_amount: 499 as MaxBonusAmount,
max_tax_benefit: 30 as MaxBonusTaxBenefit
};

export const mockedElegibilityCheck: EligibilityCheckSuccess = {
max_amount: 499 as MaxBonusAmount,
max_tax_benefit: 30 as MaxBonusTaxBenefit,
id: "d296cf6a-11f8-412b-972a-ede34d629680" as NonEmptyString,
status: StatusEnum.ELIGIBLE,
valid_before: new Date("2020-07-04T12:20:00.000Z"),
...dsuData
};

export const mockedBonus: BonusActivationWithQrCode = {
Expand All @@ -66,7 +71,7 @@ export const mockedBonus: BonusActivationWithQrCode = {
],
applicant_fiscal_code: "ABCMYY82A12L722R" as FiscalCode,
status: BonusActivationStatusEnum.ACTIVE,
dsu_request: dsuRequest,
dsu_request: dsuData,
updated_at: new Date("2020-07-04T12:20:00.000Z")
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,51 @@ import * as pot from "italia-ts-commons/lib/pot";
import { canBonusVacanzeBeRequestedSelector } from "../bonusVacanzeActivation";

import { FiscalCode, NonEmptyString } from "italia-ts-commons/lib/strings";
import { BonusActivationDsu } from "../../../../../../definitions/bonus_vacanze/BonusActivationDsu";
import { BonusActivationStatusEnum } from "../../../../../../definitions/bonus_vacanze/BonusActivationStatus";
import { BonusActivationWithQrCode } from "../../../../../../definitions/bonus_vacanze/BonusActivationWithQrCode";
import { Dsu } from "../../../../../../definitions/bonus_vacanze/Dsu";
import { EligibilityCheckSuccess } from "../../../../../../definitions/bonus_vacanze/EligibilityCheckSuccess";
import { StatusEnum } from "../../../../../../definitions/bonus_vacanze/EligibilityCheckSuccessEligible";
import { FamilyMember } from "../../../../../../definitions/bonus_vacanze/FamilyMember";
import { MaxBonusAmount } from "../../../../../../definitions/bonus_vacanze/MaxBonusAmount";
import { MaxBonusTaxBenefit } from "../../../../../../definitions/bonus_vacanze/MaxBonusTaxBenefit";

export const mockedElegibilityCheck: EligibilityCheckSuccess = {
family_members: [
{
name: "Mario" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "EFCMZZ80A12L720R" as FiscalCode
},
{
name: "Giulia" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "CDCMQQ81A12L721R" as FiscalCode
},
{
name: "Piero" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "ABCMYY82A12L722R" as FiscalCode
}
],
max_amount: 500 as MaxBonusAmount,
max_tax_benefit: 100 as MaxBonusTaxBenefit,
id: "d296cf6a-11f8-412b-972a-ede34d629680" as NonEmptyString,
status: StatusEnum.ELIGIBLE,
valid_before: new Date("2020-07-04T12:20:00.000Z")
};
const familyMembers: ReadonlyArray<FamilyMember> = [
{
name: "Mario" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "EFCMZZ80A12L720R" as FiscalCode
},
{
name: "Giulia" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "CDCMQQ81A12L721R" as FiscalCode
},
{
name: "Piero" as NonEmptyString,
surname: "Rossi" as NonEmptyString,
fiscal_code: "ABCMYY82A12L722R" as FiscalCode
}
];

const dsuRequest: BonusActivationDsu = {
...mockedElegibilityCheck,
const dsuData: Dsu = {
request_id: "request_id" as NonEmptyString,
isee_type: "isee_id",
dsu_protocol_id: "dsu_protocol_id" as NonEmptyString,
dsu_created_at: "2020-05-25T00:00:00.000Z",
has_discrepancies: false
has_discrepancies: false,
family_members: familyMembers,
max_amount: 499 as MaxBonusAmount,
max_tax_benefit: 30 as MaxBonusTaxBenefit
};

export const mockedElegibilityCheck: EligibilityCheckSuccess = {
max_amount: 499 as MaxBonusAmount,
max_tax_benefit: 30 as MaxBonusTaxBenefit,
id: "d296cf6a-11f8-412b-972a-ede34d629680" as NonEmptyString,
status: StatusEnum.ELIGIBLE,
valid_before: new Date("2020-07-04T12:20:00.000Z"),
...dsuData
};

export const bonus: BonusActivationWithQrCode = {
Expand All @@ -59,7 +64,7 @@ export const bonus: BonusActivationWithQrCode = {
],
applicant_fiscal_code: "ABCMYY82A12L722R" as FiscalCode,
status: BonusActivationStatusEnum.ACTIVE,
dsu_request: dsuRequest,
dsu_request: dsuData,
updated_at: new Date("2020-07-04T12:20:00.000Z")
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export function* startBonusActivationSaga(
> = yield call(startBonusActivationProcedure, {});
if (startBonusActivationProcedureResult.isRight()) {
const status = startBonusActivationProcedureResult.value.status;
// 202 -> Request accepted.
if (startBonusActivationProcedureResult.value.status === 202) {
// 201 -> Request created.
if (startBonusActivationProcedureResult.value.status === 201) {
const instanceId = startBonusActivationProcedureResult.value.value;
// start polling to try to get bonus activation
const startPollingTime = new Date().getTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ export function* startBonusEligibilitySaga(
typeof startBonusEligibilityCheck
> = yield call(startBonusEligibilityCheck, {});
if (startEligibilityResult.isRight()) {
// 202 -> request accepted | 409 -> pending request
// 201 -> created
// 202 -> request processing
// 409 -> pending request
if (
startEligibilityResult.value.status === 201 ||
startEligibilityResult.value.status === 202 ||
startEligibilityResult.value.status === 409
) {
// processing request, dispatch di process id
if (startEligibilityResult.value.status === 202) {
if (startEligibilityResult.value.status === 201) {
yield put(eligibilityRequestId(startEligibilityResult.value.value));
}
// start polling to know about the check result
Expand Down