PHP code example of spyrosoft / magento2-google-ucp

1. Go to this page and download the library: Download spyrosoft/magento2-google-ucp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spyrosoft / magento2-google-ucp example snippets

xml
<!-- etc/di.xml -->
<type name="Spyrosoft\Ucp\Service\Payment\HandlerList">
    <arguments>
        <argument name="providers" xsi:type="array">
            <item name="your_payment_method" xsi:type="object">
                Vendor\Module\Service\Payment\Handler\YourHandler
            </item>
        </argument>
    </arguments>
</type>
xml
<!-- etc/di.xml -->
<type name="Spyrosoft\Ucp\Service\Builder\Checkout\CompositeBuilder">
    <arguments>
        <argument name="builders" xsi:type="array">
            <item name="custom_data" xsi:type="object">
                Vendor\Module\Service\Builder\Checkout\CustomData
            </item>
        </argument>
    </arguments>
</type>
xml
<!-- Checkout Validation -->
<type name="Spyrosoft\Ucp\Service\Validator\Checkout\CompositeValidator">
    <arguments>
        <argument name="validators" xsi:type="array">
            <item name="custom_rule" xsi:type="object">
                Vendor\Module\Service\Validator\Checkout\CustomRule
            </item>
        </argument>
    </arguments>
</type>

<!-- Request Validation -->
<type name="Spyrosoft\Ucp\Service\Validator\Request\CompositeValidator">
    <arguments>
        <argument name="validators" xsi:type="array">
            <item name="custom_request_rule" xsi:type="object">
                Vendor\Module\Service\Validator\Request\CustomRequestRule
            </item>
        </argument>
    </arguments>
</type>