Skip to content

Commit

Permalink
Merge branch 'Opencart_1.x_develop' into Opencart_1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nlii committed Nov 30, 2015
2 parents 8f1168e + 43e5901 commit c1bd26a
Show file tree
Hide file tree
Showing 62 changed files with 1,035 additions and 759 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenCart - Svea payment module

##Version 2.7.0
##Version 2.7.1
* Supports OpenCart 1.4.9 or higher
* Requires PHP 5.3 or higher (namespace support)
* Feature _Product Price Widget_ and admin functions requires [vQmod](https://code.google.com/p/vqmod/) to be installed in your Opencart installation
Expand Down
2 changes: 1 addition & 1 deletion docs/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"module_name": "Opencart",
"module_version": "2.7.0",
"module_version": "2.7.1",
"module_shop_version_support": [
"1.4.9",
" - ",
Expand Down
5 changes: 3 additions & 2 deletions src/admin/controller/payment/svea_card.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
class ControllerPaymentsveacard extends Controller {
private $error = array();
protected $svea_version = '2.7.0';
protected $svea_version = '2.7.1';

public function index() {
$this->load->language('payment/svea_card');
Expand Down Expand Up @@ -46,7 +46,8 @@ public function index() {
$this->data['button_cancel'] = $this->language->get('button_cancel');

$this->data['tab_general'] = $this->language->get('tab_general');
$this->data['svea_version'] = $this->getSveaVersion();
$this->data['svea_version_text'] = $this->getSveaVersion();
$this->data['svea_version'] = $this->svea_version;
//Credentials
$this->data['entry_test'] = $this->language->get('entry_test');
$this->data['entry_prod'] = $this->language->get('entry_prod');
Expand Down
5 changes: 3 additions & 2 deletions src/admin/controller/payment/svea_directbank.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
class ControllerPaymentsveadirectbank extends Controller {
private $error = array();
protected $svea_version = '2.7.0';
protected $svea_version = '2.7.1';

public function index() {
$this->load->language('payment/svea_directbank');
Expand Down Expand Up @@ -31,7 +31,8 @@ public function index() {
$this->data['text_enabled'] = $this->language->get('text_enabled');
$this->data['text_disabled'] = $this->language->get('text_disabled');
$this->data['text_all_zones'] = $this->language->get('text_all_zones');
$this->data['svea_version'] = $this->getSveaVersion();
$this->data['svea_version_text'] = $this->getSveaVersion();
$this->data['svea_version'] = $this->svea_version;


$this->data['entry_order_status'] = $this->language->get('entry_order_status');
Expand Down
5 changes: 3 additions & 2 deletions src/admin/controller/payment/svea_invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class ControllerPaymentsveainvoice extends Controller {

private $error = array();
protected $svea_version = '2.7.0';
protected $svea_version = '2.7.1';

public function index() {
$this->load->language('payment/svea_invoice');
Expand All @@ -20,7 +20,8 @@ public function index() {
}

$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['svea_version'] = $this->getSveaVersion();
$this->data['svea_version_text'] = $this->getSveaVersion();
$this->data['svea_version'] = $this->svea_version;

$this->data['text_enabled'] = $this->language->get('text_enabled');
$this->data['text_disabled'] = $this->language->get('text_disabled');
Expand Down
25 changes: 13 additions & 12 deletions src/admin/controller/payment/svea_partpayment.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
class ControllerPaymentsveapartpayment extends Controller {
private $error = array();
protected $svea_version = '2.7.0';
protected $svea_version = '2.7.1';

public function index() {
$this->load->language('payment/svea_partpayment');
Expand All @@ -19,7 +19,8 @@ public function index() {
$this->session->data['success'] = $this->language->get('text_success');
$this->redirect(HTTPS_SERVER . 'index.php?route=extension/payment&token=' . $this->session->data['token']);
}
$this->data['svea_version'] = $this->getSveaVersion();
$this->data['svea_version_text'] = $this->getSveaVersion();
$this->data['svea_version'] = $this->svea_version;

$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_enabled'] = $this->language->get('text_enabled');
Expand Down Expand Up @@ -215,23 +216,23 @@ private function loadPaymentPlanParams(){
// we need to use the database config settings directly, as $this->config may contain old data that we just edited
$settings = $this->model_setting_setting->getSetting('svea_partpayment');

$username = $settings['svea_partpayment_username_' . $countryCode[$i]];
$password = $settings['svea_partpayment_password_' . $countryCode[$i]];
$username = $settings['svea_partpayment_username_' . $countryCode[$i]];
$password = $settings['svea_partpayment_password_' . $countryCode[$i]];
$client_id = $settings['svea_partpayment_clientno_' . $countryCode[$i]];
$testmode = $settings['svea_partpayment_testmode_' . $countryCode[$i]];

//get params if config is set
if($username != "" && $password != "" && $client_id != ""){
if ( $testmode !== NULL){
if($username != "" && $password != "" && $client_id != ""){

if ( $testmode !== NULL){
$conf = ($testmode == "1") ? new OpencartSveaConfigTest($this->config) : new OpencartSveaConfig($this->config);

// need to update $this->config with username et al from $settings
$conf->config->set('svea_partpayment_username_' . $countryCode[$i], $username);
$conf->config->set('svea_partpayment_password_' . $countryCode[$i], $password);
$conf->config->set('svea_partpayment_clientno_' . $countryCode[$i], $client_id);
$svea_params = WebPay::getPaymentPlanParams($conf);
$conf->config->set('svea_partpayment_clientno_' . $countryCode[$i], $client_id);

$svea_params = WebPay::getPaymentPlanParams($conf);

try {
$svea_params = $svea_params->setCountryCode($countryCode[$i])
Expand Down
3 changes: 2 additions & 1 deletion src/admin/view/template/payment/svea_card.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<tbody>
<tr>
<td>Version</td>
<td><?php echo $svea_version; ?></td>
<div class="col-sm-9"><?php echo $svea_version_text; ?></div>
<input type="hidden" value="<?php echo $svea_version; ?>" name="svea_card_version" id="svea_card_version" />
</tr>
<tr>
<td><?php echo $entry_testmode; ?>:</td>
Expand Down
3 changes: 2 additions & 1 deletion src/admin/view/template/payment/svea_directbank.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<tbody>
<tr>
<td>Version</td>
<td><?php echo $svea_version; ?></td>
<div class="col-sm-9"><?php echo $svea_version_text; ?></div>
<input type="hidden" value="<?php echo $svea_version; ?>" name="svea_directbank_version" id="svea_directbank_version" />
</tr>
<tr>
<td><?php echo $entry_geo_zone; ?></td>
Expand Down
3 changes: 2 additions & 1 deletion src/admin/view/template/payment/svea_invoice.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<tbody>
<tr>
<td>Version</td>
<td><?php echo $svea_version; ?></td>
<td><?php echo $svea_version_text; ?></td>
<input type="hidden" value="<?php echo $svea_version; ?>" name="svea_invoice_version" id="svea_invoice_version" />
</tr>
<tr>
<td><?php echo $entry_geo_zone; ?></td>
Expand Down
3 changes: 2 additions & 1 deletion src/admin/view/template/payment/svea_partpayment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<tbody>
<tr>
<td>Version</td>
<td><?php echo $svea_version; ?></td>
<td><?php echo $svea_version_text; ?></td>
<input type="hidden" value="<?php echo $svea_version; ?>" name="svea_partpayment_version" id="svea_partpayment_version" />
</tr>
<tr>
<td><?php echo $entry_geo_zone; ?></td>
Expand Down
2 changes: 1 addition & 1 deletion src/admin/view/template/total/svea_fee.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<table class="form"><tbody>
<tr>
<td>Version</td>
<td>2.7.0</td>
<td>2.7.1</td>
</tr>
</tbody></table>

Expand Down
6 changes: 3 additions & 3 deletions src/catalog/controller/payment/svea_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function index() {
$this->load->language('payment/svea_card');
include(DIR_APPLICATION.'../svea/Includes.php');

$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_card')) : new OpencartSveaConfig($this->config, 'svea_card');

$svea = WebPay::createOrder($conf);

Expand Down Expand Up @@ -110,7 +110,7 @@ public function responseSvea(){
$countryCode = $order_info['payment_iso_code_2'];

//Testmode
$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_card')) : new OpencartSveaConfig($this->config, 'svea_card');
$resp = new SveaResponse($_REQUEST, $countryCode, $conf); //HostedPaymentResponse
$response = $resp->getResponse();
$clean_clientOrderNumber = str_replace('.err', '', $response->clientOrderNumber);//bugfix for gateway concatinating ".err" on number
Expand Down Expand Up @@ -138,7 +138,7 @@ public function callbackSvea(){
$this->load->language('payment/svea_card');
include(DIR_APPLICATION.'../svea/Includes.php');

$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_card_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_card')) : new OpencartSveaConfig($this->config, 'svea_card');
$resp = new SveaResponse($_REQUEST, 'SE', $conf); //HostedPaymentResponse. Countrycode not important on hosted payments.
$response = $resp->getResponse();
$clean_clientOrderNumber = str_replace('.err', '', $response->clientOrderNumber);//bugfix for gateway concatinating ".err" on number
Expand Down
16 changes: 8 additions & 8 deletions src/catalog/controller/payment/svea_directbank.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function index() {
include(DIR_APPLICATION.'../svea/Includes.php');

//Testmode
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_directbank')) : new OpencartSveaConfig($this->config, 'svea_directbank');
try {
$svea = WebPay::getPaymentMethods($conf);
$this->data['sveaMethods'] = $svea
Expand Down Expand Up @@ -62,13 +62,13 @@ public function redirectSvea(){
$this->load->language('payment/svea_directbank');
include(DIR_APPLICATION.'../svea/Includes.php');

$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_directbank')) : new OpencartSveaConfig($this->config, 'svea_directbank');
$svea = WebPay::createOrder($conf);

//Get order information
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$currencyValue = (floatval(VERSION) >= 1.5) ? $order['currency_value'] : $order['value'];

//Product rows
$products = $this->cart->getProducts();
$svea = $this->addOrderRowsToHostedServiceOrder($svea, $products, $currencyValue);
Expand Down Expand Up @@ -119,13 +119,13 @@ public function redirectSvea(){
->setCardPageLanguage($payPageLanguage)
->getPaymentForm()
;
}
}
catch (Exception $e) {
$this->log->write($e->getMessage());
echo '<div class="attention">Logged Svea Error</div>';
exit();
}

// 2.x below
//Save order but Void it while order status is unsure
//$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], 0,'Sent to Svea gateway.'); // 2.x
Expand Down Expand Up @@ -170,7 +170,7 @@ public function responseSvea(){
$countryCode = $order_info['payment_iso_code_2'];

//Testmode
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_directbank')) : new OpencartSveaConfig($this->config, 'svea_directbank');
$resp = new SveaResponse($_REQUEST, $countryCode, $conf);
$response = $resp->getResponse();
$clean_clientOrderNumber = str_replace('.err', '', $response->clientOrderNumber);//bugfix for gateway concatinating ".err" on number
Expand All @@ -197,7 +197,7 @@ public function callbackSvea(){
$this->load->language('payment/svea_directbank');
include(DIR_APPLICATION.'../svea/Includes.php');

$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config)) : new OpencartSveaConfig($this->config);
$conf = ($this->config->get('svea_directbank_testmode') == 1) ? (new OpencartSveaConfigTest($this->config, 'svea_directbank')) : new OpencartSveaConfig($this->config, 'svea_directbank');
$resp = new SveaResponse($_REQUEST, 'SE', $conf); //HostedPaymentResponse. Countrycode not important on hosted payments.
$response = $resp->getResponse();
$clean_clientOrderNumber = str_replace('.err', '', $response->clientOrderNumber);//bugfix for gateway concatinating ".err" on number
Expand Down
4 changes: 2 additions & 2 deletions src/catalog/controller/payment/svea_invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function confirm() {
//Testmode
if($this->config->get('svea_invoice_testmode_'.$countryCode) !== NULL){
$conf = ( $this->config->get('svea_invoice_testmode_'.$countryCode) == "1" )
? new OpencartSveaConfigTest($this->config) : new OpencartSveaConfig($this->config);
? new OpencartSveaConfigTest($this->config,'svea_invoice') : new OpencartSveaConfig($this->config,'svea_invoice');
}
else {
$response = array("error" => $this->responseCodes(40001,"The country is not supported for this paymentmethod"));
Expand Down Expand Up @@ -309,7 +309,7 @@ public function getAddress() {
$countryCode = $order['payment_iso_code_2'];
//Testmode
$conf = ( $this->config->get('svea_invoice_testmode_'.$countryCode) == '1' )
? new OpencartSveaConfigTest($this->config) : new OpencartSveaConfig($this->config);
? new OpencartSveaConfigTest($this->config,'svea_invoice') : new OpencartSveaConfig($this->config,'svea_invoice');

$svea = WebPay::getAddresses($conf)
->setOrderTypeInvoice()
Expand Down
20 changes: 10 additions & 10 deletions src/catalog/controller/payment/svea_partpayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function confirm() {
$countryCode = $order['payment_iso_code_2'];
//Testmode
if ($this->config->get('svea_partpayment_testmode_' . $countryCode) !== NULL) {
$conf = $this->config->get('svea_partpayment_testmode_' . $countryCode) == "1" ? new OpencartSveaConfigTest($this->config) : new OpencartSveaConfig($this->config);
$conf = $this->config->get('svea_partpayment_testmode_' . $countryCode) == "1" ? new OpencartSveaConfigTest($this->config,'svea_partpayment') : new OpencartSveaConfig($this->config,'svea_partpayment');
} else {
$response = array("error" => $this->responseCodes(40001, "The country is not supported for this paymentmethod"));
echo json_encode($response);
Expand All @@ -106,10 +106,10 @@ public function confirm() {
$currencyValue = $currency_info['value'];

//Products
$this->load->language('payment/svea_partpayment');
$this->load->language('payment/svea_partpayment');
$svea = $this->addOrderRowsToWebServiceOrder($svea, $products, $currencyValue);

//extra charge addons like shipping and invoice fee
//extra charge addons like shipping and invoice fee
$addons = $this->addTaxRateToAddons();

$svea = $this->addAddonRowsToSveaOrder($svea, $addons, $currencyValue);
Expand All @@ -121,7 +121,7 @@ public function confirm() {
$addressArr[1] = $order['payment_address_1'];
$addressArr[2] = "";
}

$ssn = (isset($_GET['ssn'])) ? $_GET['ssn'] : 0;

$item = Item::individualCustomer();
Expand All @@ -135,13 +135,13 @@ public function confirm() {
->setPhoneNumber($order['telephone']);

if ($order["payment_iso_code_2"] == "DE" || $order["payment_iso_code_2"] == "NL") {

$item = $item->setInitials($_GET['initials'])
->setBirthDate($_GET['birthYear'], $_GET['birthMonth'], $_GET['birthDay']);
if($order["payment_iso_code_2"] == "NL") {
$item = $item->setInitials($_GET['initials']);
}
$item = $item->setBirthDate($_GET['birthYear'], $_GET['birthMonth'], $_GET['birthDay']);
}

$svea = $svea->addCustomerDetails($item);

try {
$svea = $svea
->setCountryCode($countryCode)
Expand Down Expand Up @@ -220,7 +220,7 @@ private function getAddress($ssn) {
$order = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$countryCode = $order['payment_iso_code_2'];
//Testmode
$conf = $this->config->get('svea_partpayment_testmode_' . $countryCode) == "1" ? new OpencartSveaConfigTest($this->config) : new OpencartSveaConfig($this->config);
$conf = $this->config->get('svea_partpayment_testmode_' . $countryCode) == "1" ? new OpencartSveaConfigTest($this->config,'svea_partpayment') : new OpencartSveaConfig($this->config,'svea_partpayment');

$svea = WebPay::getAddresses($conf)
->setOrderTypePaymentPlan()
Expand Down
Loading

0 comments on commit c1bd26a

Please sign in to comment.