4using System.Threading.Tasks;
57 private static readonly Dictionary<CaseInsensitiveString, AuctionItem> activeItems =
new Dictionary<CaseInsensitiveString, AuctionItem>();
58 private static decimal? minCommission =
null;
71 internal static async Task ContractSigned(
Contract Contract,
bool ContractIsLocked,
72 Dictionary<CaseInsensitiveString, Parameter> TransientParameters,
78 if ((TransientParameters?.Count ?? 0) > 0)
81 "Transient parameters not permitted in auctions.",
true, Legal,
EDaler);
85 switch (
Contract.ForMachinesLocalName)
91 await AddItemForSale(
Contract.ForMachinesParsed.DocumentElement,
92 Contract, ContractIsLocked, PaymentLegalId, PaymentJid, Legal,
101 ContractIsLocked, PaymentLegalId, PaymentJid, Legal,
EDaler, PubSub);
109 ContractIsLocked, Legal,
EDaler, PubSub);
118 internal static bool OnlyMissingAuctioneer(
Contract Contract,
string PaymentPartyRole,
119 string TrustProviderRole, out
string PaymentLegalId, out
string PaymentJid)
121 PaymentLegalId =
null;
127 if ((
Contract.Roles?.Length ?? 0) < 2)
130 bool HasAuctioneer =
false;
131 bool HasPaymentParty =
false;
132 Dictionary<string, SignatureStat> Signatures =
new Dictionary<string, SignatureStat>();
144 HasAuctioneer =
true;
148 if (!(PaymentPartyRole is
null) &&
Role.
Name == PaymentPartyRole)
153 HasPaymentParty =
true;
156 Signatures[
Role.
Name] =
new SignatureStat()
165 if (!HasAuctioneer || (!HasPaymentParty && !(PaymentPartyRole is
null)))
170 if (Signatures.TryGetValue(
Signature.Role, out SignatureStat Stat))
175 if (!(PaymentPartyRole is
null) &&
Signature.Role == PaymentPartyRole)
182 foreach (SignatureStat Stat
in Signatures.Values)
184 if (Stat.Count < Stat.Min || Stat.Count > Stat.Max)
203 private class SignatureStat
210 private static async Task<bool> AddItemForSale(XmlElement ForSale,
Contract Contract,
bool ContractIsLocked,
string PaymentLegalId,
213 AuctionItem Item = await ParseAuctionItem(ForSale, PaymentLegalId, PaymentJid,
Contract);
222 private static async Task<bool> AddItemToBuy(XmlElement ToBuy,
Contract Contract,
bool ContractIsLocked,
string PaymentLegalId,
225 AuctionItem Item = await ParseAuctionItem(ToBuy, PaymentLegalId, PaymentJid,
Contract);
237 Item.Direction = Direction;
240 Item.ScheduledExpiry = AddItem(Item,
EDaler);
242 SignatureReference Ref = await SignContract(
Contract, ContractIsLocked, Legal, PubSub, Item.Node,
AuctioneerRole);
247 activeItems.Remove(Item.ContractId);
251 Item.ScheduledExpiry = DateTime.MinValue;
257 Item.TrustProviderJid = Ref.BareJid;
258 Item.TrustProviderLegalId = Ref.LegalId;
263 internal class SignatureReference
265 public string LegalId;
266 public string BareJid;
271 return SignContract(
Contract, ContractIsLocked, Legal,
null,
null,
Role);
282 StringBuilder sb =
new StringBuilder();
288 if (ContractIsLocked)
295 await
Contract.
Serialize(sb,
false,
false,
false,
false,
false,
false,
false,
null, Legal);
296 byte[] Data = Encoding.UTF8.GetBytes(sb.ToString());
301 if (!
string.IsNullOrEmpty(Node))
303 string ContractXml =
null;
308 await
Contract.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false,
null, Legal);
309 ContractXml = sb.ToString();
317 catch (XmlException ex)
327 SignatureReference Result =
new SignatureReference();
329 if (!(
Contract.ClientSignatures is
null))
335 Result.LegalId = Signature2.
Role;
336 Result.BareJid = Signature2.
BareJid;
351 await
Contract.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false,
null, Legal);
353 string ContractXml = sb.ToString();
361 if (!
string.IsNullOrEmpty(Node))
368 Contract2.
Serialize(sb,
true,
true,
false,
false,
false,
false,
false);
369 ContractXml = sb.ToString();
376 catch (XmlException ex)
386 SignatureReference Result =
new SignatureReference();
390 foreach (Networking.XMPP.Contracts.ClientSignature
Signature in
404 catch (XmlException ex)
419 if (Item.ContractId is
null)
420 return DateTime.MaxValue;
424 activeItems[Item.ContractId] = Item;
427 Item.ScheduledExpiry =
Scheduler.
Add(Item.Expires.ToLocalTime(), ItemExpires,
new ExpiryRecord()
433 return Item.ScheduledExpiry;
436 private class ExpiryRecord
438 public AuctionItem Item;
446 if (scheduler is
null)
453 Log.Terminating += Log_Terminating;
461 private static Task Log_Terminating(
object Sender, EventArgs e)
466 Log.Terminating -= Log_Terminating;
468 return Task.CompletedTask;
477 private static async Task<AuctionItem> ParseAuctionItem(XmlElement Item,
string PaymentLegalId,
480 List<AuctionItemTag> Tags =
new List<AuctionItemTag>();
481 List<ExpectedTag> ExpectedTags =
null;
485 string Currency =
null;
486 string ScoreFunction =
null;
487 string TokenId =
null;
488 decimal? AskingPrice =
null;
489 decimal? RejectPrice =
null;
490 decimal? AcceptPrice =
null;
491 decimal? CommissionPercent =
null;
492 decimal? RejectScore =
null;
493 decimal? AcceptScore =
null;
494 decimal? AvailableDays =
null;
496 foreach (XmlNode N
in Item.ChildNodes)
504 foreach (XmlNode N2
in E.ChildNodes)
506 if (!(N2 is XmlElement E2))
509 switch (E2.LocalName)
542 AuctionItemTag Tag =
new AuctionItemTag()
550 if (Tag.Name ==
"TokenID")
551 TokenId = Tag.Value as string;
558 foreach (XmlNode N2
in E.ChildNodes)
560 if (!(N2 is XmlElement E2))
563 switch (E2.LocalName)
595 case "CommissionPercent":
602 CommissionPercent = d4;
619 foreach (XmlNode N2
in E.ChildNodes)
621 if (!(N2 is XmlElement E2))
624 switch (E2.LocalName)
627 ExpectedTags ??=
new List<ExpectedTag>();
629 string Name = E2.InnerText;
632 if (E2.HasAttribute(
"where"))
634 Where = E2.GetAttribute(
"where");
635 if (!IsValidExpression(Where, out
_))
642 ExpectedTags.Add(
new ExpectedTag()
649 case "ScoreFunction":
650 ScoreFunction = E2.InnerText;
651 if (!IsValidExpression(ScoreFunction, out
_))
681 case "AvailableDays":
693 if (Type is
null || Class is
null || Currency is
null || !AskingPrice.HasValue || !CommissionPercent.HasValue || !AvailableDays.HasValue)
699 if (CommissionPercent.Value < await GetMinCommission())
707 if (
string.IsNullOrEmpty(TokenId))
734 if (
Token.
Expires.ToUniversalTime() < DateTime.UtcNow.AddDays((
double)AvailableDays.Value))
740 AuctionItem Item2 = await
Database.FindFirstIgnoreRest<AuctionItem>(
new FilterAnd(
744 if (!(Item2 is
null))
751 DateTime
Created = DateTime.UtcNow;
753 return new AuctionItem()
756 InitiatorLegalId = PaymentLegalId,
757 InitiatorJid = PaymentJid,
759 Expires =
Created.AddDays((
double)AvailableDays.Value),
764 Tags = Tags.ToArray(),
765 ExpectedTags = ExpectedTags?.ToArray(),
766 AskingPrice = AskingPrice.
Value,
767 AcceptPrice = AcceptPrice.Value,
768 RejectPrice = RejectPrice.Value,
769 CommissionPercent = CommissionPercent.Value,
771 ScoreFunction = ScoreFunction,
772 AcceptScore = AcceptScore,
773 RejectScore = RejectScore,
777 internal static async Task<decimal> GetMinCommission()
779 if (!minCommission.HasValue)
782 return (decimal)minCommission.Value;
785 private static bool IsValidExpression(
string Script, out
ScriptNode Prohibited)
787 if (
string.IsNullOrEmpty(Script))
809 List<AuctionItemTag> Tags =
new List<AuctionItemTag>();
811 string Currency =
null;
812 decimal? Price =
null;
814 foreach (XmlNode N
in Offer.ChildNodes)
822 AuctionItemTag Tag =
new AuctionItemTag()
829 v[Tag.Name] = Tag.Value;
852 case "ItemReference":
859 int i = s2.IndexOf(
'@');
860 if (i < 0 || !Guid.TryParse(s2[..i], out Guid
_))
878 if (ItemReference is
null || Currency is
null || !Price.HasValue)
888 if (!activeItems.TryGetValue(ItemReference, out Item))
898 if (!(Item.Tags is
null))
900 foreach (AuctionItemTag Tag
in Item.Tags)
903 v[Tag.Name] = Tag.Value;
907 v[
"Price"] = Price.Value;
909 if (!(Item.ExpectedTags is
null))
911 foreach (ExpectedTag ExpectedTag
in Item.ExpectedTags)
915 Log.
Error(
"Rejected marketplace offer: Tag '" + ExpectedTag
920 if (!
string.IsNullOrEmpty(ExpectedTag.Where))
924 object Result = await ExpectedTag.Parsed.EvaluateAsync(v);
926 if (Result is
bool b)
930 Log.
Error(
"Rejected marketplace offer: Tag '" + ExpectedTag
931 +
"' not valid in accordance with where expression.", ItemReference,
Contract.
ContractId);
937 Log.
Error(
"Rejected marketplace offer: Where expression for '" + ExpectedTag
944 Log.
Error(
"Rejected marketplace offer: Where expression for '" + ExpectedTag
953 bool NewBest =
false;
954 decimal? Score =
null;
955 string BestBidContractIdBak = Item.BestBidContractId;
956 string BestBidLegalIdBak = Item.BestBidLegalId;
957 string BestBidLegalJidBak = Item.BestBidJid;
958 decimal? BestBidPriceBak = Item.BestBidPrice;
959 decimal? BestBidScoreBak = Item.BestBidScore;
960 string PaymentLegalId;
963 switch (Item.Direction)
987 if (Item.Processed.HasValue)
993 if (Currency != Item.Currency)
999 if (Item.RejectPrice.HasValue)
1001 switch (Item.Direction)
1004 if (Price.Value < Item.RejectPrice.Value)
1012 if (Price.Value > Item.RejectPrice.Value)
1021 if (!(Item.ScoreFunction is
null))
1025 if (Item.ScoreExpression is
null)
1030 throw new UnauthorizedAccessException(
"Expression not permitted: " + Prohibited?.SubExpression);
1032 Item.ScoreExpression = Exp;
1035 object Result = await Item.ScoreExpression.
EvaluateAsync(v);
1038 catch (Exception ex)
1044 if (Item.RejectScore.HasValue)
1046 switch (Item.Direction)
1049 if (Score.Value < Item.RejectScore.Value)
1057 if (Score.Value > Item.RejectScore.Value)
1066 if (Item.AcceptScore.HasValue)
1068 switch (Item.Direction)
1071 if (Score.Value >= Item.AcceptScore.Value)
1073 Accept = NewBest =
true;
1074 Item.Processed = DateTime.UtcNow;
1079 if (Score.Value <= Item.AcceptScore.Value)
1081 Accept = NewBest =
true;
1082 Item.Processed = DateTime.UtcNow;
1089 if (Item.AcceptPrice.HasValue && !Accept)
1091 switch (Item.Direction)
1094 if (Price.Value >= Item.AcceptPrice.Value)
1096 Accept = NewBest =
true;
1097 Item.Processed = DateTime.UtcNow;
1102 if (Price.Value <= Item.AcceptPrice.Value)
1104 Accept = NewBest =
true;
1105 Item.Processed = DateTime.UtcNow;
1115 switch (Item.Direction)
1118 if (!Item.BestBidScore.HasValue || Score.Value > Item.BestBidScore.Value)
1123 if (!Item.BestBidScore.HasValue || Score.Value < Item.BestBidScore.Value)
1130 switch (Item.Direction)
1133 if (!Item.BestBidPrice.HasValue || Price.Value > Item.BestBidPrice.Value)
1138 if (!Item.BestBidPrice.HasValue || Price.Value < Item.BestBidPrice.Value)
1148 Item.BestBidLegalId = PaymentLegalId;
1149 Item.BestBidJid = PaymentJid;
1150 Item.BestBidPrice = Price;
1151 Item.BestBidScore = Score;
1158 Item.Processed =
null;
1162 Item.BestBidContractId = BestBidContractIdBak;
1163 Item.BestBidLegalId = BestBidLegalIdBak;
1164 Item.BestBidJid = BestBidLegalJidBak;
1165 Item.BestBidPrice = BestBidPriceBak;
1166 Item.BestBidScore = BestBidScoreBak;
1172 if (!Accept && NewBest)
1178 ContractId = ItemReference,
1179 OfferLegalId = PaymentLegalId,
1180 OfferJid = PaymentJid,
1182 Price = Price.
Value,
1183 Currency = Currency,
1184 Score = Score ?? Price,
1185 Tags = Tags.ToArray()
1190 if (await ResolvePayments(Item,
EDaler,
false))
1194 activeItems.Remove(Item.ContractId);
1198 Item.ScheduledExpiry = DateTime.MinValue;
1202 Item.Processed =
null;
1203 Item.BestBidContractId = BestBidContractIdBak;
1204 Item.BestBidLegalId = BestBidLegalIdBak;
1205 Item.BestBidJid = BestBidLegalJidBak;
1206 Item.BestBidPrice = BestBidPriceBak;
1207 Item.BestBidScore = BestBidScoreBak;
1216 private static async Task ItemExpires(
object P)
1218 ExpiryRecord Rec = (ExpiryRecord)P;
1219 AuctionItem Item = Rec.Item;
1220 if (Item.Processed.HasValue)
1225 activeItems.Remove(Item.ContractId);
1228 Item.Processed = DateTime.UtcNow;
1230 if (!await ResolvePayments(Item, Rec.EDaler,
true))
1231 Log.
Error(
"Auctioned item expired, but payments offered were not possible to process.", Item.ContractId);
1235 bool BackTrackIfPaymentFails)
1239 if (Item.BestBidPrice.HasValue)
1244 decimal Amount = Item.BestBidPrice.
Value;
1246 if (!(Ok = await ResolvePayments(BidderId, BidderJid, Amount, BidId, Item,
EDaler)))
1248 if (BackTrackIfPaymentFails)
1250 string Order = Item.Direction == OptimizeDirection.Up ?
"-Score" :
"Score";
1251 IEnumerable<AuctionOffer> Bids = await
Database.
Find<AuctionOffer>(
1257 foreach (AuctionOffer Bid
in Bids)
1259 BidderId = Bid.OfferLegalId;
1260 BidderJid = Bid.OfferJid;
1261 BidId = Bid.OfferContractId;
1264 if (Ok = await ResolvePayments(BidderId, BidderJid, Amount, BidId, Item,
EDaler))
1280 decimal Commission = Amount * Item.CommissionPercent * 0.01m;
1281 string Ref =
"iotsc:" + Item.ContractId;
1283 int i = Item.ContractId.IndexOf(
'@');
1285 if (i <= 0 || !Guid.TryParse(Item.ContractId.Substring(0, i), out Guid TransactionId))
1286 TransactionId = Guid.NewGuid();
1290 string TokenId = Item.
TokenId;
1291 if (
string.IsNullOrEmpty(TokenId))
1303 switch (Item.Direction)
1310 Item.SalePaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(TransactionId, Bidder,
true,
1312 BidId,
null, 1, out
_, out
_);
1314 Item.CommissionPaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(Guid.NewGuid(),
1316 Amount - Commission,
null, Ref, Item.ContractId,
null, 1, out
_, out
_);
1325 Item.SalePaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(TransactionId, Item.InitiatorLegalId,
true,
1327 null, Ref, Item.ContractId,
null, 1, out
_, out
_);
1329 Item.CommissionPaymentUri =
PaiwiseProcessor.GenerateContractualPaymentUri(Guid.NewGuid(),
1331 Ref, Item.ContractId,
null, 1, out
_, out
_);
1341 Log.
Error(
"Unable to process payment for consigned auction item.",
1342 Item.ContractId,
string.Empty,
"AuctionPayment",
1343 new KeyValuePair<string, object>(
"Bidder", Bidder),
1344 new KeyValuePair<string, object>(
"BidId", BidId),
1345 new KeyValuePair<string, object>(
"Amount", Amount),
1346 new KeyValuePair<string, object>(
"Currency", Item.Currency));
1354 if (!
string.IsNullOrEmpty(Msg))
1356 Log.
Error(
"Auction payment error: Sales payment went through to Auctioneer, but secondary payment failed: " + Msg,
1357 Item.ContractId,
string.Empty,
"AuctionPayment",
1358 new KeyValuePair<string, object>(
"Bidder", Bidder),
1359 new KeyValuePair<string, object>(
"BidId", BidId),
1360 new KeyValuePair<string, object>(
"Amount", Amount),
1361 new KeyValuePair<string, object>(
"Currency", Item.Currency),
1362 new KeyValuePair<string, object>(
"URI", Item.CommissionPaymentUri));
1366 if (!(
Token is
null))
1373 switch (Item.Direction)
1377 SellerJid = Item.InitiatorJid;
1378 BuyerJid = BidderJid;
1380 Token.Value = Amount;
1381 Token.Currency = Item.Currency;
1382 Token.Owner = Bidder;
1383 Token.OwnerJid = BidderJid;
1384 Token.OwnershipContract = BidId;
1392 Seller = Item.InitiatorLegalId,
1393 Owner = Item.TrustProviderLegalId,
1394 OwnershipContract = Item.ContractId,
1397 Currency = Item.Currency,
1399 Timestamp = DateTime.UtcNow.AddSeconds(-1),
1408 Seller = Item.TrustProviderLegalId,
1410 OwnershipContract = BidId,
1412 Commission = Commission,
1413 Currency = Item.Currency,
1415 Timestamp = DateTime.UtcNow,
1422 SellerJid = BidderJid;
1423 BuyerJid = Item.InitiatorJid;
1425 Token.Value = Amount;
1426 Token.Currency = Item.Currency;
1427 Token.Owner = Item.InitiatorLegalId;
1428 Token.OwnerJid = Item.InitiatorJid;
1429 Token.OwnershipContract = Item.ContractId;
1438 Owner = Item.TrustProviderLegalId,
1439 OwnershipContract = BidId,
1442 Currency = Item.Currency,
1444 Timestamp = DateTime.UtcNow.AddSeconds(-1),
1453 Seller = Item.TrustProviderLegalId,
1454 Owner = Item.InitiatorLegalId,
1455 OwnershipContract = Item.ContractId,
1457 Commission = Commission,
1458 Currency = Item.Currency,
1460 Timestamp = DateTime.UtcNow,
1480 catch (Exception ex)
1496 catch (Exception ex)
1505 catch (Exception ex)
1510 StringBuilder Xml =
new StringBuilder();
1512 Xml.Append(
"<tokenRemoved xmlns='");
1516 Xml.Append(
"</tokenRemoved>");
1523 Xml.Append(
"<tokenAdded xmlns='");
1527 Xml.Append(
"</tokenAdded>");
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
static XmlDocument ParseXml(string Xml)
Parses an XML Document from its string representation.
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
static void Notice(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a notice event.
Static class managing the runtime environment of the IoT Gateway.
static ContractsClient ContractsClient
XMPP Contracts Client, if such a compoent is available on the XMPP broker.
Configures legal identity for the gateway.
static bool IsMeApproved(CaseInsensitiveString LegalId)
Checks if a Legal Identity refers to an approved ID of the gateway.
Contains the definition of a contract
static Task< ParsedContract > Parse(XmlDocument Xml)
Validates a contract XML Document, and returns the contract definition in it.
ClientSignature[] ClientSignatures
Client signatures of the contract.
void Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeIdAttribute, bool IncludeClientSignatures, bool IncludeAttachments, bool IncludeStatus, bool IncludeServerSignature, bool IncludeAttachmentReferences)
Serializes the Contract, in normalized form.
string DefaultLanguage
Default language for contract.
Contains information about a parsed contract.
Contract Contract
Contract object
CaseInsensitiveString Subdomain
Subdomain name.
XmppAddress MainDomain
Main/principal domain address
bool IsComponentDomain(CaseInsensitiveString Domain, bool IncludeAlternativeDomains)
Checks if a domain is the component domain, or optionally, an alternative component domain.
Contains information about one XMPP address.
CaseInsensitiveString Address
XMPP Address
static bool CheckExpressionSafe(Expression Expression, out ScriptNode Prohibited)
Checks if an expression is safe to execute (if it comes from an external source).
Represents a case-insensitive string.
string Value
String-representation of the case-insensitive string. (Representation is case sensitive....
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
string LowerCase
Lower-case representation of the case-insensitive string.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
static Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
static async Task Update(object Object)
Updates an object in the database.
static async Task Delete(object Object)
Deletes an object in the database.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
This filter selects objects that conform to all child-filters provided.
This filter selects objects that have a named field equal to a given value.
This filter selects objects that have a named field not equal to a given value.
Static class that dynamically manages types and interfaces available in the runtime environment.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Static class managing persistent settings.
static async Task< string > GetAsync(string Key, string DefaultValue)
Gets a string-valued setting.
Represents a named semaphore, i.e. an object, identified by a name, that allows single concurrent wri...
async Task DisposeAsync()
Disposes of the object, asynchronously.
Static class of application-wide semaphores that can be used to order access to editable objects.
static async Task< Semaphore > BeginWrite(string Key)
Waits until the semaphore identified by Key is ready for writing. Each call to BeginWrite must be fo...
Class that can be used to schedule events in time. It uses a timer to execute tasks at the appointed ...
bool Remove(DateTime When)
Removes an event scheduled for a given point in time.
void Dispose()
IDisposable.Dispose
DateTime Add(DateTime When, Action< object > Callback, object State)
Adds an event.
Class managing a script expression.
async Task< object > EvaluateAsync(Variables Variables)
Evaluates the expression, using the variables provided in the Variables collection....
static decimal ToDecimal(object Object)
Converts an object to a double value.
Base class for all nodes in a parsed script tree.
virtual bool ContainsVariable(string Name)
If the collection contains a variable with a given name.
Manages eDaler on accounts connected to the broker.
Represents a digital signature on a contract.
CaseInsensitiveString BareJid
Bare JID of the client used to generate the signature.
CaseInsensitiveString Role
Role of the legal identity in the contract.
Contains the definition of a contract
async Task Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeIdAttribute, bool IncludeClientSignatures, bool IncludeAttachments, bool IncludeStatus, bool IncludeServerSignature, bool IncludeAttachmentReferences, Dictionary< string, string > AttachmentsUrls, LegalComponent LegalComponent)
Serializes the Contract, in normalized form.
string DefaultLanguage
Default language for contract.
CaseInsensitiveString ContractId
Contract Identity
Class defining a part in a contract
CaseInsensitiveString Role
Role of the part in the contract
CaseInsensitiveString LegalId
Legal identity of part
int MinCount
Smallest amount of signatures of this role required for a legally binding contract.
bool CanRevoke
If parts having this role, can revoke their signature, once signed.
int MaxCount
Largest amount of signatures of this role required for a legally binding contract.
CaseInsensitiveString Name
Name of the role.
Abstract base class of signatures
Legal (digital identities, smart contracts) service component.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
const string SellerRole
Role name of seller.
const string AuctioneerRole
Role name of auctioneer.
const string BuyerRole
Role name of buyer.
const string MarketplaceNamespace
https://paiwise.tagroot.io/Schema/Marketplace.xsd
Event raised when a token has been created.
decimal Value
Latest value of token
Event raised when a token has been transferred.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
const string NeuroFeaturesNamespace
https://paiwise.tagroot.io/Schema/NeuroFeatures.xsd
async Task Serialize(StringBuilder Xml, bool IncludeNamespace, bool IncludeServerSignature)
Serializes the Token, in normalized form.
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
CaseInsensitiveString OwnerJid
JID of Current owner of token
Duration? ArchiveRequired
Duration after which token expires, the token is required to be archived.
DateTime Expires
Expiry date of token.
CaseInsensitiveString TokenId
Token ID
Paiwise processor, processing payment instructions defined in smart contracts.
PubSub component, as defined in XEP-0060. https://xmpp.org/extensions/xep-0060.html
Task< string > PublishItem(string Service, string NodeName, string AutoCreateAccess, string From, string Domain, string ItemId, string XmlContent, string Language)
Call this method for automated publishing of pubsub items from hosted services.
ContractState
Recognized contract states
OptimizeDirection
Direction in which to optimize prices and/or scores.
NodeAccessModel
Node access model.