mirror of
https://github.com/valitydev/party-management.git
synced 2024-11-06 01:05:21 +00:00
ED-293/fixed: legacy structures (#30)
* fixed: legacy structures * erlformat * transmute legacy
This commit is contained in:
parent
5a55e2604c
commit
bfa398a4d5
@ -1,12 +1,8 @@
|
||||
-ifndef(__pm_legacy_party_structures_hrl__).
|
||||
-define(__pm_legacy_party_structures_hrl__, included).
|
||||
|
||||
-define(legacy_party_created(Party),
|
||||
{party_created, Party}
|
||||
).
|
||||
|
||||
-define(legacy_party(ID, ContactInfo, CreatedAt, Blocking, Suspension, Contracts, Shops),
|
||||
{domain_Party, ID, ContactInfo, CreatedAt, Blocking, Suspension, Contracts, Shops}
|
||||
-define(legacy_party_created_v1(ID, ContactInfo, CreatedAt, Blocking, Suspension, Contracts, Shops),
|
||||
{party_created, {domain_Party, ID, ContactInfo, CreatedAt, Blocking, Suspension, Contracts, Shops}}
|
||||
).
|
||||
|
||||
-define(legacy_claim(
|
||||
|
@ -1340,7 +1340,7 @@ transmute_state(St) ->
|
||||
transmute_change(
|
||||
1,
|
||||
2,
|
||||
?legacy_party_created(?legacy_party(ID, ContactInfo, CreatedAt, _, _, _, _))
|
||||
?legacy_party_created_v1(ID, ContactInfo, CreatedAt, _, _, _, _)
|
||||
) ->
|
||||
?party_created(ID, ContactInfo, CreatedAt);
|
||||
transmute_change(
|
||||
@ -1356,31 +1356,38 @@ transmute_change(
|
||||
UpdatedAt
|
||||
)
|
||||
)
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
NewChangeset = [transmute_party_modification(V1, V2, M) || M <- Changeset],
|
||||
) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
?claim_created(#payproc_Claim{
|
||||
id = ID,
|
||||
status = Status,
|
||||
changeset = NewChangeset,
|
||||
changeset = [transmute_party_modification(V1, V2, M) || M <- Changeset],
|
||||
revision = Revision,
|
||||
created_at = CreatedAt,
|
||||
updated_at = UpdatedAt
|
||||
});
|
||||
transmute_change(
|
||||
V1,
|
||||
V2,
|
||||
?claim_created(Claim = #payproc_Claim{changeset = Changeset})
|
||||
) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
?claim_created(Claim#payproc_Claim{
|
||||
changeset = [transmute_party_modification(V1, V2, M) || M <- Changeset]
|
||||
});
|
||||
transmute_change(
|
||||
V1,
|
||||
V2,
|
||||
?legacy_claim_updated(ID, Changeset, ClaimRevision, Timestamp)
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
NewChangeset = [transmute_party_modification(V1, V2, M) || M <- Changeset],
|
||||
?claim_updated(ID, NewChangeset, ClaimRevision, Timestamp);
|
||||
transmute_change(
|
||||
V1,
|
||||
V2,
|
||||
?claim_status_changed(ID, ?accepted(Effects), ClaimRevision, Timestamp)
|
||||
) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
NewEffects = [transmute_claim_effect(V1, V2, E) || E <- Effects],
|
||||
?claim_status_changed(ID, ?accepted(NewEffects), ClaimRevision, Timestamp);
|
||||
transmute_change(V1, _, C) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
transmute_change(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
C.
|
||||
|
||||
-spec transmute_state(pos_integer(), pos_integer(), _LegacyState) -> st().
|
||||
@ -1561,7 +1568,7 @@ transmute_party_modification(
|
||||
schedule = transmute_payout_schedule_ref(3, 4, PayoutScheduleRef)
|
||||
}}
|
||||
);
|
||||
transmute_party_modification(V1, _, C) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
transmute_party_modification(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
C.
|
||||
|
||||
transmute_claim_effect(
|
||||
@ -1849,7 +1856,7 @@ transmute_claim_effect(
|
||||
schedule = transmute_payout_schedule_ref(3, 4, PayoutSchedule)
|
||||
}}
|
||||
);
|
||||
transmute_claim_effect(V1, _, C) when V1 =:= 1; V1 =:= 2; V1 =:= 3; V1 =:= 4; V1 =:= 5; V1 =:= 6 ->
|
||||
transmute_claim_effect(V1, _, C) when V1 >= 1, V1 < ?TOP_VERSION ->
|
||||
C.
|
||||
|
||||
transmute_contractor(
|
||||
|
Loading…
Reference in New Issue
Block a user