COOPENOMICS  v1
Кооперативная Экономика
table_marketplace_return_requests.hpp
См. документацию.
1#pragma once
2
3
4#include "../core/ram_payer.hpp"
5#include <eosio/asset.hpp>
6#include <eosio/crypto.hpp>
7#include <eosio/binary_extension.hpp>
8#include <eosio/eosio.hpp>
9#include <string>
10#include <vector>
11
12#include "../consts.hpp"
13#include "../core/document.hpp"
14#include "../core/utils.hpp"
15
16namespace Marketplace {
17
18using namespace eosio;
19
30namespace ReturnStatus {
31 inline constexpr eosio::name PENDING_REVIEW = "pendrev"_n;
32 inline constexpr eosio::name APPROVED_FOR_VISIT = "approvvisit"_n;
33 inline constexpr eosio::name RETURN_PENDING = "retpend"_n;
34 inline constexpr eosio::name RETURN_DECLINED = "retdecl"_n;
35 inline constexpr eosio::name FEE_PENDING = "feepend"_n;
36}
37
70struct [[eosio::table, eosio::contract(MARKETPLACE)]] return_request {
71 uint64_t id;
72 checksum256 hash;
73 eosio::name coopname;
74 eosio::name orderer;
75
77 checksum256 original_order_hash;
79
80 eosio::asset actual_quantity = asset(0, _unit_piece);
81 eosio::asset fact_cost = asset(0, _root_govern_symbol);
82
92 eosio::asset fee_refund = asset(0, _root_govern_symbol);
93
94 std::string reason_text;
95 std::vector<checksum256> photos;
96
97 eosio::name status = ReturnStatus::PENDING_REVIEW;
103 eosio::binary_extension<time_point_sec> accepted_at;
107 eosio::binary_extension<document2> cancel_statement;
108
109 // Timestamp'ы submretrn/aprretrem/rejretrem/accretrn/rejretrn — на бэкенде
110 // из blockchain_actions[at]. В контракте никаких guard'ов по датам нет.
111
112 uint64_t primary_key() const { return id; }
113 checksum256 by_hash() const { return hash; }
114 uint64_t by_orderer() const { return orderer.value; }
115 uint64_t by_status() const { return status.value; }
116 uint64_t by_original_order() const { return original_order_id; }
117};
118
119typedef eosio::multi_index<
120 "retrequests"_n, return_request,
121 eosio::indexed_by<"byhash"_n, eosio::const_mem_fun<return_request, checksum256, &return_request::by_hash>>,
122 eosio::indexed_by<"byorderer"_n, eosio::const_mem_fun<return_request, uint64_t, &return_request::by_orderer>>,
123 eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun<return_request, uint64_t, &return_request::by_status>>,
124 eosio::indexed_by<"byorigorder"_n, eosio::const_mem_fun<return_request, uint64_t, &return_request::by_original_order>>>
126
127} // namespace Marketplace
128
129// Плательщик за оперативную память строк таблицы — правило в lib/core/ram_payer.hpp.
static constexpr eosio::symbol _unit_piece
Definition: consts.hpp:243
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:236
contract
Definition: eosio.msig_tests.cpp:977
constexpr eosio::name PENDING_REVIEW
Definition: table_marketplace_return_requests.hpp:31
constexpr eosio::name RETURN_PENDING
имущество принято оператором, ждём решение совета
Definition: table_marketplace_return_requests.hpp:33
constexpr eosio::name RETURN_DECLINED
совет отказал, имущество ждёт заказчика на участке
Definition: table_marketplace_return_requests.hpp:34
constexpr eosio::name FEE_PENDING
совет «за», имущество и паевой возвращены; взнос ждёт пополнения общего кошелька участка (payretfee)
Definition: table_marketplace_return_requests.hpp:35
constexpr eosio::name APPROVED_FOR_VISIT
Definition: table_marketplace_return_requests.hpp:32
Canonical helpers контракта marketplace (Story 11.1).
Definition: marketplace.hpp:32
eosio::multi_index< "retrequests"_n, return_request, eosio::indexed_by<"byhash"_n, eosio::const_mem_fun< return_request, checksum256, &return_request::by_hash > >, eosio::indexed_by<"byorderer"_n, eosio::const_mem_fun< return_request, uint64_t, &return_request::by_orderer > >, eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun< return_request, uint64_t, &return_request::by_status > >, eosio::indexed_by<"byorigorder"_n, eosio::const_mem_fun< return_request, uint64_t, &return_request::by_original_order > > > return_requests_index
Definition: table_marketplace_return_requests.hpp:125
Definition: eosio.msig.hpp:34
On-chain Заявление на гарантийный возврат — анкер процесса p.mkt.return.
Definition: table_marketplace_return_requests.hpp:70
uint64_t id
Definition: table_marketplace_return_requests.hpp:71
checksum256 by_hash() const
Definition: table_marketplace_return_requests.hpp:113
uint64_t primary_key() const
Definition: table_marketplace_return_requests.hpp:112
checksum256 hash
process_hash для p.mkt.return
Definition: table_marketplace_return_requests.hpp:72
std::vector< checksum256 > photos
хеши файлов в bucket'е stol-zakazov:images
Definition: table_marketplace_return_requests.hpp:95
uint64_t by_status() const
Definition: table_marketplace_return_requests.hpp:115
eosio::binary_extension< time_point_sec > accepted_at
Definition: table_marketplace_return_requests.hpp:103
uint64_t by_original_order() const
Definition: table_marketplace_return_requests.hpp:116
std::string reason_text
причина обращения (≤ 500 символов)
Definition: table_marketplace_return_requests.hpp:94
eosio::binary_extension< document2 > cancel_statement
Definition: table_marketplace_return_requests.hpp:107
checksum256 original_consume_op_id
ссылка на оригинальный o.mkt.consum (для journal трассировки compensating forward; см....
Definition: table_marketplace_return_requests.hpp:78
uint64_t by_orderer() const
Definition: table_marketplace_return_requests.hpp:114
checksum256 original_order_hash
process_hash оригинального p.mkt.supply
Definition: table_marketplace_return_requests.hpp:77
document2 statement
Definition: table_marketplace_return_requests.hpp:98
uint64_t original_order_id
внутренний id Order'а
Definition: table_marketplace_return_requests.hpp:76
eosio::name orderer
пайщик-заказчик (заявитель)
Definition: table_marketplace_return_requests.hpp:74
eosio::name coopname
Definition: table_marketplace_return_requests.hpp:73
Definition: table_registrator_orgs.hpp:17
Definition: document_core.hpp:27
RAM_PAYER_CLASS(Marketplace::return_request, cooperative)