Overview
  • Package
  • Class

Packages

  • Klarna
    • Checkout
  • Payment
    • Klarna
      • HTTP
      • Interfaces
      • Unit
        • Tests

Classes

  • Klarna_Checkout_BasicConnector
  • Klarna_Checkout_Connector
  • Klarna_Checkout_Digest
  • Klarna_Checkout_Order
  • Klarna_Checkout_RecurringOrder
  • Klarna_Checkout_RecurringStatus
  • Klarna_Checkout_Resource
  • Klarna_Checkout_UserAgent

Interfaces

  • Klarna_Checkout_ApiErrorException
  • Klarna_Checkout_ConnectionErrorException
  • Klarna_Checkout_ConnectorException
  • Klarna_Checkout_ConnectorInterface
  • Klarna_Checkout_Exception
  • Klarna_Checkout_ResourceCreateableInterface
  • Klarna_Checkout_ResourceFetchableInterface
  • Klarna_Checkout_ResourceInterface
  • Klarna_Checkout_ResourceUpdateableInterface

Class Klarna_Checkout_BasicConnector

Basic implementation of the connector interface

Klarna_Checkout_BasicConnector implements Klarna_Checkout_ConnectorInterface
Package: Klarna\Checkout
Category: Payment
Copyright: 2015 Klarna AB
License: Apache license v2.0
Author: Rickard D. rickard.dybeck@klarna.com
Author: Christer G. christer.gustavsson@klarna.com
Author: David K. david.keijser@klarna.com
Link: http://developers.klarna.com/
Located at Klarna/Checkout/BasicConnector.php

Methods summary

public
# __construct( Klarna_Checkout_HTTP_TransportInterface $http, Klarna_Checkout_Digest $digester, string $secret, string $domain = Klarna_Checkout_Connector::BASE_URL )

Create a new Checkout Connector

Create a new Checkout Connector

Parameters

$http
Transport
$digester
Digest Generator
$secret
Shared secret
$domain
Domain of the request
protected Klarna_Checkout_UserAgent
# userAgent( )

Create the user agent identifier to use

Create the user agent identifier to use

Returns

Klarna_Checkout_UserAgent
public mixed
# apply( string $method, Klarna_Checkout_ResourceInterface $resource, array $options = null )

Applying the method on the specific resource

Applying the method on the specific resource

Parameters

$method
Http methods
$resource
resource
$options
Options

Returns

mixed

Implementation of

Klarna_Checkout_ConnectorInterface::apply()
public Klarna_Checkout_HTTP_TransportInterface
# getTransport( )

Gets the underlying transport object

Gets the underlying transport object

Returns

Klarna_Checkout_HTTP_TransportInterface
Transport object

Implementation of

Klarna_Checkout_ConnectorInterface::getTransport()
protected Klarna_Checkout_HTTP_Request
# createRequest( Klarna_Checkout_ResourceInterface $resource, string $method, string $payload, string $url )

Set content (headers, payload) on a request

Set content (headers, payload) on a request

Parameters

$resource
Klarna Checkout Resource
$method
HTTP Method
$payload

Payload to send with the request

$url
URL for request

Returns

Klarna_Checkout_HTTP_Request
public string
# getDomain( )

Get the current domain

Get the current domain

Returns

string

Implementation of

Klarna_Checkout_ConnectorInterface::getDomain()
protected string
# getUrl( Klarna_Checkout_ResourceInterface $resource, array $options )

Get the url to use

Get the url to use

Parameters

$resource
resource
$options
Options

Returns

string
Url to use for HTTP requests
protected array
# getData( Klarna_Checkout_ResourceInterface $resource, array $options )

Get the data to use

Get the data to use

Parameters

$resource
resource
$options
Options

Returns

array
data to use for HTTP requests
protected
# verifyResponse( Klarna_Checkout_HTTP_Response $result )

Throw an exception if the server responds with an error code.

Throw an exception if the server responds with an error code.

Parameters

$result
HTTP Response object

Throws

Klarna_Checkout_ApiErrorException
protected Klarna_Checkout_HTTP_Response
# handleResponse( Klarna_Checkout_HTTP_Response $result, Klarna_Checkout_ResourceInterface $resource, array $visited = array() )

Act upon the status of a response

Act upon the status of a response

Parameters

$result
response from server
$resource
associated resource
$visited
list of visited locations

Returns

Klarna_Checkout_HTTP_Response

Throws

Klarna_Checkout_ConnectorException
protected Klarna_Checkout_HTTP_Response
# handle( string $method, Klarna_Checkout_ResourceInterface $resource, array $options = null, array $visited = array() )

Perform a HTTP Call on the supplied resource using the wanted method.

Perform a HTTP Call on the supplied resource using the wanted method.

Parameters

$method
HTTP Method
$resource
Klarna Order
$options
Options
$visited
list of visited locations

Returns

Klarna_Checkout_HTTP_Response

Result object containing status code and payload

Throws

Klarna_Checkout_Exception
if 4xx or 5xx response code.

Magic methods summary

Properties summary

protected Klarna_Checkout_HTTP_TransportInterface $http

Klarna_Checkout_HTTP_TransportInterface Implementation

Klarna_Checkout_HTTP_TransportInterface Implementation

#
protected Klarna_Checkout_Digest $digester

Digester class

Digester class

#
protected string $domain

The domain for the request

The domain for the request

#
API documentation generated by ApiGen