@coopenomics/desktop 2.2.6-alpha.0 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/extensions/powerup/boot.ts +1 -1
- package/package.json +6 -6
- package/src/app/App.vue +4 -2
- package/src/app/providers/card/store.ts +6 -3
- package/src/boot/branch-selector.ts +0 -2
- package/src/boot/init-stores.ts +5 -3
- package/src/boot/navigation-guards.ts +5 -7
- package/src/components/menu/footerMobileMenu.vue +4 -2
- package/src/components/soviet/staff.vue +9 -7
- package/src/desktops/User/model/index.ts +89 -87
- package/src/entities/Request/api/index.ts +19 -19
- package/src/entities/Request/model/stores.ts +1 -0
- package/src/entities/System/model/store.ts +1 -1
- package/src/entities/User/model/entity.ts +1 -0
- package/src/features/Agreementer/GenerateAgreement/ui/AgreementReader.vue +4 -2
- package/src/features/Agreementer/SignAgreementDialog/model/index.ts +4 -3
- package/src/features/Agreementer/SignAgreementDialog/ui/SignAgreementDialog.vue +4 -2
- package/src/features/Branch/CreateBranch/model/index.ts +4 -3
- package/src/features/Branch/EditBranch/model/index.ts +3 -2
- package/src/features/Branch/SelectBranch/model/index.ts +1 -1
- package/src/features/Branch/SelectBranch/ui/SelectBranchOverlay.vue +5 -7
- package/src/features/Decision/AuthorizeAndExecDecision/model/index.ts +6 -6
- package/src/features/Decision/VoteForDecision/model/index.ts +4 -2
- package/src/features/Installer/ui/RequestKeyForm/RequestKeyForm.vue +4 -2
- package/src/features/PaymentMethod/AddPaymentMethod/model/index.ts +4 -6
- package/src/features/PaymentMethod/DeletePaymentMethod/model/index.ts +3 -2
- package/src/features/Request/AcceptRequest/api/index.ts +20 -21
- package/src/features/Request/CancelRequest/api/index.ts +13 -17
- package/src/features/Request/CompleteOnRequest/api/index.ts +13 -17
- package/src/features/Request/ConfirmRecieveOnRequest/api/index.ts +17 -21
- package/src/features/Request/ConfirmSupplyOnRequest/api/index.ts +17 -21
- package/src/features/Request/CreateChildOrder/api/index.ts +73 -51
- package/src/features/Request/CreateChildOrder/model/index.ts +46 -0
- package/src/features/Request/CreateChildOrder/model/types.ts +1 -1
- package/src/features/Request/CreateChildOrder/ui/CreateChildOrderButton/CreateChildOrderButton.vue +28 -4
- package/src/features/Request/CreateParentOffer/api/index.ts +5 -15
- package/src/features/Request/CreateParentOffer/model/types.ts +2 -2
- package/src/features/Request/CreateParentOffer/ui/CreateParentOfferForm/CreateParentOfferForm.vue +8 -5
- package/src/features/Request/DeclineRequest/api/index.ts +14 -18
- package/src/features/Request/DeliverOnRequest/api/index.ts +13 -17
- package/src/features/Request/DisputeOnRequest/api/index.ts +3 -7
- package/src/features/Request/ModerateRequest/api/index.ts +14 -18
- package/src/features/Request/ModerateRequest/ui/ModerateRequestButton.vue +4 -3
- package/src/features/Request/ProhibitRequest/api/index.ts +14 -18
- package/src/features/Request/PublishRequest/api/index.ts +13 -17
- package/src/features/Request/RecieveOnRequest/api/index.ts +17 -21
- package/src/features/Request/SupplyOnRequest/api/index.ts +4 -4
- package/src/features/Request/UnpublishRequest/api/index.ts +14 -17
- package/src/features/Request/UpdateRequest/api/index.ts +2 -6
- package/src/features/User/AddUser/ui/AddUserDialog/AddUserDialog.vue +4 -2
- package/src/features/User/CreateUser/model/index.ts +10 -8
- package/src/features/User/LoginUser/ui/LoginForm/LoginForm.vue +4 -2
- package/src/features/Wallet/DepositToWallet/ui/DepositButton/DepositButton.vue +4 -2
- package/src/pages/Cooperative/ListOfBranches/ui/ListOfBranchesPage.vue +4 -2
- package/src/pages/Documentor/ListOfDocuments/ListOfDocumentsPage.vue +4 -2
- package/src/pages/Marketplace/CreateParentOffer/ui/CreateParentOfferPage.vue +3 -3
- package/src/pages/Marketplace/MainPage/ui/MainPage.vue +13 -13
- package/src/pages/Marketplace/Moderation/ui/ModerationPage.vue +7 -3
- package/src/pages/Marketplace/OfferPage/ui/OfferPage.vue +4 -2
- package/src/pages/Registrator/SignUp/PayInitial.vue +4 -2
- package/src/pages/Registrator/SignUp/ReadStatement.vue +7 -1
- package/src/pages/Registrator/SignUp/SelectBranch.vue +5 -3
- package/src/pages/Registrator/SignUp/SignUp.vue +7 -7
- package/src/pages/Registrator/SignUp/WaitingRegistration.vue +4 -2
- package/src/pages/Union/Connection/ConnectionPage.vue +1 -1
- package/src/pages/_layouts/default.vue +3 -2
- package/src/shared/store/index.ts +16 -18
- package/src/shared/ui/BaseDocument/BaseDocument.vue +1 -3
- package/src/shared/ui/Providers/Bank/Bank.vue +54 -2
- package/src/shared/ui/UserDataForm/OrganizationDataForm/OrganizationDataForm.vue +1 -1
- package/src/widgets/Agreementer/RequireAgreements/ui/RequireAgreements.vue +5 -3
- package/src/widgets/Cooperative/Agenda/ListOfQuestions/ui/ListOfQuestions.vue +11 -3
- package/src/widgets/Cooperative/Contacts/ui/ChangeContacts.vue +5 -3
- package/src/widgets/Cooperative/Contributions/ui/ChangeContributions.vue +6 -4
- package/src/widgets/Cooperative/Funds/ui/AccumulationFunds.vue +8 -7
- package/src/widgets/Cooperative/Funds/ui/AddAccumulationFund.vue +5 -3
- package/src/widgets/Cooperative/Funds/ui/AddExpenseFund.vue +5 -3
- package/src/widgets/Cooperative/Funds/ui/ExpenseFunds.vue +8 -7
- package/src/widgets/Cooperative/Members/ui/Members.vue +4 -2
- package/src/widgets/Desktop/SecondLevelMenu/SecondLevelMenu.vue +4 -2
- package/src/widgets/Desktop/SecondLevelMenuList/SecondLevelMenuList.vue +61 -62
- package/src/widgets/Desktop/WorkspaceMenu/WorkspaceMenu.vue +5 -3
- package/src/widgets/Request/CreateChildOrderCard/CreateChildOrderCard.vue +5 -3
- package/src/widgets/Request/SupplyOrderRequestCard/ui/Steps/FirstStep.vue +3 -3
- package/src/widgets/User/CoopCard/ui/CoopCard.vue +5 -1
- package/src/widgets/User/PaymentMethods/ui/PaymentMethods.vue +4 -2
- package/src/shared/api/wif.ts +0 -9
@@ -17,7 +17,9 @@ import { SovietContract } from 'cooptypes';
|
|
17
17
|
import { FailAlert, SuccessAlert } from 'src/shared/api';
|
18
18
|
import { useSignAgreement } from '../model';
|
19
19
|
import { useWalletStore } from 'src/entities/Wallet';
|
20
|
-
import {
|
20
|
+
import { useSystemStore } from 'src/entities/System/model';
|
21
|
+
const { info } = useSystemStore()
|
22
|
+
|
21
23
|
import { useSessionStore } from 'src/entities/Session';
|
22
24
|
import { Loader } from 'src/shared/ui/Loader';
|
23
25
|
|
@@ -54,7 +56,7 @@ const sign = async () => {
|
|
54
56
|
try {
|
55
57
|
isSubmitting.value = true
|
56
58
|
await signAgreement(session.username, props.agreement.type, agreementOnSign.value)
|
57
|
-
await useWalletStore().loadUserWalet({coopname:
|
59
|
+
await useWalletStore().loadUserWalet({coopname: info.coopname, username: session.username})
|
58
60
|
isSubmitting.value = false
|
59
61
|
show.value = false
|
60
62
|
SuccessAlert('Документ принят')
|
@@ -2,16 +2,17 @@ import { ref, type Ref } from 'vue';
|
|
2
2
|
import type { Mutations } from '@coopenomics/sdk';
|
3
3
|
import { api } from '../api';
|
4
4
|
import { useBranchStore, type IBranch } from 'src/entities/Branch/model';
|
5
|
-
import { COOPNAME } from 'src/shared/config';
|
6
5
|
import { generateUsername } from 'src/shared/lib/utils/generateUsername';
|
6
|
+
import { useSystemStore } from 'src/entities/System/model';
|
7
7
|
|
8
8
|
export type ICreateBranchInput = Mutations.Branches.CreateBranch.IInput['data']
|
9
9
|
|
10
10
|
export function useCreateBranch() {
|
11
11
|
const store = useBranchStore();
|
12
|
+
const { info } = useSystemStore()
|
12
13
|
|
13
14
|
const initialCreateBranchInput: ICreateBranchInput = {
|
14
|
-
coopname:
|
15
|
+
coopname: info.coopname,
|
15
16
|
braname: '',
|
16
17
|
email: '',
|
17
18
|
fact_address: '',
|
@@ -37,7 +38,7 @@ export function useCreateBranch() {
|
|
37
38
|
data.full_name = `Кооперативный Участок "${data.short_name}"`
|
38
39
|
const branch = await api.createBranch(data);
|
39
40
|
|
40
|
-
await store.loadBranches({ coopname:
|
41
|
+
await store.loadBranches({ coopname: info.coopname });
|
41
42
|
|
42
43
|
// Сбрасываем createBranchInput после выполнения createBranch
|
43
44
|
resetInput(createBranchInput, initialCreateBranchInput);
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import type { Mutations } from '@coopenomics/sdk';
|
2
2
|
import { api } from '../api';
|
3
3
|
import { useBranchStore, type IBranch } from 'src/entities/Branch/model';
|
4
|
-
import {
|
4
|
+
import { useSystemStore } from 'src/entities/System/model';
|
5
5
|
|
6
6
|
export type IEditBranchInput = Mutations.Branches.EditBranch.IInput['data']
|
7
7
|
|
8
8
|
export function useEditBranch() {
|
9
9
|
const store = useBranchStore()
|
10
|
+
const { info } = useSystemStore()
|
10
11
|
|
11
12
|
async function editBranch(
|
12
13
|
branch: IBranch
|
@@ -26,7 +27,7 @@ export function useEditBranch() {
|
|
26
27
|
|
27
28
|
const result = await api.editBranch(data)
|
28
29
|
|
29
|
-
await store.loadBranches({ coopname:
|
30
|
+
await store.loadBranches({ coopname: info.coopname })
|
30
31
|
|
31
32
|
return result
|
32
33
|
}
|
@@ -2,7 +2,7 @@ import type { Mutations } from '@coopenomics/sdk';
|
|
2
2
|
import { ref } from 'vue';
|
3
3
|
import { api } from '../api';
|
4
4
|
|
5
|
-
export type ISelectBranchInput = Mutations.Branches.SelectBranch.IInput
|
5
|
+
export type ISelectBranchInput = Mutations.Branches.SelectBranch.IInput['data']
|
6
6
|
|
7
7
|
const isVisible = ref(false);
|
8
8
|
|
@@ -85,19 +85,17 @@ div
|
|
85
85
|
const {selectBranch} = useSelectBranch()
|
86
86
|
|
87
87
|
await selectBranch({
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
username: session.username,
|
93
|
-
}
|
88
|
+
braname: selectedBranch.value,
|
89
|
+
coopname: system.info.coopname,
|
90
|
+
document,
|
91
|
+
username: session.username,
|
94
92
|
})
|
95
93
|
isVisible.value = false
|
96
94
|
SuccessAlert('Кооперативный участок выбран')
|
97
95
|
} catch(e: any){
|
98
96
|
isSubmitting.value = false
|
99
97
|
console.error(e)
|
100
|
-
failAlert(
|
98
|
+
failAlert(e)
|
101
99
|
}
|
102
100
|
|
103
101
|
}
|
@@ -2,10 +2,12 @@ import { TransactResult } from '@wharfkit/session';
|
|
2
2
|
import { Cooperative, SovietContract } from 'cooptypes';
|
3
3
|
import { DigitalDocument } from 'src/shared/lib/document';
|
4
4
|
import { useSessionStore } from 'src/entities/Session';
|
5
|
-
import { COOPNAME } from 'src/shared/config';
|
6
5
|
import { useGlobalStore } from 'src/shared/store';
|
6
|
+
import { useSystemStore } from 'src/entities/System/model';
|
7
7
|
|
8
8
|
export function useAuthorizeAndExecDecision() {
|
9
|
+
const { info } = useSystemStore()
|
10
|
+
|
9
11
|
async function authorizeAndExecDecision(
|
10
12
|
username: string,
|
11
13
|
registry_id: number,
|
@@ -14,11 +16,9 @@ export function useAuthorizeAndExecDecision() {
|
|
14
16
|
): Promise<TransactResult | undefined> {
|
15
17
|
const session = useSessionStore();
|
16
18
|
|
17
|
-
console.log('registri: ', registry_id)
|
18
|
-
|
19
19
|
const document = await new DigitalDocument().generate<Cooperative.Registry.DecisionOfParticipantApplication.Action>({
|
20
20
|
registry_id: registry_id,
|
21
|
-
coopname:
|
21
|
+
coopname: info.coopname,
|
22
22
|
username,
|
23
23
|
lang: 'ru',
|
24
24
|
decision_id,
|
@@ -40,7 +40,7 @@ export function useAuthorizeAndExecDecision() {
|
|
40
40
|
|
41
41
|
const authorizeData: SovietContract.Actions.Decisions.Authorize.IAuthorize =
|
42
42
|
{
|
43
|
-
coopname:
|
43
|
+
coopname: info.coopname,
|
44
44
|
chairman: session.username,
|
45
45
|
decision_id,
|
46
46
|
document: chainDocument,
|
@@ -48,7 +48,7 @@ export function useAuthorizeAndExecDecision() {
|
|
48
48
|
|
49
49
|
const execData: SovietContract.Actions.Decisions.Exec.IExec = {
|
50
50
|
executer: session.username,
|
51
|
-
coopname:
|
51
|
+
coopname: info.coopname,
|
52
52
|
decision_id: decision_id,
|
53
53
|
};
|
54
54
|
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { TransactResult } from '@wharfkit/session';
|
2
2
|
import { SovietContract } from 'cooptypes';
|
3
3
|
import { useSessionStore } from 'src/entities/Session';
|
4
|
-
import { COOPNAME } from 'src/shared/config';
|
5
4
|
import { useGlobalStore } from 'src/shared/store';
|
5
|
+
import { useSystemStore } from 'src/entities/System/model';
|
6
6
|
|
7
7
|
export function useVoteForDecision() {
|
8
|
+
const { info } = useSystemStore()
|
9
|
+
|
8
10
|
async function voteForDecision(
|
9
11
|
decision_id: number
|
10
12
|
): Promise<TransactResult | undefined> {
|
@@ -21,7 +23,7 @@ export function useVoteForDecision() {
|
|
21
23
|
],
|
22
24
|
data: {
|
23
25
|
member: session.username,
|
24
|
-
coopname:
|
26
|
+
coopname: info.coopname,
|
25
27
|
decision_id: decision_id,
|
26
28
|
},
|
27
29
|
});
|
@@ -26,7 +26,9 @@ form(@submit.prevent="submit").full-width
|
|
26
26
|
import { useInstallCooperativeStore } from 'src/entities/Installer/model';
|
27
27
|
import { FailAlert, isValidWif } from 'src/shared/api';
|
28
28
|
import { ref } from 'vue';
|
29
|
-
import {
|
29
|
+
import { useSystemStore } from 'src/entities/System/model';
|
30
|
+
const { info } = useSystemStore()
|
31
|
+
|
30
32
|
|
31
33
|
const privateKey = ref('')
|
32
34
|
const loading = ref(false)
|
@@ -36,7 +38,7 @@ form(@submit.prevent="submit").full-width
|
|
36
38
|
const submit = async () => {
|
37
39
|
loading.value = true
|
38
40
|
try {
|
39
|
-
const isValid = await isValidWif(
|
41
|
+
const isValid = await isValidWif(info.coopname, privateKey.value, 'active')
|
40
42
|
|
41
43
|
if (!isValid) {
|
42
44
|
loading.value = false
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useSessionStore } from 'src/entities/Session'
|
2
2
|
import { useWalletStore } from 'src/entities/Wallet'
|
3
3
|
import { sendPOST } from 'src/shared/api';
|
4
|
-
import {
|
4
|
+
import { useSystemStore } from 'src/entities/System/model';
|
5
5
|
|
6
6
|
export interface ISBPData {
|
7
7
|
phone: string;
|
@@ -30,11 +30,12 @@ export interface IAddPaymentMethod {
|
|
30
30
|
export function useAddPaymentMethod() {
|
31
31
|
const store = useWalletStore()
|
32
32
|
const session = useSessionStore()
|
33
|
+
const { info } = useSystemStore()
|
33
34
|
|
34
35
|
async function addPaymentMethod(params: IAddPaymentMethod) {
|
35
36
|
|
36
37
|
await store.loadUserWalet({
|
37
|
-
coopname:
|
38
|
+
coopname: info.coopname,
|
38
39
|
username: params.username,
|
39
40
|
})
|
40
41
|
|
@@ -42,10 +43,7 @@ export function useAddPaymentMethod() {
|
|
42
43
|
await sendPOST(`/v1/methods/${params.username}/add`, params)
|
43
44
|
|
44
45
|
await store.loadUserWalet({
|
45
|
-
coopname:
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
coopname: info.coopname,
|
49
47
|
username: session.username
|
50
48
|
})
|
51
49
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useSessionStore } from 'src/entities/Session'
|
2
2
|
import { useWalletStore } from 'src/entities/Wallet'
|
3
3
|
import { sendPOST } from 'src/shared/api';
|
4
|
-
import {
|
4
|
+
import { useSystemStore } from 'src/entities/System/model';
|
5
5
|
|
6
6
|
export interface IDeletePaymentMethod {
|
7
7
|
username: string;
|
@@ -14,11 +14,12 @@ export function useDeletePaymentMethod() {
|
|
14
14
|
|
15
15
|
async function deletePaymentMethod(params: IDeletePaymentMethod) {
|
16
16
|
const {username, method_id} = params
|
17
|
+
const { info } = useSystemStore()
|
17
18
|
|
18
19
|
await sendPOST(`/v1/methods/${username}/delete`, {method_id})
|
19
20
|
|
20
21
|
await store.loadUserWalet({
|
21
|
-
coopname:
|
22
|
+
coopname: info.coopname,
|
22
23
|
username: session.username
|
23
24
|
})
|
24
25
|
}
|
@@ -11,32 +11,31 @@ async function acceptRequest(
|
|
11
11
|
params: IAcceptRequest
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
13
|
//TODO здесь нужно получить подписанный документ (заявление на взнос имуществом) и подставить
|
14
|
+
//сейчас установлены фейковые данные
|
14
15
|
const document = {
|
15
|
-
hash: '',
|
16
|
-
public_key: '',
|
17
|
-
signature: '',
|
16
|
+
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
17
|
+
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
18
|
+
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
19
|
meta: '',
|
19
20
|
} as IDocument;
|
20
21
|
|
22
|
+
console.log(params)
|
23
|
+
|
21
24
|
const result = await transact({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
document,
|
37
|
-
} as MarketContract.Actions.AcceptRequest.IAcceptRequest,
|
38
|
-
},
|
39
|
-
],
|
25
|
+
account: ContractsList.Marketplace,
|
26
|
+
name: MarketContract.Actions.AcceptRequest.actionName,
|
27
|
+
authorization: [
|
28
|
+
{
|
29
|
+
actor: params.username,
|
30
|
+
permission: 'active',
|
31
|
+
},
|
32
|
+
],
|
33
|
+
data: {
|
34
|
+
username: params.username,
|
35
|
+
coopname: params.coopname,
|
36
|
+
exchange_id: params.request_id,
|
37
|
+
document,
|
38
|
+
} as MarketContract.Actions.AcceptRequest.IAcceptRequest,
|
40
39
|
});
|
41
40
|
|
42
41
|
const requestsStore = useRequestStore();
|
@@ -10,23 +10,19 @@ async function cancelRequest(
|
|
10
10
|
params: ICancelRequest
|
11
11
|
): Promise<TransactResult | undefined> {
|
12
12
|
const result = await transact({
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
exchange_id: params.request_id,
|
27
|
-
} as MarketContract.Actions.CancelRequest.ICancelRequest,
|
28
|
-
},
|
29
|
-
],
|
13
|
+
account: ContractsList.Marketplace,
|
14
|
+
name: MarketContract.Actions.CancelRequest.actionName,
|
15
|
+
authorization: [
|
16
|
+
{
|
17
|
+
actor: params.username,
|
18
|
+
permission: 'active',
|
19
|
+
},
|
20
|
+
],
|
21
|
+
data: {
|
22
|
+
username: params.username,
|
23
|
+
coopname: params.coopname,
|
24
|
+
exchange_id: params.request_id,
|
25
|
+
} as MarketContract.Actions.CancelRequest.ICancelRequest,
|
30
26
|
});
|
31
27
|
|
32
28
|
const requestsStore = useRequestStore();
|
@@ -10,23 +10,19 @@ async function complete(
|
|
10
10
|
params: ICompleteOnRequest
|
11
11
|
): Promise<TransactResult | undefined> {
|
12
12
|
const result = await transact({
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
exchange_id: params.request_id,
|
27
|
-
} as MarketContract.Actions.CompleteRequest.ICompleteRequest,
|
28
|
-
},
|
29
|
-
],
|
13
|
+
account: ContractsList.Marketplace,
|
14
|
+
name: MarketContract.Actions.CompleteRequest.actionName,
|
15
|
+
authorization: [
|
16
|
+
{
|
17
|
+
actor: params.username,
|
18
|
+
permission: 'active',
|
19
|
+
},
|
20
|
+
],
|
21
|
+
data: {
|
22
|
+
username: params.username,
|
23
|
+
coopname: params.coopname,
|
24
|
+
exchange_id: params.request_id,
|
25
|
+
} as MarketContract.Actions.CompleteRequest.ICompleteRequest,
|
30
26
|
});
|
31
27
|
|
32
28
|
const requestsStore = useRequestStore();
|
@@ -12,31 +12,27 @@ async function confirmRecieve(
|
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
13
|
//TODO здесь нужно получить подписанный документ (акт приёма-передачи) и подставить
|
14
14
|
const document = {
|
15
|
-
hash: '',
|
16
|
-
public_key: '',
|
17
|
-
signature: '',
|
15
|
+
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
+
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
+
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
18
|
meta: '',
|
19
19
|
} as IDocument;
|
20
20
|
|
21
21
|
const result = await transact({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
document,
|
37
|
-
} as MarketContract.Actions.ConfirmRecieve.IConfirmRecieve,
|
38
|
-
},
|
39
|
-
],
|
22
|
+
account: ContractsList.Marketplace,
|
23
|
+
name: MarketContract.Actions.ConfirmReceive.actionName,
|
24
|
+
authorization: [
|
25
|
+
{
|
26
|
+
actor: params.username,
|
27
|
+
permission: 'active',
|
28
|
+
},
|
29
|
+
],
|
30
|
+
data: {
|
31
|
+
username: params.username,
|
32
|
+
coopname: params.coopname,
|
33
|
+
exchange_id: params.request_id,
|
34
|
+
document,
|
35
|
+
} as MarketContract.Actions.ConfirmReceive.IConfirmReceive,
|
40
36
|
});
|
41
37
|
|
42
38
|
const requestsStore = useRequestStore();
|
@@ -12,31 +12,27 @@ async function confirmSupplyOnRequest(
|
|
12
12
|
): Promise<TransactResult | undefined> {
|
13
13
|
//TODO получить подписанный акт имущественного взноса из кошелька
|
14
14
|
const document = {
|
15
|
-
hash: '',
|
16
|
-
public_key: '',
|
17
|
-
signature: '',
|
15
|
+
hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
16
|
+
public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
17
|
+
signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
18
18
|
meta: '',
|
19
19
|
} as IDocument;
|
20
20
|
|
21
21
|
const result = await transact({
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
document,
|
37
|
-
} as MarketContract.Actions.ConfirmSupply.IConfirmSupply,
|
38
|
-
},
|
39
|
-
],
|
22
|
+
account: ContractsList.Marketplace,
|
23
|
+
name: MarketContract.Actions.ConfirmSupply.actionName,
|
24
|
+
authorization: [
|
25
|
+
{
|
26
|
+
actor: params.username,
|
27
|
+
permission: 'active',
|
28
|
+
},
|
29
|
+
],
|
30
|
+
data: {
|
31
|
+
username: params.username,
|
32
|
+
coopname: params.coopname,
|
33
|
+
exchange_id: params.request_id,
|
34
|
+
document,
|
35
|
+
} as MarketContract.Actions.ConfirmSupply.IConfirmSupply,
|
40
36
|
});
|
41
37
|
|
42
38
|
const requestsStore = useRequestStore();
|
@@ -1,60 +1,82 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { transact } from 'src/shared/api';
|
4
|
-
import { ContractsList } from 'src/shared/config';
|
5
|
-
import { useRequestStore } from 'src/entities/Request/model/stores';
|
6
|
-
import { IDocument } from 'src/shared/lib/types/document';
|
7
|
-
import { MarketContract } from 'cooptypes';
|
1
|
+
import { Mutations } from '@coopenomics/sdk';
|
2
|
+
import { client } from 'src/shared/api/client';
|
8
3
|
|
9
4
|
async function createChildOrder(
|
10
|
-
|
11
|
-
): Promise<
|
12
|
-
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
const result = await transact({
|
21
|
-
actions: [
|
22
|
-
{
|
23
|
-
account: ContractsList.Marketplace,
|
24
|
-
name: MarketContract.Actions.CreateOrder.actionName,
|
25
|
-
authorization: [
|
26
|
-
{
|
27
|
-
actor: params.username,
|
28
|
-
permission: 'active',
|
29
|
-
},
|
30
|
-
],
|
31
|
-
data: {
|
32
|
-
params: {
|
33
|
-
username: params.username,
|
34
|
-
coopname: params.coopname,
|
35
|
-
parent_id: params.parent_id,
|
36
|
-
program_id: params.program_id,
|
37
|
-
pieces: params.pieces,
|
38
|
-
unit_cost: params.unit_cost,
|
39
|
-
product_lifecycle_secs: 0,
|
40
|
-
document,
|
41
|
-
data: '',
|
42
|
-
meta: '',
|
43
|
-
},
|
44
|
-
} as MarketContract.Actions.CreateOrder.ICreateOrder,
|
45
|
-
},
|
46
|
-
],
|
47
|
-
});
|
48
|
-
|
49
|
-
const requestsStore = useRequestStore();
|
50
|
-
requestsStore.loadUserChildOrders({
|
51
|
-
coopname: params.coopname,
|
52
|
-
username: params.username,
|
53
|
-
});
|
5
|
+
data: Mutations.Cooplace.CreateChildOrder.IInput['data']
|
6
|
+
): Promise<Mutations.Cooplace.CreateChildOrder.IOutput[typeof Mutations.Cooplace.CreateChildOrder.name]> {
|
7
|
+
|
8
|
+
const {[Mutations.Cooplace.CreateChildOrder.name]: result} = await client.Mutation(Mutations.Cooplace.CreateChildOrder.mutation, {
|
9
|
+
variables: {
|
10
|
+
data
|
11
|
+
}
|
12
|
+
})
|
13
|
+
|
54
14
|
|
55
15
|
return result;
|
56
16
|
}
|
57
17
|
|
18
|
+
async function generateReturnByAssetStatement(
|
19
|
+
data: Mutations.Cooplace.GenerateReturnByAssetStatement.IInput['data']
|
20
|
+
): Promise<Mutations.Cooplace.GenerateReturnByAssetStatement.IOutput[typeof Mutations.Cooplace.GenerateReturnByAssetStatement.name]> {
|
21
|
+
const {[Mutations.Cooplace.GenerateReturnByAssetStatement.name]: result} = await client.Mutation(Mutations.Cooplace.GenerateReturnByAssetStatement.mutation, {
|
22
|
+
variables: {
|
23
|
+
data
|
24
|
+
}
|
25
|
+
})
|
26
|
+
|
27
|
+
return result;
|
28
|
+
}
|
29
|
+
|
30
|
+
// async function createChildOrder(
|
31
|
+
// params: ICreateChildOrder
|
32
|
+
// ): Promise<TransactResult | undefined> {
|
33
|
+
// //TODO здесь передаём документ заявления на возврат имуществом (?)
|
34
|
+
// const document = {
|
35
|
+
// hash: '33CBC662E606F23F332B442BAB84F2D05BD498B66EF61BC918740606B05BD565',
|
36
|
+
// public_key: 'PUB_K1_8YWRWjCdUQubPoHzT5ndvfhGKDf1ZL7v7Ge9iHoLtNp7wnVfG1',
|
37
|
+
// signature: 'SIG_K1_KWeGQ48n78ybpkuVDf1M7nuGnT8pkPXFbYYMUXtFTFv2dEReMEmwW89r19dKmAVSFZwHTdxdqkB3ZQJeAS9CcQwb92E398',
|
38
|
+
// meta: '',
|
39
|
+
// } as IDocument;
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
// const result = await transact({
|
45
|
+
// account: ContractsList.Marketplace,
|
46
|
+
// name: MarketContract.Actions.CreateOrder.actionName,
|
47
|
+
// authorization: [
|
48
|
+
// {
|
49
|
+
// actor: params.username,
|
50
|
+
// permission: 'active',
|
51
|
+
// },
|
52
|
+
// ],
|
53
|
+
// data: {
|
54
|
+
// params: {
|
55
|
+
// username: params.username,
|
56
|
+
// coopname: params.coopname,
|
57
|
+
// parent_id: params.parent_id,
|
58
|
+
// program_id: params.program_id,
|
59
|
+
// units: params.units,
|
60
|
+
// unit_cost: params.unit_cost,
|
61
|
+
// product_lifecycle_secs: 0,
|
62
|
+
// document,
|
63
|
+
// data: '',
|
64
|
+
// meta: '',
|
65
|
+
// },
|
66
|
+
// } as MarketContract.Actions.CreateOrder.ICreateOrder,
|
67
|
+
|
68
|
+
// });
|
69
|
+
|
70
|
+
// const requestsStore = useRequestStore();
|
71
|
+
// requestsStore.loadUserChildOrders({
|
72
|
+
// coopname: params.coopname,
|
73
|
+
// username: params.username,
|
74
|
+
// });
|
75
|
+
|
76
|
+
// return result;
|
77
|
+
// }
|
78
|
+
|
58
79
|
export const api = {
|
59
80
|
createChildOrder,
|
81
|
+
generateReturnByAssetStatement
|
60
82
|
};
|
@@ -1 +1,47 @@
|
|
1
|
+
import { Mutations } from '@coopenomics/sdk';
|
2
|
+
import { useRequestStore } from 'src/entities/Request/model/stores';
|
3
|
+
import { api } from '../api';
|
4
|
+
import { client } from 'src/shared/api/client';
|
5
|
+
|
1
6
|
export * from './types'
|
7
|
+
|
8
|
+
export function useCreateChildOrder() {
|
9
|
+
async function createChildOrder(
|
10
|
+
//TODO перевести id на хэши
|
11
|
+
data: Mutations.Cooplace.GenerateReturnByAssetStatement.IInput['data'] & {parent_id: number}
|
12
|
+
): Promise<Mutations.Cooplace.CreateChildOrder.IOutput[typeof Mutations.Cooplace.CreateChildOrder.name]> {
|
13
|
+
|
14
|
+
const returnByAssetStatement = await api.generateReturnByAssetStatement({
|
15
|
+
coopname: data.coopname,
|
16
|
+
username: data.username,
|
17
|
+
request: data.request,
|
18
|
+
})
|
19
|
+
|
20
|
+
const document = await client.Document.signDocument(returnByAssetStatement)
|
21
|
+
|
22
|
+
//TODO здесь же нужно передать распоряжение на использование средств цифрового кошелька
|
23
|
+
|
24
|
+
const result = await api.createChildOrder({
|
25
|
+
coopname: data.coopname,
|
26
|
+
data: '',
|
27
|
+
meta: '',
|
28
|
+
parent_id: data.parent_id,
|
29
|
+
product_lifecycle_secs: 0,
|
30
|
+
program_id: data.request.program_id,
|
31
|
+
unit_cost: data.request.unit_cost,
|
32
|
+
units: data.request.units,
|
33
|
+
username: data.username,
|
34
|
+
document
|
35
|
+
})
|
36
|
+
|
37
|
+
const requestsStore = useRequestStore();
|
38
|
+
requestsStore.loadUserChildOrders({
|
39
|
+
coopname: data.coopname,
|
40
|
+
username: data.username,
|
41
|
+
});
|
42
|
+
|
43
|
+
|
44
|
+
return result;
|
45
|
+
}
|
46
|
+
return { createChildOrder };
|
47
|
+
}
|