wirecard / extension-credentials-module
用于商店扩展中读取/加载默认凭证的模块
该软件包的规范存储库似乎已消失,因此该软件包已被冻结。
v1.0.0
2020-03-13 09:14 UTC
Requires
- php: >=5.6
- ext-dom: *
Requires (Dev)
- phpmd/phpmd: @stable
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2022-12-19 21:00:23 UTC
README
用于商店扩展中读取/加载默认凭证的模块
如何设置
使用Composer安装软件包
composer require wirecard/extentions-credentials-module
目录结构
example/ example of usage
src/ source path
Config/ credential configs
Exception/ custom exceptions
Reader/ reader [XMLReader]
tests/ unit tests
src/Credentials.php
Credentials.php
文件是项目的门面和入口点。
$xmlFilePath = "credentials.xml";
$credentials = Credentials\Credentials($xmlFilePath);
当初始化 Credentials
门面时,需要通过构造函数传入凭证.xml 的路径。这将生成一个按支付方式分组的配置对象列表。 Credentials
门面提供两种方法
- getConfigByPaymentMethod(PaymentMethod $paymentMethod)
- 通过支付方式获取凭证配置。应使用
PaymentMethod
值对象作为参数。
- 通过支付方式获取凭证配置。应使用
- getConfig()
- 返回格式为的凭证配置列表
[payment method] => CredentialsConfigInterface | CredentialsCreditCardConfig
读取器
Reader
文件夹包含 XMLReader
,它能够读取XML格式。 validate()
方法是 ReaderInterface
的一部分,通过 schema.xsd
检查XML文件。将来,它应该能够实现 ReaderInterface
并调整 Credentials
门面的构造函数以读取其他格式,如JSON / YAML 等。
异常
Exception
文件夹包含项目中使用的所有定义的异常。
配置
Config
文件夹包含配置类(基于 CredentialsConfigInterface
|CredentialsCreditCardConfig
接口)。它将从读取器接收的数据生成,或直接从数据数组生成。
- DefaultConfig
- getBaseUrl()
- getMerchantAccountId()
- getSecret()
- getHttpUser()
- getHttpPassword()
- CreditCardConfig
- getWppUrl()
- getThreeDMerchantAccountId()
- getThreeDSecret()
如果需要以数组格式提供数据,可以使用 toArray
方法。