<!--   
To test run project and goto public api (swagger) > 
http://localhost:7508/swagger/ui/index

UAT	
https://kc-uat-publicapi.azurewebsites.net/swagger/ui/index

STAGING	
https://kc-kcplstaging-publicapi.azurewebsites.net/swagger/ui/index

LIVE	
https://publicapi.petlog.org.uk/swagger/ui/index

=======================================
 ** LOGIN **
=======================================

will need to login first, so use the LOGIN method.
this required JSON 

(Valid in KCDEV)
{"LoginID": "K.K","Password": "KK","ClientKey": "00000000-0000-0000-0000-000000000000"}
(Valid QA)
{"LoginID": "api_test.APIVetXMLRegistrations@thekennelclub.org.uk","Password": "api_test.APIVetXMLRegistrations@thekennelclub.org.uk","ClientKey": "00000000-0000-0000-0000-000000000000"}
(Valid Staging)
{"LoginID": "lindawhite94@gmail.com","Password": "lindawhite94@gmail.com","ClientKey": "00000000-0000-0000-0000-000000000000"}
(has bad escape sequence in)
{"LoginID": "bva@publicapi.org.uk","Password": "y\sL[q/V8z","ClientKey": "00000000-0000-0000-0000-000000000000"}
{"LoginID": "BVA.Lookup@bva.co.uk","Password": "5AV7vFMSyRx*","ClientKey": "00000000-0000-0000-0000-000000000000"}

"{\"LoginID\": \"bva@publicapi.org.uk\",\"Password\": \"y\sL[q/V8z\",\"ClientKey\": \"00000000-0000-0000-0000-000000000000\"}"

NOTE: used fsdyn_publicapiuser table for this data
NOTE: Client GUID not used / obsolete currently.
NOTE: could also use postman for this too (see below notes about postman)

will then get a response like this :

{
  "Data": [
    {
      "UsrLoginCount": -2147483648,
      "UsrAuthenticator": "",
      "SecurityToken": "1b9b0c82-5317-4c2d-82ba-61f73d1dc38d",
      "UserAuthenticated": true,
      "UGUID": "00000000-0000-0000-0000-000000000000",
      "ClientKey": "00000000-0000-0000-0000-000000000000",
      "InstallKey": "00000000-0000-0000-0000-000000000000",
      "UsrLoginID": "Kris",
      "UsrEmail": "",
      "UsrFirstName": "",
      "UsrLastName": "",
      "UID": -2147483648,
      "ClientKeyID": -2147483648,
      "InstallKeyID": 0,
      "ClientMapID": -2147483648,
      "UsrIsActive": false,
      "UsrStatus": 9,
      "UsrPermissionsPublic": [],
      "UsrPermissionsPrivate": [],
      "UsrDataMapping": []
    }
  ],
  "FieldErrors": [],
  "OperationErrors": [],
  "Result": "Ok"
}

now grab the "SecurityToken": "1b9b0c82-5317-4c2d-82ba-61f73d1dc38d",

next base64 this value use a website like this > https://base64.guru/converter
this converts GUID into Base64 value (this one was 'MWI5YjBjODItNTMxNy00YzJkLTgyYmEtNjFmNzNkMWRjMzhk')

=======================================
** Registration ** 
=======================================

To test the registration, we need an app siomething like postman : https://www.postman.com/downloads/

Create a new tab for api/VetXMLMicrochipRegistration
On the authorisation tab:
  and add a 'Bearer Token' of 'MWI5YjBjODItNTMxNy00YzJkLTgyYmEtNjFmNzNkMWRjMzhk' (the base 64 value)
On the headrers tab:
  Select/Check the 'content-Type' = 'application/json'
On the Body Tab:
  Select 'Raw' Radio Button
  Select JSON as type
  Add the XML (below examples etc)
  
<Send>

NOTE: Getting the settings correct will ensure auth works, and that body text can be red/passed in (getting it wrong usually results in null body text)

Below are example XML string for use
NOTE: for PAPI implanter details come from the login person, NOT the XML file. (so pin is not used, or implanter, or practice) BUT are required in XSD
NOTE: single method does 132 + 130 versions (self detects version)
-->

<!--  For SubmitRegistration_132 (132 schema) -->

