feat: B/P Detailed Errors, race condition fixes, and preliminary support for the Customer Account API#177
Conversation
…mple, due to any discount relevant to the Customer Account)
…Components`, etc
| "applicationUrl": "https://localhost:5001", | ||
| "environmentVariables": { | ||
| "ASPNETCORE_ENVIRONMENT": "Development", | ||
| "ASPNETCORE_ENVIRONMENT": "no-auth", |
There was a problem hiding this comment.
Suspect this shouldn't have been left in?
There was a problem hiding this comment.
Have removed that in the next commit
| orderItem.Status == BookingStatus.Absent ? OrderItemStatus.AttendeeAbsent : (OrderItemStatus?)null, | ||
| Attendee = hasAttendeeDetails ? new Person | ||
| { | ||
| GivenName = orderItem.AttendeeGivenName ?? null, |
There was a problem hiding this comment.
Not sure ?? null has any affect here? If it's already null, then null will be assigned
| long numberOfSpaces, | ||
| bool proposal | ||
| bool proposal, | ||
| List<string> attendeeEmail, |
There was a problem hiding this comment.
Why is this a set of List<string> and not a List<> of a structured object?
There was a problem hiding this comment.
Was following the pattern already set for speed
There was a problem hiding this comment.
For example, addLease and addOrder have exactly the same "string instead of structured object" pattern. I suspect this is because there's isn't a API<->DB translation layer (unless I've missed something)
nickevansuk
left a comment
There was a problem hiding this comment.
@civsiv a few more minor fixes here
| .Where(x => x.RequestOrderItem.Attendee != null) | ||
| .Select(x => new FakeDbPerson | ||
| { | ||
| GivenName = x.RequestOrderItem.Attendee.GivenName, | ||
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | ||
| Email = x.RequestOrderItem.Attendee.Email, | ||
| Telephone = x.RequestOrderItem.Attendee.Telephone, | ||
| }) | ||
| .ToList(), |
There was a problem hiding this comment.
@civsiv will this not cause issues with the attendees not being stored against the correct OrderItems if only some attendees are specified.
e.g. at P
1: Bob
2: Null
3: Alex
then B would be
1: Bob
2: Alex
3: Null
So we'd actually want something more like the below:?
| .Where(x => x.RequestOrderItem.Attendee != null) | |
| .Select(x => new FakeDbPerson | |
| { | |
| GivenName = x.RequestOrderItem.Attendee.GivenName, | |
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | |
| Email = x.RequestOrderItem.Attendee.Email, | |
| Telephone = x.RequestOrderItem.Attendee.Telephone, | |
| }) | |
| .ToList(), | |
| .Select(x => x.RequestOrderItem.Attendee == null ? null : new FakeDbPerson | |
| { | |
| GivenName = x.RequestOrderItem.Attendee.GivenName, | |
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | |
| Email = x.RequestOrderItem.Attendee.Email, | |
| Telephone = x.RequestOrderItem.Attendee.Telephone, | |
| }) | |
| .ToList(), |
There was a problem hiding this comment.
Yep that's a good catch. I'll make two additional fixes here too:
- Make this change for OrderItemIntakeFormResponse as that has the same logic
- Turn this into the Serialize/Deserialize logic used for OrderItemIntakeFormResponse so that FakeDbPerson can be removed.
| .Where(x => x.RequestOrderItem.Attendee != null) | ||
| .Select(x => new FakeDbPerson | ||
| { | ||
| GivenName = x.RequestOrderItem.Attendee.GivenName, | ||
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | ||
| Email = x.RequestOrderItem.Attendee.Email, | ||
| Telephone = x.RequestOrderItem.Attendee.Telephone, | ||
| }) | ||
| .ToList(), |
There was a problem hiding this comment.
Same issue as above?
| .Where(x => x.RequestOrderItem.Attendee != null) | ||
| .Select(x => new FakeDbPerson | ||
| { | ||
| GivenName = x.RequestOrderItem.Attendee.GivenName, | ||
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | ||
| Email = x.RequestOrderItem.Attendee.Email, | ||
| Telephone = x.RequestOrderItem.Attendee.Telephone, | ||
| }) | ||
| .ToList(), |
There was a problem hiding this comment.
Same issue as above?
| .Where(x => x.RequestOrderItem.Attendee != null) | ||
| .Select(x => new FakeDbPerson | ||
| { | ||
| GivenName = x.RequestOrderItem.Attendee.GivenName, | ||
| FamilyName = x.RequestOrderItem.Attendee.FamilyName, | ||
| Email = x.RequestOrderItem.Attendee.Email, | ||
| Telephone = x.RequestOrderItem.Attendee.Telephone, | ||
| }) | ||
| .ToList(), |
There was a problem hiding this comment.
Same issue as below?
| MeetingId = thisClass.AttendanceMode != AttendanceMode.Offline ? Faker.Random.String(length: 10, minChar: '0', maxChar: '9') : null, | ||
| MeetingPassword = thisClass.AttendanceMode != AttendanceMode.Offline ? Faker.Random.String(length: 10, minChar: '0', maxChar: '9') : null | ||
| MeetingPassword = thisClass.AttendanceMode != AttendanceMode.Offline ? Faker.Random.String(length: 10, minChar: '0', maxChar: '9') : null, | ||
| AttendeeEmail = attendees.Count > 0 ? attendees[i].Email : null, |
There was a problem hiding this comment.
Does this check make sense? Could we be out-of-bounds of the array if i was 2 and the attendee count was 1 (due to the Where clause flagged earlier).
Perhaps something more defensive such as:
| AttendeeEmail = attendees.Count > 0 ? attendees[i].Email : null, | |
| AttendeeEmail = attendees.Count > i ? attendees[i].Email : null, |
Also note any amends to this pattern need to be replicated below also
There was a problem hiding this comment.
I'm going to change this to be a serialised string which will remove all of these issues
This PR includes:
CustomerAccountsupport based on the ongoing conversations around the Customer Accounts proposal, to inform the OpenActive specification work for Customer Accounts with implementation feedback.Migration required for users of the library as follows:
SellerIdComponentswithSimpleIdComponentsSellerIdLongwithIdLongSellerIdGuidwithIdGuidSellerIdStringwithIdString(string clientId, Uri sellerId) = User.GetAccessTokenOpenBookingClaims();with(string clientId, Uri sellerId, _) = User.GetAccessTokenOpenBookingClaims();