3namespace Sale\Handlers\PaySystem;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Main\Request;
8use Bitrix\Main\Type\DateTime;
9use Bitrix\Sale\Payment;
10use Bitrix\Sale\PaySystem;
11use Bitrix\Sale\PaySystem\ServiceResult;
12use Bitrix\Sale\PriceMaths;
14Loc::loadMessages(__FILE__);
23 return array(
'BX_HANDLER' =>
'WEBMONEY');
31 static protected function isMyResponseExtended(Request
$request, $paySystemId)
33 $id =
$request->get(
'BX_PAYSYSTEM_CODE');
34 return $id == $paySystemId;
46 'ENCODING' => $this->service->getField(
'ENCODING'),
47 'BX_PAYSYSTEM_CODE' => $this->service->getField(
'ID'),
48 'WEBMONEY_SUCCESS_URL' => $this->getSuccessUrl(
$payment),
49 'WEBMONEY_FAIL_URL' => $this->getFailUrl(
$payment),
65 $serviceResult =
new PaySystem\ServiceResult();
67 if ((
int)
$request->get(
'LMI_PREREQUEST') == 1)
71 $request->get(
'LMI_PAYEE_PURSE') != $this->getBusinessValue(
$payment,
'WEBMONEY_SHOP_ACCT')
74 $serviceResult->addError(
new Error(
'Incorrect sum or WEBMONEY_SHOP_ACCT'));
86 $psDescription .= Loc::getMessage(
'SALE_HPS_WEBMONEY_PAYEE_PURSE',
array(
'#PAYEE_PURSE#' =>
$request->get(
"LMI_PAYEE_PURSE"))).
"; ";
89 $psDescription .= Loc::getMessage(
'SALE_HPS_WEBMONEY_TRANS_DATE',
array(
'#TRANS_DATE#' =>
$request->get(
"LMI_SYS_TRANS_DATE"))).
"; ";
92 if (
$request->get(
"LMI_PAYER_PURSE") !==
null)
93 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_PAYER_PURSE',
array(
'#PAYER_PURSE#' =>
$request->get(
"LMI_PAYER_PURSE"))).
"; ";
95 if (
$request->get(
"LMI_PAYER_WM") !==
null)
96 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_PAYER_WM',
array(
'#PAYER_WM#' =>
$request->get(
"LMI_PAYER_WM"))).
"; ";
98 if (
$request->get(
"LMI_PAYMER_NUMBER") !==
null)
99 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_PAYMER_NUMBER',
array(
'#PAYMER_NUMBER#' =>
$request->get(
"LMI_PAYMER_NUMBER"))).
"; ";
101 if (
$request->get(
"LMI_PAYMER_EMAIL") !==
null)
102 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_PAYMER_EMAIL',
array(
'#PAYMER_EMAIL#' =>
$request->get(
"LMI_PAYMER_EMAIL"))).
"; ";
104 if (
$request->get(
"LMI_TELEPAT_PHONENUMBER") !==
null)
105 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_TELEPAT_PHONENUMBER',
array(
'#TELEPAT_PHONENUMBER#' =>
$request->get(
"LMI_TELEPAT_PHONENUMBER"))).
"; ";
107 if (
$request->get(
"LMI_TELEPAT_ORDERID") !==
null)
108 $psMessage .= Loc::getMessage(
'SALE_HPS_WEBMONEY_TELEPAT_ORDERID',
array(
'#TELEPAT_ORDERID#' =>
$request->get(
"LMI_TELEPAT_ORDERID")));
112 "PS_STATUS_CODE" =>
"-",
114 "PS_STATUS_MESSAGE" => $psMessage,
115 "PS_SUM" =>
$request->get(
'LMI_PAYMENT_AMOUNT'),
116 "PS_CURRENCY" =>
$payment->getField(
'CURRENCY'),
117 "PS_RESPONSE_DATE" =>
new DateTime()
123 && $this->getBusinessValue(
$payment,
'PS_CHANGE_STATUS_PAY') ==
"Y"
126 $serviceResult->setOperationType(PaySystem\ServiceResult::MONEY_COMING);
127 $serviceResult->setPsData($psFields);
131 $serviceResult->addError(
new Error(
'Incorrect payment sum or payment flag'));
136 $serviceResult->addError(
new Error(
'Incorrect payment hash'));
140 return $serviceResult;
147 public function getPaymentIdFromRequest(Request
$request)
149 return $request->get(
'LMI_PAYMENT_NO');
156 protected function isTestMode(Payment
$payment =
null)
168 self::ACTIVE_URL =>
'https://merchant.webmoney.ru/lmi/payment.asp'
181 $lmiPaymentAmount = round(
$request->get(
'LMI_PAYMENT_AMOUNT'), 2);
183 return $paymentShouldPay == $lmiPaymentAmount;
195 $string =
$request->get(
"LMI_PAYEE_PURSE").$request->get(
"LMI_PAYMENT_AMOUNT").$request->get(
"LMI_PAYMENT_NO").$request->get(
"LMI_MODE").$request->get(
"LMI_SYS_INVS_NO").$request->get(
"LMI_SYS_TRANS_NO").$request->get(
"LMI_SYS_TRANS_DATE").$this->getBusinessValue(
$payment,
'WEBMONEY_CNST_SECRET_KEY').$request->get(
"LMI_PAYER_PURSE").$request->get(
"LMI_PAYER_WM");
197 $hash = hash($algorithm, $string);
199 return mb_strtoupper(
$hash) == mb_strtoupper(
$request->get(
'LMI_HASH'));
207 return array(
'RUB',
'USD',
'EUR',
'UAH');
232 private function getSuccessUrl(Payment
$payment)
241 private function getFailUrl(Payment
$payment)
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
getUrl(Payment $payment=null, $action)
showTemplate(Payment $payment=null, $template='')
setExtraParams(array $values)
getBusinessValue(Payment $payment=null, $code)
static getIndicativeFields()
processRequest(Payment $payment, Request $request)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)