/** * * @param Float $amount * @param String $currency - e.g. NZD * @return String * */ protected function buildURL($amount, $currency) { $commsObject = new DpsPxPayComs(); /** * order details **/ $commsObject->setTxnType(DpsPxPayComs::get_txn_type()); $commsObject->setMerchantReference($this->ID); //replace any character that is NOT [0-9] or dot (.) $commsObject->setAmountInput(floatval(preg_replace("/[^0-9\\.]/", "", $amount))); $commsObject->setCurrencyInput($currency); /** * details of the redirection **/ $commsObject->setUrlFail(DpsPxPayPayment_Handler::absolute_complete_link()); $commsObject->setUrlSuccess(DpsPxPayPayment_Handler::absolute_complete_link()); /** * process payment data (check if it is OK and go forward if it is... **/ $url = $commsObject->startPaymentProcess(); $debugMessage = $commsObject->getDebugMessage(); $this->DebugMessage = $debugMessage; $this->write(); if ($this->config()->get("email_debug")) { $from = Email::config()->admin_email; $to = Email::config()->admin_email; $subject = "DPS Debug Information"; $body = $debugMessage; $email = new Email($from, $to, $subject, $body); $email->send(); } return $url; }
protected function buildURL($amount, $cardToUse = '', $storeCard = false) { $commsObject = new DpsPxPayComs(); /** * order details **/ $commsObject->setTxnType(DpsPxPayComs::get_txn_type()); $commsObject->setMerchantReference($this->ID); //replace any character that is NOT [0-9] or dot (.) $commsObject->setAmountInput(floatval(preg_replace("/[^0-9\\.]/", "", $amount))); if (isset($cardToUse)) { $commsObject->setBillingId($cardToUse); } else { if ($storeCard) { $commsObject->setEnableAddBillCard(1); } } /** * details of the redirection **/ $link = DpsPxPayStoredPayment_Handler::absolute_complete_link(); $commsObject->setUrlFail($link); $commsObject->setUrlSuccess($link); /** * process payment data (check if it is OK and go forward if it is... **/ $url = $commsObject->startPaymentProcess(); return $url; }