<!--This is good XML (except there is no implanter) > this is used for public API testing (only) or add an implanter
also if a good XML is ran, the chip wille xist in DB, so a new chip may be needed for testing etc. -->

<MicrochipRegistration version="1.32">
  <Authorisation>true</Authorisation>
  <ReceiveEmail>false</ReceiveEmail>
  <ReceiveMail>false</ReceiveMail>
  <ThirdPartyDisclosure>false</ThirdPartyDisclosure>
  <MicrochipDetails>
    <ImplanterName>Vets4Pets Trescott Rd</ImplanterName>
    <ImplantDate>2020-11-26</ImplantDate>
    <MicrochipNumber>981000012234371</MicrochipNumber>
  </MicrochipDetails>
  <PetDetails>
    <Neutered>false</Neutered>
    <Colour>Red &amp; White</Colour>
    <Gender>F</Gender>
    <DateOfBirth>2020-09-22</DateOfBirth>
    <Breed>
      <FreeText>Cavapoo</FreeText>
    </Breed>
    <Species>Canine</Species>
    <Name>Lola</Name>
  </PetDetails>
  <BreederDetails>
    <Breeder>true</Breeder>
  </BreederDetails>
  <OwnerDetails>
    <EmailAddress>kcullum38@yahoo.com</EmailAddress>
    <MobilePhone>
      <Number>07403123805</Number>
    </MobilePhone>
    <EveningPhone>
      <Number>01527450340</Number>
    </EveningPhone>
    <Address>
      <Line1>31 Church Down Close</Line1>
      <LineOther>Crabbs Cross Redditch</LineOther>
      <County_State>Worcestershire</County_State>
      <PostalCode>B97 5ND</PostalCode>
      <Country>United Kingdom</Country>
    </Address>
    <Surname>Cullum</Surname>
    <Forenames>Karen</Forenames>
    <Initials>K</Initials>
    <Salutation>Mrs</Salutation>
  </OwnerDetails>
  <Identification>
    <Source>ANIBASE</Source>
    <PracticeID>044Q378118284:70</PracticeID>
  </Identification>
</MicrochipRegistration>



<!-- good xml, chip is inactive so fails chip validation (130) -->
<MicrochipRegistration>
  <Identification>
    <PracticeID>02022</PracticeID>
    <Source>VetFone</Source>
    <PinNo>70732</PinNo>
  </Identification>
  <OwnerDetails>
    <Salutation>Mr</Salutation>
    <Initials />
    <Forenames>S</Forenames>
    <Surname>Webb</Surname>
    <Address>
      <Line1>Flat 22</Line1>
      <LineOther>29 Macaulay Road</LineOther>
      <LineOther>Clapham Old Town</LineOther>
      <County_State>London</County_State>
      <PostalCode>SW1 0AQ</PostalCode>
    </Address>
    <DaytimePhone>
      <Number>01234567890</Number>
    </DaytimePhone>
    <EveningPhone>
      <Number>01234567890</Number>
    </EveningPhone>
    <MobilePhone>
      <Number>07896224234</Number>
    </MobilePhone>
  </OwnerDetails>
  <PetDetails>
    <Name>Archie</Name>
    <Species>Feline</Species>
    <Breed>
      <FreeText>Domestic Short Hair</FreeText>
    </Breed>
    <Gender>M</Gender>
    <Colour>Black and tan</Colour>
    <NotableConditions />
  </PetDetails>
  <MicrochipDetails>
    <MicrochipNumber>100237000250547</MicrochipNumber>
    <ImplanterName>Joe Smith</ImplanterName>
  </MicrochipDetails>
  <ThirdPartyDisclosure>true</ThirdPartyDisclosure>
  <ReceiveMail>false</ReceiveMail>
  <ReceiveEmail>false</ReceiveEmail>
  <Authorisation>true</Authorisation>
</MicrochipRegistration>



<!-- Def 132 -->

