{"id":23066838,"url":"https://github.com/dvsa/mot-cpms-forms","last_synced_at":"2025-08-15T11:33:30.472Z","repository":{"id":176745593,"uuid":"649302879","full_name":"dvsa/mot-cpms-forms","owner":"dvsa","description":"Laminas module to provide re-usable HTML Forms that can be used by scheme to process payments.","archived":false,"fork":false,"pushed_at":"2024-10-29T15:41:55.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-12-08T02:22:10.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-04T12:41:32.000Z","updated_at":"2024-07-29T09:07:48.000Z","dependencies_parsed_at":"2024-07-08T14:13:48.841Z","dependency_job_id":"7dfe5cc7-5fd6-4469-b425-906620aae799","html_url":"https://github.com/dvsa/mot-cpms-forms","commit_stats":null,"previous_names":["dvsa/mot-cpms-forms"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fmot-cpms-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fmot-cpms-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fmot-cpms-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fmot-cpms-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvsa","download_url":"https://codeload.github.com/dvsa/mot-cpms-forms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229910957,"owners_count":18143229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-16T05:15:06.867Z","updated_at":"2024-12-16T05:15:07.437Z","avatar_url":"https://github.com/dvsa.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPMS Forms\n\n## Introduction\n\nA module to provide re-usable HTML Forms that can be used by scheme to process payments.\n\n## Installation\n\n### Main Setup\n\n#### With composer\n\nThe recommended way to install is through [Composer](https://getcomposer.org/).\n\n```\ncomposer require dvsa/mot-cpms-forms\n```\n\n#### Post installation\n\n1. Enable it in your application.config.php file.\n\n    ```php\n    \u003c?php\n    return array(\n        'modules' =\u003e array(\n            // ...\n            'CpmsForms',\n        ),\n        // ...\n    );\n    ```\n2. Copy configuration file to your autoload config folder (optional)\n\n    ```bash\n    cp vendor/dvsa/mot-cpms-forms/config/cpms-forms.global.php.dist config/autoload/cpms-forms.global.php\n    ```\n\n## Usage\n\nFor payment form generation please use controller plugin:\n\n```php\n$form = $this-\u003egetCpmsPaymentForm($payment);\n```\nThe plugin takes one argument, which must be an object that implements one of the following interfaces:\n* CpmsForms\\Payment\\CardPaymentInterface\n* CpmsForms\\Payment\\StoredCardPaymentInterface\n* CpmsForms\\Payment\\DirectDebitPaymentInterface\n* CpmsForms\\Payment\\CashPaymentInterface\n* CpmsForms\\Payment\\ChequePaymentInterface\n* CpmsForms\\Payment\\ChipPinPaymentInterface\n* CpmsForms\\Payment\\PostalOrderPaymentInterface\n\nAs it might be obvious, payment interface determines required data, that needs to be provided by scheme and tells Form Factory Service to build specific for that interface form.\n\nEach payment type always requires common information (amount, user id, etc.), so it's convenient to use ``CpmsForms\\Payment\\BasePaymentTrait`` trait in your payment classes.\n\nThe cpms-forms plugin validates post data and redirects to cpms-forms controller for processing. In regard to redirection, the proper usage should be:\n\n```php\n$form = $this-\u003egetCpmsPaymentForm($payment);\nif ($form instanceof \\Laminas\\Http\\Response) {\n    return $form;\n}\n```\n\nThe form should be passed to ViewModel and be rendered via view cpms-forms helper plugin:\n```\n\u003c?php echo $this-\u003erenderCpmsForm($form); ?\u003e\n```\n\n## Configuration\n\n### View scripts\nIf custom view script is needed to render payment form, please add this in your configuration file:\n\n```\n\u003c?php\nreturn [\n    'cpms_forms' =\u003e [\n        'partials' =\u003e [\n            'form' =\u003e 'custom-path/custom-script.phtml',\n        ],\n    ],\n];\n```\nIt's also possible to provide view script for specific payment type:\n```\nreturn [\n    'cpms_forms' =\u003e [\n        'partials' =\u003e [\n            'form' =\u003e 'custom-path/custom-script.phtml',\n            'stored_card' =\u003e 'custom-path/stored-card-script.phtml',\n        ],\n    ],\n];\n```\n\n### Form customization\nCustom form class can be provided for specific payment type. This class must extends ``CpmsForms\\Form\\PaymentForm`` class to be considered as a valid.\nSee example:\n```\nreturn [\n    'cpms_forms' =\u003e [\n        'payment_types' =\u003e [\n            'direct_debit' =\u003e [\n                'form' =\u003e 'Scheme\\Form\\CustomDirectDebitPaymentForm'\n            ],\n        ],\n    ],\n];\n```\nForm elements can be also customized. The following example sets html class of ``mandate_collection_day`` element and adds e-mail field:\n```\nreturn [\n    'cpms_forms' =\u003e [\n        'payment_types' =\u003e [\n            'direct_debit' =\u003e [\n                'form_elements' =\u003e [\n                    'mandate_collection_day' =\u003e [\n                        'attributes' =\u003e [\n                            'class' =\u003e 'form-control olcs-form-element',\n                        ],\n                    ],\n                    [\n                        'name' =\u003e 'email',\n                        'attributes' =\u003e [\n                            'type'  =\u003e 'email',\n                            'class' =\u003e 'form-control',\n                        ],\n                        'options' =\u003e [\n                            'label' =\u003e 'Customer E-mail',\n                            'required' =\u003e true,\n                        ],\n                    ]\n                ],\n            ],\n        ],\n    ],\n];\n```\nFor more options, payment types and form elements please see ``config/module.config.php``\n\n## Contributing\n\nPlease refer to our [Contribution Guide](/CONTRIBUTING.md).\n\nTO DO\n------------\n* Check if client is authorized to use a payment type\n* Implement event manager for pre and post payment actions\n* Integrate CPMS Miscellaneous Payments Module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fmot-cpms-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvsa%2Fmot-cpms-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fmot-cpms-forms/lists"}