thiio / exigo-php-sdk
此包的最新版本(0.1.7)没有可用的许可信息。
这是一个用于消耗Exigo API的SDK的早期版本。
0.1.7
2023-08-22 16:51 UTC
Requires
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- fakerphp/faker: ^1.23
- monolog/monolog: ^3.4
- phpunit/phpunit: ^9.6
- vlucas/phpdotenv: ^5.5
README
PHP Exigo API SDK
PHP Exigo API SDK是由Thiio团队创建的PHP包。它旨在简化消耗Exigo API端点的过程。使用此SDK,您可以轻松地与Exigo的API进行交互,以管理业务数据的各个方面,包括客户、订单、产品等。该包提供了一个简单高效的API来处理API请求,旨在将Exigo的API无缝集成到您的PHP项目中。
安装
使用Composer安装Exigo API SDK
composer require thiio/exigo-php-sdk
要在终端或命令提示符中执行"tests"文件夹中所有测试,请使用以下命令
vendor/bin/phpunit tests/
vendor/bin/phpunit: 此命令运行位于项目"vendor/bin"目录中的PHPUnit命令行工具。它通过Composer作为开发依赖项安装。tests/: 此指定包含您的测试文件的目录路径。如果您的测试组织在其他地方,请替换它。在运行命令之前,请确保已安装PHPUnit及其依赖项,并且它们是最新的。
处理事务示例
在GitHub上,我通常会插入一个引用块。
注意:您可以在/tests文件夹中找到更多示例。
public function it_should_process_a_transaction(){ $customer = $this->buildCustomerBlueprint(); $customerTransaction = new Transaction(); $customerTransaction->setName("CreateCustomerRequest"); foreach($customer as $key => $value){ $customerTransaction->addParameter($key,$value); } $order = $this->buildOrderBlueprint(); $orderTransaction = new Transaction(); $orderTransaction->setName("CreateOrderRequest"); foreach($order as $key => $value){ $orderTransaction->addParameter($key,$value); } $charge = $this->buildChargeCreditCardTokenBlueprint(); $chargeTransaction = new Transaction(); $chargeTransaction->setName("ChargeCreditCardTokenRequest"); foreach($charge as $key => $value){ $chargeTransaction->addParameter($key,$value); } $processTransaction = new ProcessTransaction(); $processTransaction->addTransactions([$customerTransaction,$orderTransaction, $chargeTransaction]); $client = new ExigoApi($_ENV["TEST_USER"],$_ENV["TEST_PASSWORD"],$_ENV["TEST_COMPANY"]); $response = $client->processTransaction($processTransaction); $this->assertFalse($response->success); }