<MicrochipRegistration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.32">
  <ThirdPartyDisclosure>false</ThirdPartyDisclosure>
  <ReceiveMail>true</ReceiveMail>
  <ReceiveEmail>false</ReceiveEmail>
  <Authorisation>true</Authorisation>
  <Identification>
    <PracticeID>81ee720f-d92f-4f18-8a00-79e267905ea2	</PracticeID>
    <PinNo>71670</PinNo>
    <Source>ROBOVET</Source>
  </Identification>
  <OwnerDetails>
    <Salutation>Miss</Salutation>
    <Forenames>Chelsea</Forenames>
    <Surname>Clements</Surname>
    <Address>
      <Line1>15 Wadards Meadow</Line1>
      <County_State>Witney</County_State>
      <PostalCode>OX28 3YL</PostalCode>
    </Address>
    <MobilePhone>
      <Number>07930255764</Number>
    </MobilePhone>
  </OwnerDetails>
  <PetDetails>
    <Name>Jett</Name>
    <Species>Canine</Species>
    <DateOfBirth>2018-02-07</DateOfBirth>
    <Gender>M</Gender>
    <Colour>Brown </Colour>
    <Neutered>false</Neutered>
    <Breed>
      <FreeText>Staffordshire Bull Terrie</FreeText>
    </Breed>
  </PetDetails>
  <MicrochipDetails>
    <MicrochipNumber>981000010062088</MicrochipNumber>
    <ImplantDate>2018-04-06</ImplantDate>
    <ImplanterName>Rachel Booth</ImplanterName>
  </MicrochipDetails>
</MicrochipRegistration>

<!-- Def 132 -->
<MicrochipRegistration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.32">
  <ThirdPartyDisclosure>false</ThirdPartyDisclosure>
  <ReceiveMail>true</ReceiveMail>
  <ReceiveEmail>false</ReceiveEmail>
  <Authorisation>true</Authorisation>
  <Identification>
    <PracticeID>81ee720f-d92f-4f18-8a00-79e267905ea2	</PracticeID>
    <PinNo>71670</PinNo>
    <Source>ROBOVET</Source>
  </Identification>
  <OwnerDetails>
    <Salutation>Miss</Salutation>
    <Forenames>Chelsea</Forenames>
    <Surname>Clements</Surname>
    <Address>
      <Line1>15 Wadards Meadow</Line1>
      <County_State>Witney</County_State>
      <PostalCode>OX28 3YL</PostalCode>
    </Address>
    <MobilePhone>
      <Number>07930255764</Number>
    </MobilePhone>
  </OwnerDetails>
  <PetDetails>
    <Name>Jett</Name>
    <Species>Canine</Species>
    <DateOfBirth>2018-02-07</DateOfBirth>
    <Gender>M</Gender>
    <Colour>Brown </Colour>
    <Neutered>false</Neutered>
    <Breed>
      <FreeText>Staffordshire Bull Terrie</FreeText>
    </Breed>
  </PetDetails>
  <MicrochipDetails>
    <MicrochipNumber>981000010062088</MicrochipNumber>
    <ImplantDate>2018-04-06</ImplantDate>
    <ImplanterName>Rachel Booth</ImplanterName>
  </MicrochipDetails>
</MicrochipRegistration>


<!-- From 132 logs -->

<MicrochipRegistration>
  <Identification>
    <PracticeID>02022</PracticeID>
    <Source>JUPITER</Source>
    <PinNo>70732</PinNo>
  </Identification>
  <OwnerDetails>
    <Salutation>Mr</Salutation>
    <Initials />
    <Forenames>K</Forenames>
    <Surname>Smith</Surname>
    <Address>
      <Line1>Pen-Y-Bryn</Line1>
      <LineOther>Somewhere</LineOther>
      <LineOther>Unknown</LineOther>
      <County_State>Gloucestershire</County_State>
      <PostalCode>GL6 7QD</PostalCode>
    </Address>
    <DaytimePhone>
      <Number>01234567890</Number>
    </DaytimePhone>
    <EveningPhone>
      <Number>01234567890</Number>
    </EveningPhone>
    <MobilePhone>
      <Number>07896224234</Number>
    </MobilePhone>
    <EmergencyPhone>
      <Number>01234567890</Number>
    </EmergencyPhone>
    <EmailAddress>test@emailtest.com</EmailAddress>
  </OwnerDetails>
  <PetDetails>
    <Name>Archie</Name>
    <Species>Feline</Species>
    <Breed>
      <FreeText>Domestic Short Hair</FreeText>
    </Breed>
    <Gender>M</Gender>
    <Colour>Black and tan</Colour>
    <NotableConditions />
  </PetDetails>
  <MicrochipDetails>
    <MicrochipNumber>888000000000005</MicrochipNumber>
    <ImplanterName>Joe Smith</ImplanterName>
  </MicrochipDetails>
  <ThirdPartyDisclosure>true</ThirdPartyDisclosure>
  <ReceiveMail>false</ReceiveMail>
  <ReceiveEmail>false</ReceiveEmail>
  <Authorisation>true</Authorisation>
