A
A
Alexander2020-08-21 13:15:49
1C-Bitrix
Alexander, 2020-08-21 13:15:49

How to make your own processor for the payment system in 1C-Bitrix based on the existing one?

I am finalizing the website of the online store, on CMS 1C-Bitrix, Small Business edition. Based on the payment system "Sberbank Receipt", I want my own payment system handler, it is not clear in the Bitrix documentation how to correctly place the custom payment system handler.

link to documentation

link to additional article

According to the instructions, I placed my payment system in the local/php_interface/include/sale_payment/ folder.
Now I have done the following:

  • I copied the contents of the bitrix/modules/sale/ru/payment/sberbank folder (the Sberbank Receipt payment system is located here) to the local/php_interface/include/sale_payment/test directory
  • changed the .description.php file a bit

My custom payment system appeared in the list.

But it is not clear where to place the handler.php file - the file in which my custom class handler for the payment system will be, which I will inherit from PaySystem\BaseServiceHandler?

Tell me how to place the handler.php file in the local/php_interface/include/sale_payment/ directory

Now after placing an order, when choosing a custom payment system, I get an error:

[Bitrix\Main\SystemException]
The key "SELLER_PARAMS" was not found in the GLOBALS[SALE_CORRESPONDENCE] array and the default value is not defined. Order ID: "144", payment system ID: "16" (CAllSalePaySystemAction::GetParamValue) (1)
C:\OpenServer\domains\ovsinka\bitrix\modules\sale\general\pay_system_action.php:127
#0: CAllSalePaySystemAction: :GetParamValue(string)
C:\OpenServer\domains\ovsinka\local\php_interface\include\sale_payment\test\payment.php:19
#1: require(string)
C:\OpenServer\domains\ovsinka\bitrix\modules\sale \lib\paysystem\compatibilityhandler.php:209
#2: Bitrix\Sale\PaySystem\CompatibilityHandler->includeFile(string)
C:\OpenServer\domains\ovsinka\bitrix\modules\sale\lib\paysystem\compatibilityhandler.php:65
#3: Bitrix\Sale\PaySystem\CompatibilityHandler->initiatePay(object, NULL)
C:\OpenServer\domains\ovsinka \bitrix\modules\sale\lib\paysystem\service.php:75
#4: Bitrix\Sale\PaySystem\Service->initiatePay(object, NULL, integer)
C:\OpenServer\domains\ovsinka\local\components\alex \sale.order.ajax\class.php:6129
#5: SaleOrderAjax->showOrderAction()
C:\OpenServer\domains\ovsinka\local\components\alex\sale.order.ajax\class.php:6019
#6: SaleOrderAjax->doAction(string)
C:\OpenServer\domains\ovsinka\local\components\alex\sale.order.ajax\class.php:6282
#7: SaleOrderAjax->executeComponent()
C:\OpenServer\domains\ovsinka\bitrix\modules\main\classes\general\component.php:649
#8: CBitrixComponent->includeComponent(string, array, NULL)
C:\OpenServer\domains\ovsinka\bitrix\modules \main\classes\general\main.php:1039
#9: CAllMain->IncludeComponent(string, string, array)
C:\OpenServer\domains\ovsinka\personal\order\make\index.php:125

As I assume this is due to the fact that there is no handler.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex_Nzr, 2021-08-09
@Alex_Nzr

handler.php should be in the same folder.
As far as I understand, the payment.php file is not required at all, since its role is to pre-check the data and launch the initiatePay method from handler.php
If there is no payment.php file in the custom handler, then initiatePay is called immediately, without any errors. Validation of input data can be done in the same place.
That is, you can copy any handler from "/bitrix/modules/sale/handlers/paysystem/", move it to "/local/php_interface/include/sale_payment/" and customize (in this case it will replace the system one). Or you can use it as a template and create your own based on it.

K
Konstantin Govorukhin, 2022-01-23
@kostik2003

Alexander, did you manage to modify the handler? Where can you see the result?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question