mralston / epvs
用于操作Certi-fi EPVS验证中心API的库。
v1.0.3
2024-07-26 14:40 UTC
Requires
- php: >=7.4
- illuminate/database: ^8.0|^9.0|^10.0|^11.0
- illuminate/http: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- laravel/sanctum: ^4.0
README
介绍
用于操作Certi-fi EPVS API的库。
配置
您可以通过以下方式发布配置文件
php artisan vendor:publish --tag=epvs-config
将以下项添加到您的 .env 文件中
EPVS_TOKEN= #EPVS_ENDPOINT=
EPVS_TOKEN
在EPVS验证中心网站界面的以下位置设置:
账户设置 > 个人访问令牌 > API密钥 > 创建令牌
EPVS_ENDPOINT
如果Certi-fi提供了自定义API端点,可以取消注释并指定。然而,在大多数情况下,该软件包的默认值 https://validationhub.co.uk/api/v1
将足够。
使用方法
以下是库的基本功能工作方式
use Mralston\Epvs\Facades\Epvs; $validations = Epvs::getValidations(); // Illuminate\Support\Collection $validation = Epvs::showValidation(123); // Mralston\Epvs\Models\Validation $newValidation = Epvs::createValidation([ // Mralston\Epvs\Models\Validation 'product_type_id' => 234, 'customer_first_name' => 'Test Michael', 'customer_last_name' => 'Test Burnham', 'customer_phone' => '01234567890', 'customer_email' => 'michael.burnham@starfleet.com', 'installation_address_line_1' => 'USS Discovery', 'installation_address_line_2' => 'null', 'installation_address_line_3' => 'null', 'installation_area_town' => 'Space', 'installation_county' => 'Cosmos', 'installation_postcode' => 'SP4 0CE', 'payment_method_id' => 2, 'finance_lender_id' => 9, 'finance_reference' => '54321-0987', 'finance_term_length' => 36, 'finance_broker_id' => 8, 'insurance_provider_id' => 6, 'ibg_policy_number' => '1234', 'sales_person_name' => 'Gabriel Lorca', 'total_contract_value' => 15123, 'deposit_paid' => 650, 'date_contract_signed' => '2024-05-03', 'file_empty_warning' => 1, 'file_tokens' => [], ]);
Webhooks
可以在EPVS验证中心门户网站上配置Webhook,以便您接收实时更新,例如验证状态更改时。
以下Artisan命令生成每个Webhook的URL,准备好粘贴到EPVS验证中心
$ php artisan epvs:webhooks
在EPVS验证中心的个人资料页面上添加一个新的Webhook并复制粘贴提供的URL。
每当验证状态更改或发生其他Webhook支持的事件时,您的应用程序将触发一个WebhookRecieved
事件。在data
属性中包含有关事件的详细信息。在VALIDATION_STATUS_UPDATED事件的情况下,data属性将包含类似于以下数组的数组:
(
[validation_id] => 2
[status_id] => 1
[status_name] => Validated
)
以下状态由EPVS验证中心定义
安全漏洞
请直接通过电子邮件将安全漏洞发送给我:matt@mralston.co.uk。
许可证
PDF是开源软件,根据MIT许可证授权。