コード例 #1
0
ファイル: callback.php プロジェクト: gitter-badger/Simpla
     $operationInfo->addAttribute($a);
     $a1 = new MonetaKeyValueAttribute();
     $a1->key = 'mailofrussiaregion';
     $a1->value = $_REQUEST['additionalParameters_mailofrussiaSenderRegion'];
     $operationInfo->addAttribute($a1);
     $a2 = new MonetaKeyValueAttribute();
     $a2->key = 'mailofrussiaaddress';
     $a2->value = $_REQUEST['additionalParameters_mailofrussiaSenderAddress'];
     $operationInfo->addAttribute($a2);
     $a3 = new MonetaKeyValueAttribute();
     $a3->key = 'mailofrussianame';
     $a3->value = $_REQUEST['additionalParameters_mailofrussiaSenderName'];
     $operationInfo->addAttribute($a3);
     $request->operationInfo = $operationInfo;
 } elseif ($_REQUEST['payment_system'] == 'euroset') {
     $operationInfo = new MonetaOperationInfo();
     $a1 = new MonetaKeyValueAttribute();
     $a1->key = 'rapidamphone';
     $a1->value = $_REQUEST['additionalParameters_rapidaPhone'];
     $operationInfo->addAttribute($a1);
     $request->operationInfo = $operationInfo;
 }
 $response = $service->Invoice($request);
 if ($_REQUEST['payment_system'] == 'euroset') {
     $response1 = $service->GetOperationDetailsById($response->transaction);
     foreach ($response1->operation->attribute as $attr) {
         if ($attr->key == 'rapidatid') {
             $transaction_id = $attr->value;
         }
     }
 } else {
コード例 #2
0
ファイル: payanyway.php プロジェクト: artlabsdesign/missbloom
 public function invoice()
 {
     $payment_method = $this->session->data['payment_method']['code'];
     $this->load->language("payment/{$payment_method}");
     $this->load->language('checkout/success');
     $this->load->model('checkout/order');
     //		if (isset($this->session->data['order_id'])) {
     //			$this->cart->clear();
     //
     //			unset($this->session->data['shipping_method']);
     //			unset($this->session->data['shipping_methods']);
     //			unset($this->session->data['payment_method']);
     //			unset($this->session->data['payment_methods']);
     //			unset($this->session->data['guest']);
     //			unset($this->session->data['comment']);
     //			unset($this->session->data['order_id']);
     //			unset($this->session->data['coupon']);
     //			unset($this->session->data['voucher']);
     //			unset($this->session->data['vouchers']);
     //		}
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('href' => $this->url->link('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     /*$this->data['breadcrumbs'][] = array(
           'href' => $this->url->link('checkout/cart'),
           'text' => $this->language->get('text_basket'),
           'separator' => $this->language->get('text_separator')
       );*/
     $this->data['breadcrumbs'][] = array('href' => $this->url->link('checkout/buy', '', 'SSL'), 'text' => $this->language->get('text_checkout'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_payment_invoice'), 'separator' => $this->language->get('text_separator'), 'href' => false);
     require_once DIR_SYSTEM . 'library/MonetaAPI/MonetaWebService.php';
     $login = $this->config->get('payanyway_username');
     $password = $this->config->get('payanyway_password');
     switch ($this->config->get('payanyway_mnt_server')) {
         case "demo.moneta.ru":
             $service = new MonetaWebService("https://demo.moneta.ru/services.wsdl", $login, $password);
             break;
         case "www.payanyway.ru":
             $service = new MonetaWebService("https://www.moneta.ru/services.wsdl", $login, $password);
             break;
     }
     try {
         $totalAmount = $_REQUEST['MNT_AMOUNT'] . " " . $_REQUEST['MNT_CURRENCY_CODE'];
         $fee = "-";
         if (isset($_REQUEST['paymentSystem_accountId'])) {
             $transactionRequestType = new MonetaForecastTransactionRequest();
             $transactionRequestType->payer = $_REQUEST['paymentSystem_accountId'];
             $transactionRequestType->payee = $_REQUEST['MNT_ID'];
             $transactionRequestType->amount = $_REQUEST['MNT_AMOUNT'];
             $transactionRequestType->clientTransaction = $_REQUEST['MNT_TRANSACTION_ID'];
             $forecast = $service->ForecastTransaction($transactionRequestType);
             $totalAmount = number_format($forecast->payerAmount, 2, '.', '') . " " . $forecast->payerCurrency;
             $fee = number_format($forecast->payerFee, 2, '.', '') . " " . $forecast->payerCurrency;
         }
         $request = new MonetaInvoiceRequest();
         if (isset($_REQUEST['paymentSystem_accountId'])) {
             $request->payer = $_REQUEST['paymentSystem_accountId'];
         }
         $request->payee = $_REQUEST['MNT_ID'];
         $request->amount = $_REQUEST['MNT_AMOUNT'];
         $request->clientTransaction = $_REQUEST['MNT_TRANSACTION_ID'];
         if ($payment_method == 'payanyway_post') {
             $operationInfo = new MonetaOperationInfo();
             $a = new MonetaKeyValueAttribute();
             $a->key = 'mailofrussiaindex';
             $a->value = $_REQUEST['additionalParameters_mailofrussiaSenderIndex'];
             $operationInfo->addAttribute($a);
             $a1 = new MonetaKeyValueAttribute();
             $a1->key = 'mailofrussiaregion';
             $a1->value = $_REQUEST['additionalParameters_mailofrussiaSenderRegion'];
             $operationInfo->addAttribute($a1);
             $a2 = new MonetaKeyValueAttribute();
             $a2->key = 'mailofrussiaaddress';
             $a2->value = $_REQUEST['additionalParameters_mailofrussiaSenderAddress'];
             $operationInfo->addAttribute($a2);
             $a3 = new MonetaKeyValueAttribute();
             $a3->key = 'mailofrussianame';
             $a3->value = $_REQUEST['additionalParameters_mailofrussiaSenderName'];
             $operationInfo->addAttribute($a3);
             $request->operationInfo = $operationInfo;
         } elseif ($payment_method == 'payanyway_euroset') {
             $operationInfo = new MonetaOperationInfo();
             $a1 = new MonetaKeyValueAttribute();
             $a1->key = 'rapidamphone';
             $a1->value = $_REQUEST['additionalParameters_rapidaPhone'];
             $operationInfo->addAttribute($a1);
             $request->operationInfo = $operationInfo;
         }
         $response = $service->Invoice($request);
         if ($payment_method == 'payanyway_euroset') {
             $response1 = $service->GetOperationDetailsById($response->transaction);
             foreach ($response1->operation->attribute as $attr) {
                 if ($attr->key == 'rapidatid') {
                     $transaction_id = $attr->value;
                 }
             }
         } else {
             $transaction_id = $response->transaction;
         }
         $this->document->setTitle($this->language->get('invoice_title_created'));
         $this->data['heading_title'] = $this->language->get('invoice_title_created');
         $this->data['text_message'] = $this->language->get('invoice_created');
         $this->data['invoice'] = array('status' => $response->status, 'system' => $payment_method, 'unitid' => $_REQUEST['paymentSystem_unitId'], 'payment_url' => $this->config->get('payanyway_mnt_server'), 'transaction' => str_pad($transaction_id, 10, "0", STR_PAD_LEFT), 'amount' => $_REQUEST['MNT_AMOUNT'] . " " . $_REQUEST['MNT_CURRENCY_CODE'], 'fee' => $fee, 'payerAmount' => $totalAmount);
         $status = $this->config->get('payanyway_order_status_id');
         $this->model_checkout_order->confirm($_REQUEST['MNT_TRANSACTION_ID'], $status, 'Order confirmed');
     } catch (Exception $e) {
         $this->document->setTitle($this->language->get('invoice_title_error'));
         $this->data['heading_title'] = $this->language->get('invoice_title_error');
         $this->data['invoice'] = array('status' => 'FAILED', 'error_message' => $e->getMessage());
     }
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['continue'] = $this->url->link('common/home');
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->template = 'default/template/payment/payanyway_invoice.tpl';
     $this->response->setOutput($this->render());
 }