GET | /vipps/login/callback |
---|
<?php namespace ConsumerApi;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
enum VippsAddressType : string
{
case Home = 'Home';
case Work = 'Work';
case Other = 'Other';
}
class VippsAddress implements JsonSerializable
{
public function __construct(
/** @var VippsAddressType|null */
public ?VippsAddressType $addressType=null,
/** @var string */
public string $country='',
/** @var string */
public string $formatted='',
/** @var string */
public string $postalCode='',
/** @var string */
public string $region='',
/** @var string */
public string $streetAddress=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['addressType'])) $this->addressType = JsonConverters::from('VippsAddressType', $o['addressType']);
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['formatted'])) $this->formatted = $o['formatted'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['region'])) $this->region = $o['region'];
if (isset($o['streetAddress'])) $this->streetAddress = $o['streetAddress'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->addressType)) $o['addressType'] = JsonConverters::to('VippsAddressType', $this->addressType);
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->formatted)) $o['formatted'] = $this->formatted;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->region)) $o['region'] = $this->region;
if (isset($this->streetAddress)) $o['streetAddress'] = $this->streetAddress;
return empty($o) ? new class(){} : $o;
}
}
class VippsUserInfo implements JsonSerializable
{
public function __construct(
/** @var VippsAddress|null */
public ?VippsAddress $address=null,
/** @var DateTime */
public DateTime $birthdate=new DateTime(),
/** @var string|null */
public ?string $email=null,
/** @var bool|null */
public ?bool $emailVerified=null,
/** @var string */
public string $familyName='',
/** @var string */
public string $givenName='',
/** @var string */
public string $name='',
/** @var string */
public string $phoneNumber='',
/** @var string */
public string $sessionIdentifier='',
/** @var string */
public string $subjectIdentifier=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['address'])) $this->address = JsonConverters::from('VippsAddress', $o['address']);
if (isset($o['birthdate'])) $this->birthdate = JsonConverters::from('DateTime', $o['birthdate']);
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['emailVerified'])) $this->emailVerified = $o['emailVerified'];
if (isset($o['familyName'])) $this->familyName = $o['familyName'];
if (isset($o['givenName'])) $this->givenName = $o['givenName'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
if (isset($o['sessionIdentifier'])) $this->sessionIdentifier = $o['sessionIdentifier'];
if (isset($o['subjectIdentifier'])) $this->subjectIdentifier = $o['subjectIdentifier'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->address)) $o['address'] = JsonConverters::to('VippsAddress', $this->address);
if (isset($this->birthdate)) $o['birthdate'] = JsonConverters::to('DateTime', $this->birthdate);
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->emailVerified)) $o['emailVerified'] = $this->emailVerified;
if (isset($this->familyName)) $o['familyName'] = $this->familyName;
if (isset($this->givenName)) $o['givenName'] = $this->givenName;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
if (isset($this->sessionIdentifier)) $o['sessionIdentifier'] = $this->sessionIdentifier;
if (isset($this->subjectIdentifier)) $o['subjectIdentifier'] = $this->subjectIdentifier;
return empty($o) ? new class(){} : $o;
}
}
PHP VippsLoginCallbackRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /vipps/login/callback HTTP/1.1 Host: unstable-consumer-api.brovs.com Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { vippsUserInfo: { address: { addressType: Home, country: String, formatted: String, postalCode: String, region: String, streetAddress: String }, birthdate: 0001-01-01T00:00:00.0000000+00:00, email: String, emailVerified: False, familyName: String, givenName: String, name: String, phoneNumber: String, sessionIdentifier: String, subjectIdentifier: String }, nextRelativeUrl: String }