58 if ($this->initiateMode == self::STREAM)
60 $this->includeFile(
'payment.php');
62 else if ($this->initiateMode == self::STRING)
65 $content = $this->includeFile(
'payment.php');
67 $buffer = ob_get_contents();
71 $result->setTemplate($content);
75 if ($this->service->getField(
'ENCODING') !=
'')
77 define(
"BX_SALE_ENCODING", $this->service->getField(
'ENCODING'));
78 AddEventHandler(
'main',
'OnEndBufferContent', array($this,
'OnEndBufferContent'));
95 if ($this->initiateMode == self::STREAM)
97 $this->includeFile(
'payment.php');
99 else if ($this->initiateMode == self::STRING)
102 $content = $this->includeFile(
'payment.php');
104 $buffer = ob_get_contents();
108 $result->setTemplate($content);
112 if ($this->service->getField(
'ENCODING') !=
'')
114 define(
"BX_SALE_ENCODING", $this->service->getField(
'ENCODING'));
115 AddEventHandler(
'main',
'OnEndBufferContent', array($this,
'OnEndBufferContent'));
128 $orderFields = array();
129 $paymentFields = array();
130 $relatedData = array();
132 if ($payment !==
null)
135 $paymentCollection = $payment->getCollection();
137 $order = $paymentCollection->getOrder();
139 if ($order->getId() > 0)
141 $orderId = $order->getId();
142 $orderFields = $order->getFieldValues();
143 $paymentFields = $payment->getFieldValues();
152 $relatedData[
'TEMPLATE_PARAMS'] = array();
153 foreach ($data[
'CODES'] as $codeId => $code)
155 if (array_key_exists($codeId, $templateParams))
157 $code[
'VALUE'] = $templateParams[$codeId];
158 $relatedData[
'TEMPLATE_PARAMS'][$codeId] = $code;
162 if (isset($templateParams[
'ORDER']))
163 $orderFields = $templateParams[
'ORDER'];
165 if (isset($templateParams[
'BASKET_ITEMS']))
167 $relatedData[
'BASKET_ITEMS'] = $templateParams[
'BASKET_ITEMS'];
168 unset($templateParams[
'BASKET_ITEMS']);
171 if (isset($templateParams[
'TAX_LIST']))
173 $relatedData[
'TAX_LIST'] = $templateParams[
'TAX_LIST'];
174 unset($templateParams[
'TAX_LIST']);
177 $paymentFields[
'PAY_SYSTEM_ID'] = $this->service->getField(
'ID');
180 \CSalePaySystemAction::InitParamArrays($orderFields, $orderId,
'', $relatedData, $paymentFields);
182 return $GLOBALS[
'SALE_INPUT_PARAMS'];
193 $this->includeFile(
'result_rec.php');
201 private function includeFile($file)
203 global $APPLICATION, $USER, $DB;
206 $path = $documentRoot.$this->service->getField(
'ACTION_FILE').
'/'.$file;
207 if (
IO\File::isFileExists($path))
209 $result = require $path;
210 if ($result !==
false && $result !== 1)
234 public function getPrice(
Payment $payment)
238 $psData[
'PSA_ACTION_FILE'] = $psData[
'ACTION_FILE'];
239 $psData[
'PSA_TARIF'] = $psData[
'TARIF'];
245 $order = $collection->getOrder();
248 $shipmentCollection = $order->getShipmentCollection();
253 foreach ($shipmentCollection as $item)
255 if (!$item->isSystem())
263 $propertyCollection = $order->getPropertyCollection();
266 $deliveryLocation = $propertyCollection->getDeliveryLocation();
269 return \CSalePaySystemsHelper::getPSPrice($psData, $payment->
getSum(), $shipment->getPrice(), $deliveryLocation->getValue());
280 $actionFile = $this->service->getField(
'ACTION_FILE');
282 return IO\File::isFileExists($documentRoot.$actionFile.
'/tarif.php');
291 $actionFile = $this->service->getField(
'ACTION_FILE');
293 return IO\File::isFileExists($documentRoot.$actionFile.
'/result.php');
308 $order = $paymentCollection->getOrder();
310 \CSalePaySystemAction::InitParamArrays($order->getFieldValues(), $order->getId(),
'', array(), $payment->getFieldValues());
312 $res = $this->includeFile(
'result.php');
324 $handler = $this->service->getField(
'ACTION_FILE');
327 $arPSCorrespondence = array();
329 $actionFile = $documentRoot.$handler.
'/.description.php';
330 if (
IO\File::isFileExists($actionFile))
334 if ($arPSCorrespondence)
336 $codes = $this->convertCodesToNewFormat($arPSCorrespondence);
339 $data = array(
'NAME' => $psTitle,
'SORT' => 100,
'CODES' => $codes);
343 if (isset($data[
"CODES"]) && is_array($data[
"CODES"]))
355 private function convertCodesToNewFormat(array $arPSCorrespondence)
357 if ($arPSCorrespondence)
359 foreach ($arPSCorrespondence as $i => $property)
361 if ($property[
'TYPE'] ==
'SELECT')
364 foreach ($property[
'VALUE'] as $code => $value)
365 $options[$code] = $value[
'NAME'];
367 $arPSCorrespondence[$i] = array(
368 'NAME' => $property[
'NAME'],
371 'OPTIONS' => $options
373 'SORT' => $property[
'SORT'],
376 else if ($property[
'TYPE'] ==
'FILE')
378 $arPSCorrespondence[$i] = array(
379 'NAME' => $property[
'NAME'],
383 'SORT' => $property[
'SORT'],
386 else if ($property[
'TYPE'] ==
'CHECKBOX')
388 $arPSCorrespondence[$i] = array(
389 'NAME' => $property[
'NAME'],
393 'SORT' => $property[
'SORT'],
396 if (isset($property[
'VALUE']))
398 $arPSCorrespondence[$i][
'VALUE'] = $property[
'VALUE'];
402 if (array_key_exists(
'DESCR', $property))
403 $arPSCorrespondence[$i][
'DESCRIPTION'] = $property[
'DESCR'];
405 if (!isset($arPSCorrespondence[$i][
'GROUP']))
406 $arPSCorrespondence[$i][
'GROUP'] = (isset($property[
'GROUP'])) ? $property[
'GROUP'] :
'PS_OTHER';
409 return $arPSCorrespondence;
422 'ACCOUNT_NUMBER' =>
'A1',
425 'SHOULD_PAY' => 2000,
432 'IS_IN_PRICE' =>
'Y',
433 'VALUE_MONEY' => 200,
438 'BASKET_ITEMS' => array(
441 'IS_VAT_IN_PRICE' =>
true,
445 'MEASURE_NAME' =>
Loc::getMessage(
'SALE_COMPATIBILITY_BASKET_ITEM_MEASURE'),
451 'SELLER_ADDRESS' =>
Loc::getMessage(
'SALE_COMPATIBILITY_BANK_ADDRESS'),
452 'SELLER_PHONE' =>
'+76589321451',
453 'SELLER_BANK_IBAN' =>
'1989 000 92',
454 'SELLER_BANK_SWIFT' =>
'0000000000',
455 'SELLER_BANK_PHONE' =>
'+76589321451',
457 'SELLER_RS' =>
'0000 0000 0000 0000 0000',
458 'SELLER_BANK_ACCNO' =>
'0000 0000 0000 0000 0000',
459 'SELLER_INN' =>
'000011112222',
460 'SELLER_EU_INN' =>
'000011112222',
461 'SELLER_REG' =>
'1615 00 785',
462 'SELLER_KPP' =>
'123456789',
464 'SELLER_BIK' =>
'0123456',
465 'SELLER_BIC' =>
'0123456',
466 'SELLER_BANK_BLZ' =>
'0123456',
467 'SELLER_KS' =>
'1111 1111 1111 1111',
468 'SELLER_BANK_ROUTENO' =>
'1111 1111 1111 1111',
469 'BUYER_NAME' =>
Loc::getMessage(
'SALE_COMPATIBILITY_BUYER_COMPANY_NAME'),
470 'BUYER_INN' =>
'0123456789',
471 'BUYER_PHONE' =>
'79091234523',
472 'BUYER_FAX' =>
'88002000600',
473 'BUYER_ADDRESS' =>
Loc::getMessage(
'SALE_COMPATIBILITY_BUYER_COMPANY_ADDRESS'),
474 'BUYER_PAYER_NAME' =>
Loc::getMessage(
'SALE_COMPATIBILITY_BUYER_NAME_CONTACT'),
475 'SELLER_DIR_POS' =>
Loc::getMessage(
'SALE_COMPATIBILITY_DIRECTOR_POSITION'),
477 'SELLER_ACC_POS' =>
Loc::getMessage(
'SALE_COMPATIBILITY_ACCOUNTANT_POSITION'),
479 'SELLER_EMAIL' =>
'my@company.com',
484 if (Loader::includeModule(
'crm') && Loader::includeModule(
'iblock'))
487 'IBLOCK_ID' => intval(\CCrmCatalog::EnsureDefaultExists()),
488 'CHECK_PERMISSIONS' =>
'N',
489 '!PROPERTY_TYPE' =>
'G'
492 $dbRes = \CIBlockProperty::GetList(array(), $arFilter);
493 while ($arRow = $dbRes->Fetch())
494 $data[
'BASKET_ITEMS'][0][
'PROPERTY_'.$arRow[
'ID']] =
'test';
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)
$GLOBALS['____1444769544']