COOPENOMICS  v1
Кооперативная Экономика
table_marketplace_warranty_claims.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/eosio.hpp>
8#include <string>
9#include <vector>
10
11#include "../consts.hpp"
12#include "../core/document.hpp"
13#include "../core/utils.hpp"
14
15namespace Marketplace {
16
17using namespace eosio;
18
27namespace ClaimStatus {
28 inline constexpr eosio::name PENDING = "pending"_n;
29 inline constexpr eosio::name ADMITTED = "admitted"_n;
30}
31
48struct [[eosio::table, eosio::contract(MARKETPLACE)]] warranty_claim {
49 uint64_t id;
50 checksum256 hash;
51 eosio::name coopname;
52 eosio::name supplier;
53 eosio::name orderer;
54
56 checksum256 original_order_hash;
57
58 eosio::asset actual_quantity = asset(0, _unit_piece);
59 eosio::asset amount = asset(0, _root_govern_symbol);
60
61 std::string reason_text;
62 std::vector<checksum256> photos;
64
65 eosio::name status = ClaimStatus::PENDING;
66 time_point_sec created_at;
67 time_point_sec decided_at;
68
69 uint64_t primary_key() const { return id; }
70 checksum256 by_hash() const { return hash; }
71 uint64_t by_supplier() const { return supplier.value; }
72 uint64_t by_status() const { return status.value; }
73 uint64_t by_original_order() const { return original_order_id; }
74};
75
76typedef eosio::multi_index<
77 "claims"_n, warranty_claim,
78 eosio::indexed_by<"byhash"_n, eosio::const_mem_fun<warranty_claim, checksum256, &warranty_claim::by_hash>>,
79 eosio::indexed_by<"bysupplier"_n, eosio::const_mem_fun<warranty_claim, uint64_t, &warranty_claim::by_supplier>>,
80 eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun<warranty_claim, uint64_t, &warranty_claim::by_status>>,
81 eosio::indexed_by<"byorigorder"_n, eosio::const_mem_fun<warranty_claim, uint64_t, &warranty_claim::by_original_order>>>
83
84} // namespace Marketplace
85
86// Плательщик за оперативную память строк таблицы — правило в 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
share_type amount
Definition: eosio.token_tests.cpp:174
constexpr eosio::name PENDING
выставлена по решению совета; поставщик не признал
Definition: table_marketplace_warranty_claims.hpp:28
constexpr eosio::name ADMITTED
поставщик признал — долг к удержанию из выплат
Definition: table_marketplace_warranty_claims.hpp:29
Canonical helpers контракта marketplace (Story 11.1).
Definition: marketplace.hpp:32
eosio::multi_index< "claims"_n, warranty_claim, eosio::indexed_by<"byhash"_n, eosio::const_mem_fun< warranty_claim, checksum256, &warranty_claim::by_hash > >, eosio::indexed_by<"bysupplier"_n, eosio::const_mem_fun< warranty_claim, uint64_t, &warranty_claim::by_supplier > >, eosio::indexed_by<"bystatus"_n, eosio::const_mem_fun< warranty_claim, uint64_t, &warranty_claim::by_status > >, eosio::indexed_by<"byorigorder"_n, eosio::const_mem_fun< warranty_claim, uint64_t, &warranty_claim::by_original_order > > > warranty_claims_index
Definition: table_marketplace_warranty_claims.hpp:82
Definition: eosio.msig.hpp:34
On-chain гарантийная претензия поставщику — анкер процесса p.mkt.claim (компонент 68,...
Definition: table_marketplace_warranty_claims.hpp:48
uint64_t original_order_id
внутренний id заказа
Definition: table_marketplace_warranty_claims.hpp:55
time_point_sec decided_at
момент признания поставщиком
Definition: table_marketplace_warranty_claims.hpp:67
document2 reclamation
рекламация 1106 с подписями пайщика и оператора участка
Definition: table_marketplace_warranty_claims.hpp:63
uint64_t by_supplier() const
Definition: table_marketplace_warranty_claims.hpp:71
uint64_t primary_key() const
Definition: table_marketplace_warranty_claims.hpp:69
checksum256 hash
process_hash для p.mkt.claim = sha256(хэш рекламации ‖ "claim")
Definition: table_marketplace_warranty_claims.hpp:50
uint64_t by_status() const
Definition: table_marketplace_warranty_claims.hpp:72
eosio::name orderer
пайщик, вернувший имущество
Definition: table_marketplace_warranty_claims.hpp:53
time_point_sec created_at
момент решения совета
Definition: table_marketplace_warranty_claims.hpp:66
uint64_t by_original_order() const
Definition: table_marketplace_warranty_claims.hpp:73
std::vector< checksum256 > photos
хеши фотографий из рекламации
Definition: table_marketplace_warranty_claims.hpp:62
eosio::name supplier
поставщик по заказу (order.offerer)
Definition: table_marketplace_warranty_claims.hpp:52
std::string reason_text
причина обращения пайщика (из рекламации)
Definition: table_marketplace_warranty_claims.hpp:61
eosio::name coopname
Definition: table_marketplace_warranty_claims.hpp:51
checksum256 by_hash() const
Definition: table_marketplace_warranty_claims.hpp:70
checksum256 original_order_hash
process_hash заказа (p.mkt.supply)
Definition: table_marketplace_warranty_claims.hpp:56
uint64_t id
Definition: table_marketplace_warranty_claims.hpp:49
Definition: table_registrator_orgs.hpp:17
Definition: document_core.hpp:27
RAM_PAYER_CLASS(Marketplace::warranty_claim, cooperative)