POST | /licenses/dibscallback/ | Save Dibs Callback | This service is used for the DIBS callback. |
---|
<?php namespace dtos;
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 DibStatus : string
{
case Success = 'Success';
case Cancelled = 'Cancelled';
}
class DibsCallbackDto implements JsonSerializable
{
public function __construct(
/** @description The company id to save the credit card to */
// @ApiMember(DataType="string", Description="The company id to save the credit card to", IsRequired=true)
/** @var string */
public string $CompanyId='',
/** @description The dibs card expiration date (yymm) */
// @ApiMember(DataType="string", Description="The dibs card expiration date (yymm)", IsRequired=true)
/** @var string */
public string $cardexpdate='',
/** @description The dibs transact id */
// @ApiMember(DataType="string", Description="The dibs transact id", IsRequired=true)
/** @var string */
public string $transact='',
/** @description The dibs card number (masked) */
// @ApiMember(DataType="string", Description="The dibs card number (masked)", IsRequired=true)
/** @var string */
public string $cardnomask='',
/** @description The dibs paytype */
// @ApiMember(DataType="string", Description="The dibs paytype", IsRequired=true)
/** @var string */
public string $paytype='',
/** @description The dibs currency */
// @ApiMember(DataType="string", Description="The dibs currency", IsRequired=true)
/** @var string */
public string $currency='',
/** @description The dibs acquirer */
// @ApiMember(DataType="string", Description="The dibs acquirer", IsRequired=true)
/** @var string */
public string $acquirer='',
/** @description The dibs approval code */
// @ApiMember(DataType="string", Description="The dibs approval code", IsRequired=true)
/** @var string */
public string $approvalcode='',
/** @description The dibs status code */
// @ApiMember(DataType="string", Description="The dibs status code", IsRequired=true)
/** @var string */
public string $statuscode='',
/** @description The dibs amount */
// @ApiMember(DataType="string", Description="The dibs amount", IsRequired=true)
/** @var string */
public string $amount='',
/** @description The redirect url to send user back to after added creditcard */
// @ApiMember(DataType="uri", Description="The redirect url to send user back to after added creditcard", IsRequired=true)
/** @var string */
public string $RedirectUrl='',
/** @description The unique token for this request */
// @ApiMember(DataType="string", Description="The unique token for this request", IsRequired=true)
/** @var string */
public string $Token='',
/** @description status of the callback url */
// @ApiMember(DataType="enum", Description="status of the callback url", IsRequired=true)
/** @var DibStatus|null */
public ?DibStatus $Status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['cardexpdate'])) $this->cardexpdate = $o['cardexpdate'];
if (isset($o['transact'])) $this->transact = $o['transact'];
if (isset($o['cardnomask'])) $this->cardnomask = $o['cardnomask'];
if (isset($o['paytype'])) $this->paytype = $o['paytype'];
if (isset($o['currency'])) $this->currency = $o['currency'];
if (isset($o['acquirer'])) $this->acquirer = $o['acquirer'];
if (isset($o['approvalcode'])) $this->approvalcode = $o['approvalcode'];
if (isset($o['statuscode'])) $this->statuscode = $o['statuscode'];
if (isset($o['amount'])) $this->amount = $o['amount'];
if (isset($o['RedirectUrl'])) $this->RedirectUrl = $o['RedirectUrl'];
if (isset($o['Token'])) $this->Token = $o['Token'];
if (isset($o['Status'])) $this->Status = JsonConverters::from('DibStatus', $o['Status']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->cardexpdate)) $o['cardexpdate'] = $this->cardexpdate;
if (isset($this->transact)) $o['transact'] = $this->transact;
if (isset($this->cardnomask)) $o['cardnomask'] = $this->cardnomask;
if (isset($this->paytype)) $o['paytype'] = $this->paytype;
if (isset($this->currency)) $o['currency'] = $this->currency;
if (isset($this->acquirer)) $o['acquirer'] = $this->acquirer;
if (isset($this->approvalcode)) $o['approvalcode'] = $this->approvalcode;
if (isset($this->statuscode)) $o['statuscode'] = $this->statuscode;
if (isset($this->amount)) $o['amount'] = $this->amount;
if (isset($this->RedirectUrl)) $o['RedirectUrl'] = $this->RedirectUrl;
if (isset($this->Token)) $o['Token'] = $this->Token;
if (isset($this->Status)) $o['Status'] = JsonConverters::to('DibStatus', $this->Status);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /licenses/dibscallback/ HTTP/1.1
Host: api.bokamera.se
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"cardexpdate":"String","transact":"String","cardnomask":"String","paytype":"String","currency":"String","acquirer":"String","approvalcode":"String","statuscode":"String","amount":"String","RedirectUrl":"String","Token":"String","Status":"Success"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {}