Skip to content

Commit

Permalink
Customer Accounts early release additions (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
openactive-bot authored Nov 23, 2021
1 parent a3e38a4 commit 20b489c
Show file tree
Hide file tree
Showing 9 changed files with 407 additions and 93 deletions.
20 changes: 20 additions & 0 deletions OpenActive.NET/enums/PropertyEnumeration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public enum PropertyEnumeration
AccessibilityInformation,
[EnumMember(Value = "https://openactive.io/accessibilitySupport")]
AccessibilitySupport,
[EnumMember(Value = "https://openactive.io/accountNumber")]
AccountNumber,
[EnumMember(Value = "https://openactive.io/activity")]
Activity,
[EnumMember(Value = "https://openactive.io/additionalAdmissionRestriction")]
Expand Down Expand Up @@ -45,14 +47,28 @@ public enum PropertyEnumeration
CancellationMessage,
[EnumMember(Value = "https://openactive.io/concept")]
Concept,
[EnumMember(Value = "https://openactive.io/customerAccountBookingRestriction")]
CustomerAccountBookingRestriction,
[EnumMember(Value = "https://openactive.io/customerNotice")]
CustomerNotice,
[EnumMember(Value = "https://openactive.io/eligibleEntitlementType")]
EligibleEntitlementType,
[EnumMember(Value = "https://openactive.io/emergencyContact")]
EmergencyContact,
[EnumMember(Value = "https://openactive.io/entitlement")]
Entitlement,
[EnumMember(Value = "https://openactive.io/entitlementType")]
EntitlementType,
[EnumMember(Value = "https://openactive.io/evidenceRequestAction")]
EvidenceRequestAction,
[EnumMember(Value = "https://openactive.io/facilityUse")]
FacilityUse,
[EnumMember(Value = "https://openactive.io/genderRestriction")]
GenderRestriction,
[EnumMember(Value = "https://openactive.io/hasAccount")]
HasAccount,
[EnumMember(Value = "https://openactive.io/hasHiddenEntitlements")]
HasHiddenEntitlements,
[EnumMember(Value = "https://openactive.io/idTemplate")]
IdTemplate,
[EnumMember(Value = "https://openactive.io/individualFacilityUse")]
Expand All @@ -65,6 +81,8 @@ public enum PropertyEnumeration
IsCoached,
[EnumMember(Value = "https://openactive.io/isOpenBookingAllowed")]
IsOpenBookingAllowed,
[EnumMember(Value = "https://openactive.io/isOpenBookingWithCustomerAccountAllowed")]
IsOpenBookingWithCustomerAccountAllowed,
[EnumMember(Value = "https://openactive.io/latestCancellationBeforeStartDate")]
LatestCancellationBeforeStartDate,
[EnumMember(Value = "https://openactive.io/leader")]
Expand Down Expand Up @@ -101,6 +119,8 @@ public enum PropertyEnumeration
OrderRequiresApproval,
[EnumMember(Value = "https://openactive.io/orderSellerNote")]
OrderSellerNote,
[EnumMember(Value = "https://openactive.io/outstandingAction")]
OutstandingAction,
[EnumMember(Value = "https://openactive.io/payment")]
Payment,
[EnumMember(Value = "https://openactive.io/paymentProviderId")]
Expand Down
109 changes: 109 additions & 0 deletions OpenActive.NET/models/CustomerAccount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace OpenActive.NET
{
/// <summary>
///
/// EARLY RELEASE NOTICE: This class represents a draft that is designed to inform the OpenActive specification work with implementation feedback. IT IS STILL SUBJECT TO CHANGE, as the [Customer Accounts proposal](https://github.com/openactive/customer-accounts) evolves.
///
/// This type is derived from https://schema.org/Thing, which means that any of this type's properties within schema.org may also be used.
/// </summary>
[DataContract]
public partial class CustomerAccount : Schema.NET.Thing
{
/// <summary>
/// Returns the JSON-LD representation of this instance.
/// This method overrides Schema.NET ToString() to serialise using OpenActiveSerializer.
/// </summary>
/// <returns>A <see cref="string" /> that represents the JSON-LD representation of this instance.</returns>
public override string ToString()
{
return OpenActiveSerializer.Serialize(this);
}

/// <summary>
/// Returns the JSON-LD representation of this instance, including "https://schema.org" in the "@context".
///
/// This method must be used when you want to embed the output raw (as-is) into a web
/// page. It uses serializer settings with HTML escaping to avoid Cross-Site Scripting (XSS)
/// vulnerabilities if the object was constructed from an untrusted source.
///
/// This method overrides Schema.NET ToHtmlEscapedString() to serialise using OpenActiveSerializer.
/// </summary>
/// <returns>
/// A <see cref="string" /> that represents the JSON-LD representation of this instance.
/// </returns>
public new string ToHtmlEscapedString()
{
return OpenActiveSerializer.SerializeToHtmlEmbeddableString(this);
}

/// <summary>
/// Gets the name of the type as specified by schema.org.
/// </summary>
[DataMember(Name = "@type", Order = 1)]
public override string Type => "CustomerAccount";

/// <summary>
/// The identifier of the Customer Account used by the Booking System.
/// </summary>
/// <example>
/// <code>
/// "identifier": "fdc14503-275e-46d3-9922-45b986c9f9aa"
/// </code>
/// </example>
[DataMember(Name = "identifier", EmitDefaultValue = false, Order = 7)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual string Identifier { get; set; }

/// <summary>
/// The barcode, QR code, magnetic stripe, or swipe card associated with this Customer Account, within their own namespaces.
/// </summary>
[DataMember(Name = "accessPass", EmitDefaultValue = false, Order = 8)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Barcode> AccessPass { get; set; }

/// <summary>
/// The customer-facing identifier for the Customer Account.
/// </summary>
[DataMember(Name = "accountNumber", EmitDefaultValue = false, Order = 9)]
[JsonConverter(typeof(ValuesConverter))]
public virtual string AccountNumber { get; set; }

/// <summary>
/// The person or organization to whom this Customer Account belongs.
/// </summary>
[DataMember(Name = "customer", EmitDefaultValue = false, Order = 10)]
[JsonConverter(typeof(ValuesConverter))]
public new virtual ILegalEntity Customer { get; set; }

/// <summary>
/// The current valid and active entitlements associated with this customer. Note that expired or inactive entitlements are not included in this list.
/// </summary>
[DataMember(Name = "entitlement", EmitDefaultValue = false, Order = 11)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Entitlement> Entitlement { get; set; }

/// <summary>
/// Whether there are any additional entitlements (other than those listed in entitlement) or other types of discounts are associated with the Customer Account that will influence pricing, and therefore whether the pricing for the entitlement in the feed should be treated as indicative.
/// </summary>
/// <example>
/// <code>
/// "hasHiddenEntitlements": "true"
/// </code>
/// </example>
[DataMember(Name = "hasHiddenEntitlements", EmitDefaultValue = false, Order = 12)]
[JsonConverter(typeof(ValuesConverter))]
public virtual bool? HasHiddenEntitlements { get; set; }

/// <summary>
/// Outstanding actions on this Customer Account, such as the resolution of outstanding debts or membership renewal. These may prevent the Customer from making bookings.
/// </summary>
[DataMember(Name = "outstandingAction", EmitDefaultValue = false, Order = 13)]
[JsonConverter(typeof(ValuesConverter))]
public virtual List<Action> OutstandingAction { get; set; }
}
}
88 changes: 88 additions & 0 deletions OpenActive.NET/models/Entitlement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace OpenActive.NET
{
/// <summary>
///
/// EARLY RELEASE NOTICE: This class represents a draft that is designed to inform the OpenActive specification work with implementation feedback. IT IS STILL SUBJECT TO CHANGE, as the [Customer Accounts proposal](https://github.com/openactive/customer-accounts) evolves.
///
/// This type is derived from https://schema.org/Permit, which means that any of this type's properties within schema.org may also be used.
/// </summary>
[DataContract]
public partial class Entitlement : Schema.NET.Permit
{
/// <summary>
/// Returns the JSON-LD representation of this instance.
/// This method overrides Schema.NET ToString() to serialise using OpenActiveSerializer.
/// </summary>
/// <returns>A <see cref="string" /> that represents the JSON-LD representation of this instance.</returns>
public override string ToString()
{
return OpenActiveSerializer.Serialize(this);
}

/// <summary>
/// Returns the JSON-LD representation of this instance, including "https://schema.org" in the "@context".
///
/// This method must be used when you want to embed the output raw (as-is) into a web
/// page. It uses serializer settings with HTML escaping to avoid Cross-Site Scripting (XSS)
/// vulnerabilities if the object was constructed from an untrusted source.
///
/// This method overrides Schema.NET ToHtmlEscapedString() to serialise using OpenActiveSerializer.
/// </summary>
/// <returns>
/// A <see cref="string" /> that represents the JSON-LD representation of this instance.
/// </returns>
public new string ToHtmlEscapedString()
{
return OpenActiveSerializer.SerializeToHtmlEmbeddableString(this);
}

/// <summary>
/// Gets the name of the type as specified by schema.org.
/// </summary>
[DataMember(Name = "@type", Order = 1)]
public override string Type => "Entitlement";

/// <summary>
/// For the request, this is the value of the `@id` of the Concept being referenced. For the response, this the full Concept object including the `@id` and prefLabel.
/// </summary>
/// <example>
/// <code>
/// "entitlementType": {
/// "@type": "Concept",
/// "@id": "https://data.mcractive.com/openactive/entitlement-list#5e78bcbe-36db-425a-9064-bf96d09cc351",
/// "prefLabel": "MCRactive Adult Resident",
/// "inScheme": "https://data.mcractive.com/openactive/entitlement-list"
/// }
/// </code>
/// </example>
[DataMember(Name = "entitlementType", EmitDefaultValue = false, Order = 7)]
[JsonConverter(typeof(ValuesConverter))]
public virtual ReferenceValue<Concept> EntitlementType { get; set; }

/// <summary>
/// Any evidence request associated with the entitlement.
/// </summary>
[DataMember(Name = "evidenceRequestAction", EmitDefaultValue = false, Order = 8)]
[JsonConverter(typeof(ValuesConverter))]
public virtual Action EvidenceRequestAction { get; set; }

/// <summary>
/// The date the entitlement becomes valid. This must be in the past.
/// </summary>
[DataMember(Name = "validFrom", EmitDefaultValue = false, Order = 9)]
[JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))]
public new virtual DateTimeOffset? ValidFrom { get; set; }

/// <summary>
/// The date that the entitlement is no longer valid. This must be in the future.
/// </summary>
[DataMember(Name = "validUntil", EmitDefaultValue = false, Order = 10)]
[JsonConverter(typeof(OpenActiveDateTimeOffsetToISO8601DateTimeValuesConverter))]
public new virtual DateTimeOffset? ValidUntil { get; set; }
}
}
Loading

0 comments on commit 20b489c

Please sign in to comment.