getMerchantPageData($paymentMethod); $postData = $merchantPageData['params']; $gatewayUrl = $merchantPageData['url']; } else{ $data = $this->getRedirectionData($paymentMethod); $postData = $data['params']; $gatewayUrl = $data['url']; } $form = $this->getPaymentForm($gatewayUrl, $postData); echo json_encode(array('form' => $form, 'url' => $gatewayUrl, 'params' => $postData, 'paymentMethod' => $paymentMethod)); exit; } public function getRedirectionData($paymentMethod) { $merchantReference = $this->generateMerchantReference(); if ($this->sandboxMode) { $gatewayUrl = $this->gatewaySandboxHost . 'FortAPI/paymentPage'; } else { $gatewayUrl = $this->gatewayHost . 'FortAPI/paymentPage'; } if ($paymentMethod == 'sadad') { $this->currency = 'SAR'; } $postData = array( 'amount' => $this->convertFortAmount($this->amount, $this->currency), 'currency' => strtoupper($this->currency), 'merchant_identifier' => $this->merchantIdentifier, 'access_code' => $this->accessCode, 'merchant_reference' => $merchantReference, 'customer_email' => 'test@payfort.com', //'customer_name' => trim($order_info['b_firstname'].' '.$order_info['b_lastname']), 'command' => $this->command, 'language' => $this->language, 'return_url' => $this->getUrl('route.php?r=processResponse'), ); if ($paymentMethod == 'sadad') { $postData['payment_option'] = 'SADAD'; } elseif ($paymentMethod == 'naps') { $postData['payment_option'] = 'NAPS'; $postData['order_description'] = $this->itemName; } elseif ($paymentMethod == 'installments') { $postData['installments'] = 'STANDALONE'; $postData['command'] = 'PURCHASE'; } $postData['signature'] = $this->calculateSignature($postData, 'request'); $debugMsg = "Fort Redirect Request Parameters \n".print_r($postData, 1); $this->log($debugMsg); return array('url' => $gatewayUrl, 'params' => $postData); } public function getMerchantPageData($paymentMethod) { $merchantReference = $this->generateMerchantReference(); $returnUrl = $this->getUrl('route.php?r=merchantPageReturn'); if(isset($_GET['3ds']) && $_GET['3ds'] == 'no') { $returnUrl = $this->getUrl('route.php?r=merchantPageReturn&3ds=no'); } $iframeParams = array( 'merchant_identifier' => $this->merchantIdentifier, 'access_code' => $this->accessCode, 'merchant_reference' => $merchantReference, 'service_command' => 'TOKENIZATION', 'language' => $this->language, 'return_url' => $returnUrl, ); if($paymentMethod == 'installments_merchantpage'){ $iframeParams['currency'] = strtoupper($this->currency); $iframeParams['installments'] = 'STANDALONE'; $iframeParams['amount'] = $this->convertFortAmount($this->amount, $this->currency); } $iframeParams['signature'] = $this->calculateSignature($iframeParams, 'request'); if ($this->sandboxMode) { $gatewayUrl = $this->gatewaySandboxHost . 'FortAPI/paymentPage'; } else { $gatewayUrl = $this->gatewayHost . 'FortAPI/paymentPage'; } $debugMsg = "Fort Merchant Page Request Parameters \n".print_r($iframeParams, 1); $this->log($debugMsg); return array('url' => $gatewayUrl, 'params' => $iframeParams); } public function getPaymentForm($gatewayUrl, $postData) { $form = '