{"id":19615183,"url":"https://github.com/fruitware/victoriabankgateway","last_synced_at":"2025-04-28T02:31:21.508Z","repository":{"id":48268361,"uuid":"96245378","full_name":"Fruitware/VictoriaBankGateway","owner":"Fruitware","description":"Victoria bank e-Commerce Gateway merchant interface","archived":false,"fork":false,"pushed_at":"2023-12-15T14:51:31.000Z","size":426,"stargazers_count":10,"open_issues_count":2,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-18T04:17:15.117Z","etag":null,"topics":["bank-integration","bank-responses","commerce-transactions","composer-package","gateway-client","moldova","packagist","php","php-library"],"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/Fruitware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://www.paypal.me/fruitware"]}},"created_at":"2017-07-04T18:50:50.000Z","updated_at":"2024-08-10T10:19:29.000Z","dependencies_parsed_at":"2022-09-09T09:00:44.751Z","dependency_job_id":null,"html_url":"https://github.com/Fruitware/VictoriaBankGateway","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FVictoriaBankGateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FVictoriaBankGateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FVictoriaBankGateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fruitware%2FVictoriaBankGateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fruitware","download_url":"https://codeload.github.com/Fruitware/VictoriaBankGateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224092014,"owners_count":17254152,"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":["bank-integration","bank-responses","commerce-transactions","composer-package","gateway-client","moldova","packagist","php","php-library"],"created_at":"2024-11-11T10:55:41.479Z","updated_at":"2024-11-11T10:55:42.456Z","avatar_url":"https://github.com/Fruitware.png","language":"PHP","funding_links":["https://www.paypal.me/fruitware","https://paypal.me/fruitware?locale.x=en_US"],"categories":[],"sub_categories":[],"readme":"# Welcome to VictoriaBank Merchant e-Commerce Library 👋\n\n[![GitHub issues](https://img.shields.io/github/issues/Fruitware/VictoriaBankGateway)](https://github.com/Fruitware/VictoriaBankGateway/issues)\n[![Version](https://img.shields.io/packagist/v/fruitware/victoria-bank-gateway)](https://packagist.org/packages/fruitware/victoria-bank-gateway)\n![Packagist](https://img.shields.io/packagist/l/fruitware/victoria-bank-gateway)\n[![Donate](https://img.shields.io/badge/donate-PayPal-%2337a556)]( https://paypal.me/fruitware?locale.x=en_US)\n\n---\n\n\u003e Packagist package (library) to give any php-based website an access to the interface of VictoriaBank (Republic Of Moldova) that merchant systems use to process credit card based e- commerce transactions using the standard CGI/WWW forms posting method. This interface transparently supports various cardholder authentication protocols such as 3-D Secure and Secure Code as well as legacy unauthenticated SSL commerce transactions.\n\n#### 🏠 [Homepage](https://github.com/Fruitware/VictoriaBankGateway)\n\n## Install\n\n```sh\ncomposer require fruitware/victoria-bank-gateway\n```\n\n### Requirements\n\n* PHP \u003e= 5.5\n* OpenSSL \u003e=0.9.8 \n\n## Usage\n\n### Step 1. Environment configuration (not required)\n\nYou can use one of the composer packages\n```bash\ncomposer require vlucas/phpdotenv\n```\n\nor\n\n```bash\ncomposer require symfony/dotenv\n```\n\n.env file\n\n```dosini\n# Merchant ID assigned by bank\nVICTORIA_BANK_MERCHANT_ID=xxxxxxxxxxxxxxx\n\n# Merchant Terminal ID assigned by bank \nVICTORIA_BANK_MERCHANT_TERMINAL=xxxxxxxx\n\n# Merchant primary web site URL\nVICTORIA_BANK_MERCHANT_URL='http://example.com'\n\n# Merchant name (recognizable by cardholder)\nVICTORIA_BANK_MERCHANT_NAME='Merchant company name'\n\n# Merchant company registered office address\nVICTORIA_BANK_MERCHANT_ADDRESS='Merchant address'\n\n# Security options - provided by the bank\nVICTORIA_BANK_SECURITY_SIGNATURE_FIRST='0001'\nVICTORIA_BANK_SECURITY_SIGNATURE_PREFIX='A00B00C00D00EA864886F70D020505000410'\nVICTORIA_BANK_SECURITY_SIGNATURE_PADDING='00'\n\n# Merchant public rsa key\nVICTORIA_BANK_MERCHANT_PUBLIC_KEY=public.pem\n\n# Merchant private rsa key\nVICTORIA_BANK_MERCHANT_PRIVATE_KEY=private.pem\n\n# The public part of the bank key that P_SIGN is encrypted in the response in PEM format.\nVICTORIA_BANK_MERCHANT_BANK_PUBLIC_KEY=victoria_pub.pem\n\n# Default Merchant shop timezone\n# Used to calculate the timezone offset sent to VictoriaBank\nVICTORIA_BANK_MERCHANT_TIMEZONE_NAME='Europe/Chisinau'\n\n# Merchant shop 2-character country code. \n# Must be provided if merchant system is located \n# in a country other than the gateway server's country. \nVICTORIA_BANK_MERCHANT_COUNTRY_CODE=MD\n\n# Default currency for all operations: 3-character currency code \nVICTORIA_BANK_MERCHANT_DEFAULT_CURRENCY=MDL\n\n# Default forms language\n# By default are available forms in en, ro, ru. \n# If need forms in another languages please contact gateway\n# administrator\nVICTORIA_BANK_MERCHANT_DEFAULT_LANGUAGE=ro\n```\n\n### Step 2. Init Gateway client\n\n#### Init Gateway client through configureFromEnv method\n\n```php\n\u003c?php\n\nuse Fruitware\\VictoriaBankGateway\\VictoriaBankGateway;\n\n$victoriaBankGateway = new VictoriaBankGateway();\n\n$certDir = '/path/to/cert/dir';\n$victoriaBankGateway\n    -\u003econfigureFromEnv($certDir)\n;\n```\n\n#### Init Gateway client manually\n\nYou can reproduce implementation of the configureFromEnv() method\n\n\n### Step 3. Request payment authorization - redirects to the banks page\n\n```php\n\u003c?php\n\nuse Fruitware\\VictoriaBankGateway\\VictoriaBankGateway;\n$backRefUrl = getenv('VICTORIA_BANK_MERCHANT_URL').'/after-payment/';\n\n/** @var VictoriaBankGateway $victoriaBankGateway */\n$victoriaBankGateway\n    -\u003erequestAuthorization($orderId = 1, $amount = 1, $backRefUrl, $currency = null, $description = null, $clientEmail = null, $language = null)\n;\n```\n\n### Step 4. Receive bank responses - all bank responses are asynchronous server to server and are handled by same URI\n\n```php\n\u003c?php\n\nuse Fruitware\\VictoriaBankGateway\\VictoriaBankGateway;\nuse Fruitware\\VictoriaBankGateway\\VictoriaBank\\Exception;\nuse Fruitware\\VictoriaBankGateway\\VictoriaBank\\Response;\nuse Fruitware\\VictoriaBankGateway\\VictoriaBank\\AuthorizationResponse;\n\n/** @var VictoriaBankGateway $victoriaBankGateway */\n$bankResponse = $victoriaBankGateway-\u003egetResponseObject($_POST);\n\nif (!$bankResponse-\u003eisValid()) {\n    throw new Exception('Invalid bank Auth response');\n}\n\nswitch ($bankResponse::TRX_TYPE) {\n    case VictoriaBankGateway::TRX_TYPE_AUTHORIZATION:\n        $amount         = $bankResponse-\u003e{Response::AMOUNT};\n        $bankOrderCode  = $bankResponse-\u003e{Response::ORDER};\n        $rrn            = $bankResponse-\u003e{Response::RRN};\n        $intRef         = $bankResponse-\u003e{Response::INT_REF};\n\n        #\n        # You must save $rrn and $intRef from the response here for reversal requests\n        #\n\n        # Funds locked on bank side - transfer the product/service to the customer and request completion\n        $victoriaBankGateway-\u003erequestCompletion($bankOrderCode, $amount, $rrn, $intRef, $currency = null);\n        break;\n\n    case VictoriaBankGateway::TRX_TYPE_COMPLETION:\n        # Funds successfully transferred on bank side\n        break;\n\n    case VictoriaBankGateway::TRX_TYPE_REVERSAL:\n        # Reversal successfully applied on bank size\n        break;\n\n    default:\n        throw new Exception('Unknown bank response transaction type');\n}\n```\n\n### Step 5. Request reversal (refund)\n\n```$rrn``` and ```$intRef``` must be saved on the step 4\n\n```php\n\u003c?php\n\nuse Fruitware\\VictoriaBankGateway\\VictoriaBankGateway;\n\n/** @var VictoriaBankGateway $victoriaBankGateway */\n$victoriaBankGateway\n    -\u003erequestReversal($orderId = 1, $amount = 1, $rrn = 'xxx', $intRef = 'yyy', $currency = null)\n;\n```\n\n## Author\n\n👤 Lovely handcrafted by **Fruitware team**\n\n* Twitter: [@fruitware](https://twitter.com/fruitware)\n* Github: [@fruitware](https://github.com/fruitware)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003eFeel free to check [issues page](https://github.com/Fruitware/VictoriaBankGateway/issues).\n\n## Show your support \n\nGive a ⭐ if this project helped you!\n\n[![Donate](https://img.shields.io/badge/donate-PayPal-%2337a556)]( https://paypal.me/fruitware?locale.x=en_US)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffruitware%2Fvictoriabankgateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffruitware%2Fvictoriabankgateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffruitware%2Fvictoriabankgateway/lists"}