BokaMera.API.Host

<back to all web services

DibsCallbackDto

The following routes are available for this service:
POST/licenses/dibscallback/Save Dibs CallbackThis 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;
    }
}

PHP DibsCallbackDto DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<DibsCallbackDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <RedirectUrl>String</RedirectUrl>
  <Status>Success</Status>
  <Token>String</Token>
  <acquirer>String</acquirer>
  <amount>String</amount>
  <approvalcode>String</approvalcode>
  <cardexpdate>String</cardexpdate>
  <cardnomask>String</cardnomask>
  <currency>String</currency>
  <paytype>String</paytype>
  <statuscode>String</statuscode>
  <transact>String</transact>
</DibsCallbackDto>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />