/** * @param $fromAccountId * @param null $fromAccountPaymentPassword * @param $toAccountId * @param $amount * @param null $clientTransaction * @param null $attributes * @param null $description * @return array|bool|mixed|null|object */ public function sdkMonetaVerifyPayment($fromAccountId, $fromAccountPaymentPassword = null, $toAccountId, $amount, $clientTransaction = null, $attributes = null, $description = null) { $result = false; try { if ($amount <= 0) { throw new MonetaSdkException(self::EXCEPTION_INCORRECT_AMOUNT . 'sdkMonetaVerifyPayment'); } $amount = number_format($amount, 2, '.', ''); if (!$fromAccountPaymentPassword && $fromAccountPaymentPassword !== false) { $secret = $this->sdkGetSecretFromAccountProfile(); $fromAccountPaymentPassword = MonetaSdkUtils::decrypt($this->getSettingValue('monetasdk_account_pay_password_enrypted'), $secret); } $amount = number_format($amount, 2, '.', ''); $monetaTransaction = new \Moneta\Types\VerifyPaymentRequest(); $monetaTransaction->payer = $fromAccountId; if ($fromAccountPaymentPassword) { $monetaTransaction->paymentPassword = $fromAccountPaymentPassword; } $monetaTransaction->payee = $toAccountId; $monetaTransaction->amount = $amount; $monetaTransaction->description = $description; $monetaTransaction->isPayerAmount = true; if (is_array($attributes) && count($attributes)) { $operationInfo = new \Moneta\Types\OperationInfo(); foreach ($attributes as $key => $value) { $operationInfo->addAttribute($this->pvtMonetaCreateAttribute($key, $value)); } $operationInfo->addAttribute($this->pvtMonetaCreateAttribute('customurlparameters', http_build_query($attributes))); $monetaTransaction->operationInfo = $operationInfo; } if ($clientTransaction) { $monetaTransaction->clientTransaction = $clientTransaction; } $transferResult = $this->monetaService->VerifyPayment($monetaTransaction); $result = json_decode(json_encode($transferResult, true)); $this->detectJsonException($transferResult); } catch (\Exception $e) { $this->parseSoapException($e); } return $result; }
/** * @param $payPassword * @return MonetaSdkResult * @throws MonetaSdkException */ public function processDecryptPayPassword($payPassword) { $this->calledMethods[] = __FUNCTION__; $this->cleanResultData(); $this->checkMonetaServiceConnection(); $secureCode = null; $secret = $this->sdkGetSecretFromAccountProfile(); if ($secret) { $secureCode = MonetaSdkUtils::decrypt(base64_decode($payPassword), $secret); } $this->data = array('result' => $secureCode); return $this->getEmptyResult($this->data); }