wirecard/extension-credentials-module

Module used in shop extentions to read/load default credentials

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.0 2020-03-13 09:14 UTC

This package is auto-updated.

Last update: 2022-12-19 21:00:23 UTC


README

Module used in shop extentions to read/load default credentials

How to setup

Using composer to install the package

composer require wirecard/extentions-credentials-module

Directory Structure

example/             example of usage
src/                 source path
  Config/            credential configs
  Exception/         custom exceptions
  Reader/            reader [XMLReader]
tests/               unit tests

src/Credentials.php

The Credentials.php file is the facade and entry point to project.

$xmlFilePath = "credentials.xml";
$credentials = Credentials\Credentials($xmlFilePath);

When the Credentials facade is initialized, the path to credentials.xml needs to be passed in constructor. It will result in a generated list of config objects with credentials per payment method. Credentials facade provides two methods:

  • getConfigByPaymentMethod(PaymentMethod $paymentMethod)
    • Gets credentials config by payment method. PaymentMethod ValueObject should be used as the parameter.
  • getConfig()
    • Returns list of credentials configs in format:
    [payment method] => CredentialsConfigInterface | CredentialsCreditCardConfig
    

Reader

The Reader folder contains the XMLReader which enables reading of XML format. validate() method is part of the ReaderInterface and checks the XML file via the schema.xsd. In the future it should be able to implement ReaderInterface and adapt constructor of Credentials facade to read other formats like JSON / YAML and etc.

Exception

The Exception folder contains all the defined exceptions used in the project.

Config

The Config folder contains config classes (based on CredentialsConfigInterface|CredentialsCreditCardConfig interfaces). It will be generated from the data received from a reader or just an array of data.

  • DefaultConfig
    • getBaseUrl()
    • getMerchantAccountId()
    • getSecret()
    • getHttpUser()
    • getHttpPassword()
  • CreditCardConfig
    • getWppUrl()
    • getThreeDMerchantAccountId()
    • getThreeDSecret()

Should data be required in array format, the toArray method can be used.