</MicrochipRegistration>





<MicrochipRegistration>
  <Identification>
    <PracticeID>02022</PracticeID>
    <Source>JUPITER</Source>
    <PinNo>70732</PinNo>
  </Identification>
  <OwnerDetails>
    <Salutation>Mr</Salutation>
    <Initials />
    <Forenames>K</Forenames>
    <Surname>Smith</Surname>
    <Address>
      <Line1>Pen-Y-Bryn</Line1>
      <LineOther>Somewhere</LineOther>
      <LineOther>Unknown</LineOther>
      <County_State>Gloucestershire</County_State>
      <PostalCode>GL6 7QD</PostalCode>
    </Address>
    <DaytimePhone>
      <Number>01234567890</Number>
    </DaytimePhone>
    <EveningPhone>
      <Number>01234567890</Number>
    </EveningPhone>
    <MobilePhone>
      <Number>07896224234</Number>
    </MobilePhone>
    <EmergencyPhone>
      <Number>01234567890</Number>
    </EmergencyPhone>
    <EmailAddress>test@emailtest.com</EmailAddress>
  </OwnerDetails>
  <PetDetails>
    <Name>Archie</Name>
    <Species>Feline</Species>
    <Breed>
      <FreeText>Domestic Short Hair</FreeText>
    </Breed>
    <Gender>M</Gender>
    <Colour>Black and tan</Colour>
    <NotableConditions />
  </PetDetails>
  <MicrochipDetails>
    <MicrochipNumber>888000000000005</MicrochipNumber>
    <ImplanterName>Joe Smith</ImplanterName>
  </MicrochipDetails>
  <ThirdPartyDisclosure>true</ThirdPartyDisclosure>
  <ReceiveMail>false</ReceiveMail>
  <ReceiveEmail>false</ReceiveEmail>
  <Authorisation>true</Authorisation>
</MicrochipRegistration>

<!--

JSON (for maybe json version)

{      "MicrochipRegistration": {        "Identification": {          "PracticeID": "00000000-0000-0000-0000-000000000000",          "PinNo": "P0000",          "Source": "VetFone",                },        "OwnerDetails": {          "Salutation": "Mr",          "Initials": "T",          "Forenames": "Test",          "Surname": "Ownkeeper",         "Address": {            "Line1": "19 House",            "LineOther": [],            "County_State": "Town",            "PostalCode": "MK7 8EN",            "Country": "UK"          },         "DaytimePhone": {            "Number": "01908 642120 ",            "Note": ""          },          "EveningPhone": {            "Number": "",            "Note": ""          },          "MobilePhone": {            "Number": "",            "Note": ""          },          "EmergencyPhone": {            "Number": "",            "Note": ""          },          "EmailAddress": "OKRegTest@email.co.uk"       },        "BreederDetails": {          "Breeder": false,          "BreederLicenceNumber": "",          "BreederLicenceIssuer": ""        },        "PetDetails": {          "Name": "FidoRegTest",         "Species": "Canine",          "Breed": {            "FreeText": "German Sheperd",            "Code": "14797"          },          "DateOfBirth": "2016-04-21 T00:00:00",          "Gender": 1,          "Colour":"Brown",          "Markings": "None",          "Neutered": false,          "NotableConditions": ""        },        "MicrochipDetails": {          "MicrochipNumber": "981098105002001",         "ImplantDate": "2016-05-06 T00:00:00",          "ImplanterName": "Imp Co"        },        "OtherIdentifiers": {          "KCRegistrationNumber": ""        },        "ThirdPartyDisclosure": false,       "ReceiveMail": false,        "ReceiveEmail": false,        "Authorisation": false,        "version": ""       }    }



-->