From 0f631fec29d80b32b0e45deeed37299906e6f599 Mon Sep 17 00:00:00 2001 From: OpenActive Bot <20357321+openactive-bot@users.noreply.github.com> Date: Mon, 1 Mar 2021 15:42:57 +0000 Subject: [PATCH] Move allowCustomerCancellationFullRefund to Offer (#16) --- OpenActive.NET.Generator/package-lock.json | 6 ++--- OpenActive.NET.Generator/package.json | 2 +- OpenActive.NET.Test/OrderTest.cs | 2 +- OpenActive.NET/models/Offer.cs | 26 ++++++++++++------- OpenActive.NET/models/OfferOverride.cs | 4 +++ OpenActive.NET/models/OrderItem.cs | 30 ++++++++-------------- 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/OpenActive.NET.Generator/package-lock.json b/OpenActive.NET.Generator/package-lock.json index a19dd36..cf38d8d 100644 --- a/OpenActive.NET.Generator/package-lock.json +++ b/OpenActive.NET.Generator/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@openactive/data-models": { - "version": "2.0.174", - "resolved": "https://registry.npmjs.org/@openactive/data-models/-/data-models-2.0.174.tgz", - "integrity": "sha512-Qs4dDJEja8lfvE/CrECf9IroGrqbhotoqitvOUdJZlS6/AixguN23xlAZQS1R4JAiSQMtbCLAib3m5s39DqGsw==" + "version": "2.0.177", + "resolved": "https://registry.npmjs.org/@openactive/data-models/-/data-models-2.0.177.tgz", + "integrity": "sha512-aFqRG5e1j+A+XjRtemSYjZboEpwu5P0HT2i4/4GzuD2g1khRqMRP+k2t6Vuf4PCr9T9wKw3Y5LWEn9q287ivQg==" }, "@types/concat-stream": { "version": "1.6.0", diff --git a/OpenActive.NET.Generator/package.json b/OpenActive.NET.Generator/package.json index 11a72fa..aa0abe3 100644 --- a/OpenActive.NET.Generator/package.json +++ b/OpenActive.NET.Generator/package.json @@ -11,7 +11,7 @@ "author": "Nick Evans", "license": "MIT", "dependencies": { - "@openactive/data-models": "^2.0.174", + "@openactive/data-models": "^2.0.177", "fs-extra": "^7.0.1", "sync-request": "^6.0.0" } diff --git a/OpenActive.NET.Test/OrderTest.cs b/OpenActive.NET.Test/OrderTest.cs index faea919..378f11c 100644 --- a/OpenActive.NET.Test/OrderTest.cs +++ b/OpenActive.NET.Test/OrderTest.cs @@ -182,6 +182,7 @@ public void OrderQuote_EncodeDecode() "\"@id\":\"https://example.com/events/452#/offers/878\"," + "\"name\":\"Speedball winger position\"," + "\"description\":\"Winger space for Speedball.\"," + + "\"allowCustomerCancellationFullRefund\":true," + "\"latestCancellationBeforeStartDate\":\"P1D\"," + "\"price\":0," + "\"priceCurrency\":\"GBP\"," + @@ -193,7 +194,6 @@ public void OrderQuote_EncodeDecode() "\"text\":\"0123456789\"" + "}" + "]," + - "\"allowCustomerCancellationFullRefund\":true," + "\"orderedItem\":{" + "\"@type\":\"ScheduledSession\"," + "\"@id\":\"https://example.com/events/452/subEvents/132\"," + diff --git a/OpenActive.NET/models/Offer.cs b/OpenActive.NET/models/Offer.cs index 88fd3fa..13ec85d 100644 --- a/OpenActive.NET/models/Offer.cs +++ b/OpenActive.NET/models/Offer.cs @@ -149,10 +149,18 @@ public override string ToString() public virtual QuantitativeValue AgeRestriction { get; set; } + /// + /// Whether the opportunity can be cancelled with a full refund at any time before the `startDate`, or before the `latestCancellationBeforeStartDate` if provided. + /// + [DataMember(Name = "allowCustomerCancellationFullRefund", EmitDefaultValue = false, Order = 14)] + [JsonConverter(typeof(ValuesConverter))] + public virtual bool? AllowCustomerCancellationFullRefund { get; set; } + + /// /// The channels through which a booking can be made. /// - [DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 14)] + [DataMember(Name = "availableChannel", EmitDefaultValue = false, Order = 15)] [JsonConverter(typeof(ValuesConverter))] public new virtual List AvailableChannel { get; set; } @@ -160,7 +168,7 @@ public override string ToString() /// /// The duration before the startDate during which this Offer may not be cancelled, given in ISO 8601 format. /// - [DataMember(Name = "latestCancellationBeforeStartDate", EmitDefaultValue = false, Order = 15)] + [DataMember(Name = "latestCancellationBeforeStartDate", EmitDefaultValue = false, Order = 16)] [JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))] public virtual TimeSpan? LatestCancellationBeforeStartDate { get; set; } @@ -168,7 +176,7 @@ public override string ToString() /// /// Can include https://openactive.io/OpenBookingIntakeForm, https://openactive.io/OpenBookingAttendeeDetails, https://openactive.io/OpenBookingApproval, https://openactive.io/OpenBookingNegotiation, https://openactive.io/OpenBookingMessageExchange /// - [DataMember(Name = "openBookingFlowRequirement", EmitDefaultValue = false, Order = 16)] + [DataMember(Name = "openBookingFlowRequirement", EmitDefaultValue = false, Order = 17)] [JsonConverter(typeof(ValuesConverter))] public virtual List OpenBookingFlowRequirement { get; set; } @@ -181,7 +189,7 @@ public override string ToString() /// "prepayment": "https://openactive.io/Required" /// /// - [DataMember(Name = "prepayment", EmitDefaultValue = false, Order = 17)] + [DataMember(Name = "prepayment", EmitDefaultValue = false, Order = 18)] [JsonConverter(typeof(ValuesConverter))] public virtual RequiredStatusType? Prepayment { get; set; } @@ -197,7 +205,7 @@ public override string ToString() /// "price": 33 /// /// - [DataMember(Name = "price", EmitDefaultValue = false, Order = 18)] + [DataMember(Name = "price", EmitDefaultValue = false, Order = 19)] [JsonConverter(typeof(ValuesConverter))] public new virtual decimal? Price { get; set; } @@ -210,7 +218,7 @@ public override string ToString() /// "priceCurrency": "GBP" /// /// - [DataMember(Name = "priceCurrency", EmitDefaultValue = false, Order = 19)] + [DataMember(Name = "priceCurrency", EmitDefaultValue = false, Order = 20)] [JsonConverter(typeof(ValuesConverter))] public new virtual string PriceCurrency { get; set; } @@ -223,7 +231,7 @@ public override string ToString() /// "url": "http://www.rphs.org.uk/" /// /// - [DataMember(Name = "url", EmitDefaultValue = false, Order = 20)] + [DataMember(Name = "url", EmitDefaultValue = false, Order = 21)] [JsonConverter(typeof(ValuesConverter))] public new virtual Uri Url { get; set; } @@ -231,7 +239,7 @@ public override string ToString() /// /// The duration before the startDate for which this Offer is valid, given in ISO 8601 format. This is a relatively-defined equivalent of schema:validFrom, to allow for Offer inheritance. /// - [DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 21)] + [DataMember(Name = "validFromBeforeStartDate", EmitDefaultValue = false, Order = 22)] [JsonConverter(typeof(OpenActiveTimeSpanToISO8601DurationValuesConverter))] public virtual TimeSpan? ValidFromBeforeStartDate { get; set; } @@ -242,7 +250,7 @@ public override string ToString() /// /// If you are using this property, please join the discussion at proposal [#250](https://github.com/openactive/modelling-opportunity-data/issues/250). /// - [DataMember(Name = "beta:partySize", EmitDefaultValue = false, Order = 1022)] + [DataMember(Name = "beta:partySize", EmitDefaultValue = false, Order = 1023)] [JsonConverter(typeof(ValuesConverter))] public virtual QuantitativeValue PartySize { get; set; } diff --git a/OpenActive.NET/models/OfferOverride.cs b/OpenActive.NET/models/OfferOverride.cs index e39115b..9a68bb9 100644 --- a/OpenActive.NET/models/OfferOverride.cs +++ b/OpenActive.NET/models/OfferOverride.cs @@ -59,6 +59,10 @@ public override string ToString() public override QuantitativeValue AgeRestriction { get; set; } + [Obsolete("This property is disinherited in this type, and must not be used.", true)] + public override bool? AllowCustomerCancellationFullRefund { get; set; } + + [Obsolete("This property is disinherited in this type, and must not be used.", true)] public override List AvailableChannel { get; set; } diff --git a/OpenActive.NET/models/OrderItem.cs b/OpenActive.NET/models/OrderItem.cs index f35318b..f02a989 100644 --- a/OpenActive.NET/models/OrderItem.cs +++ b/OpenActive.NET/models/OrderItem.cs @@ -79,18 +79,10 @@ public override string ToString() public virtual List AccessPass { get; set; } - /// - /// Whether the event can be cancelled. - /// - [DataMember(Name = "allowCustomerCancellationFullRefund", EmitDefaultValue = false, Order = 11)] - [JsonConverter(typeof(ValuesConverter))] - public virtual bool? AllowCustomerCancellationFullRefund { get; set; } - - /// /// The person attending the Opportunity related to the OrderItem. /// - [DataMember(Name = "attendee", EmitDefaultValue = false, Order = 12)] + [DataMember(Name = "attendee", EmitDefaultValue = false, Order = 11)] [JsonConverter(typeof(ValuesConverter))] public new virtual Person Attendee { get; set; } @@ -98,7 +90,7 @@ public override string ToString() /// /// The properties of `schema:Person` that are required to describe an `attendee` for this `OrderItem`. /// - [DataMember(Name = "attendeeDetailsRequired", EmitDefaultValue = false, Order = 13)] + [DataMember(Name = "attendeeDetailsRequired", EmitDefaultValue = false, Order = 12)] [JsonConverter(typeof(ValuesConverter))] public virtual List AttendeeDetailsRequired { get; set; } @@ -106,7 +98,7 @@ public override string ToString() /// /// A message set by the Seller in the event of Opportunity cancellation, only applicable for an `Order` and where the `OrderItem` has `orderItemStatus` set to `https://openactive.io/SellerCancelled` /// - [DataMember(Name = "cancellationMessage", EmitDefaultValue = false, Order = 14)] + [DataMember(Name = "cancellationMessage", EmitDefaultValue = false, Order = 13)] [JsonConverter(typeof(ValuesConverter))] public virtual string CancellationMessage { get; set; } @@ -114,7 +106,7 @@ public override string ToString() /// /// A message set by the Seller to trigger a notification to the Customer, only applicable for an `Order` and where the `OrderItem` has `orderItemStatus` set to `https://openactive.io/OrderItemConfirmed` or `https://openactive.io/CustomerAttended` /// - [DataMember(Name = "customerNotice", EmitDefaultValue = false, Order = 15)] + [DataMember(Name = "customerNotice", EmitDefaultValue = false, Order = 14)] [JsonConverter(typeof(ValuesConverter))] public virtual string CustomerNotice { get; set; } @@ -122,7 +114,7 @@ public override string ToString() /// /// Array of errors related to the OrderItem being included in the Order, only applicable for an OrderQuote. /// - [DataMember(Name = "error", EmitDefaultValue = false, Order = 16)] + [DataMember(Name = "error", EmitDefaultValue = false, Order = 15)] [JsonConverter(typeof(ValuesConverter))] public new virtual List Error { get; set; } @@ -130,7 +122,7 @@ public override string ToString() /// /// The specific bookable Thing that has been selected by the Customer. See the [Modelling-Opportunity-Data] for more information on these types. Note that the Broker Request and Orders feed only require id within these objects to be included; in these contexts, all other properties are ignored. /// - [DataMember(Name = "orderedItem", EmitDefaultValue = false, Order = 17)] + [DataMember(Name = "orderedItem", EmitDefaultValue = false, Order = 16)] [JsonConverter(typeof(ValuesConverter))] public new virtual Event OrderedItem { get; set; } @@ -138,7 +130,7 @@ public override string ToString() /// /// PropertyValueSpecifications that describe fields in the orderItemIntakeForm. /// - [DataMember(Name = "orderItemIntakeForm", EmitDefaultValue = false, Order = 18)] + [DataMember(Name = "orderItemIntakeForm", EmitDefaultValue = false, Order = 17)] [JsonConverter(typeof(ValuesConverter))] public virtual List OrderItemIntakeForm { get; set; } @@ -146,7 +138,7 @@ public override string ToString() /// /// PropertyValues that contains a text value responses to the orderItemIntakeForm. /// - [DataMember(Name = "orderItemIntakeFormResponse", EmitDefaultValue = false, Order = 19)] + [DataMember(Name = "orderItemIntakeFormResponse", EmitDefaultValue = false, Order = 18)] [JsonConverter(typeof(ValuesConverter))] public virtual List OrderItemIntakeFormResponse { get; set; } @@ -154,7 +146,7 @@ public override string ToString() /// /// /// - [DataMember(Name = "orderItemStatus", EmitDefaultValue = false, Order = 20)] + [DataMember(Name = "orderItemStatus", EmitDefaultValue = false, Order = 19)] [JsonConverter(typeof(ValuesConverter))] public new virtual OrderItemStatus? OrderItemStatus { get; set; } @@ -162,7 +154,7 @@ public override string ToString() /// /// An integer representing the order of OrderItems within the array. /// - [DataMember(Name = "position", EmitDefaultValue = false, Order = 21)] + [DataMember(Name = "position", EmitDefaultValue = false, Order = 20)] [JsonConverter(typeof(ValuesConverter))] public new virtual long? Position { get; set; } @@ -170,7 +162,7 @@ public override string ToString() /// /// Breakdown of tax payable for the OrderItem. /// - [DataMember(Name = "unitTaxSpecification", EmitDefaultValue = false, Order = 22)] + [DataMember(Name = "unitTaxSpecification", EmitDefaultValue = false, Order = 21)] [JsonConverter(typeof(ValuesConverter))] public virtual List UnitTaxSpecification { get; set; }