Skip to content
Permalink
Browse files

Fixed Bluepay transaction logging to use the correct standard for a p…

…ayment type (payment not sale)

Fixed the for attribute on the Bluepay settings pages for the secret key.

Close #3339
  • Loading branch information...
jamesallsup committed Sep 13, 2015
1 parent 8195318 commit ac24c81bbf1ec56183faa18e2396986f22d1a2d3
@@ -296,7 +296,7 @@ public function release() {
$this->model_payment_bluepay_hosted->logger('Release result:\r\n' . print_r($release_response, 1));
if ($release_response['Result'] == 'APPROVED') {
$this->model_payment_bluepay_hosted->addTransaction($bluepay_hosted_order['bluepay_hosted_order_id'], 'sale', $this->request->post['amount']);
$this->model_payment_bluepay_hosted->addTransaction($bluepay_hosted_order['bluepay_hosted_order_id'], 'payment', $this->request->post['amount']);
$total_released = $this->model_payment_bluepay_hosted->getTotalReleased($bluepay_hosted_order['bluepay_hosted_order_id']);
@@ -186,7 +186,7 @@ public function addTransaction($bluepay_hosted_order_id, $type, $total) {
}
public function getTotalReleased($bluepay_hosted_order_id) {
$query = $this->db->query("SELECT SUM(`amount`) AS `total` FROM `" . DB_PREFIX . "bluepay_hosted_order_transaction` WHERE `bluepay_hosted_order_id` = '" . (int)$bluepay_hosted_order_id . "' AND (`type` = 'sale' OR `type` = 'rebate')");
$query = $this->db->query("SELECT SUM(`amount`) AS `total` FROM `" . DB_PREFIX . "bluepay_hosted_order_transaction` WHERE `bluepay_hosted_order_id` = '" . (int)$bluepay_hosted_order_id . "' AND (`type` = 'payment' OR `type` = 'rebate')");
return (float)$query->row['total'];
}
@@ -180,7 +180,7 @@ public function addTransaction($bluepay_redirect_order_id, $type, $total) {
}
public function getTotalReleased($bluepay_redirect_order_id) {
$query = $this->db->query("SELECT SUM(`amount`) AS `total` FROM `" . DB_PREFIX . "bluepay_redirect_order_transaction` WHERE `bluepay_redirect_order_id` = '" . (int)$bluepay_redirect_order_id . "' AND (`type` = 'sale' OR `type` = 'rebate')");
$query = $this->db->query("SELECT SUM(`amount`) AS `total` FROM `" . DB_PREFIX . "bluepay_redirect_order_transaction` WHERE `bluepay_redirect_order_id` = '" . (int)$bluepay_redirect_order_id . "' AND (`type` = 'payment' OR `type` = 'rebate')");
return (float)$query->row['total'];
}
@@ -44,7 +44,7 @@
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="entry_secret_key"><?php echo $entry_secret_key; ?></label>
<label class="col-sm-2 control-label" for="bluepay_hosted_secret_key"><?php echo $entry_secret_key; ?></label>
<div class="col-sm-10">
<input type="text" name="bluepay_hosted_secret_key" value="<?php echo $bluepay_hosted_secret_key; ?>" placeholder="<?php echo $entry_secret_key; ?>" id="bluepay_hosted_secret_key" class="form-control" />
<?php if ($error_secret_key) { ?>
@@ -182,4 +182,4 @@
</div>
</div>
</div>
<?php echo $footer; ?>
<?php echo $footer; ?>
@@ -35,7 +35,7 @@
</div>
</div>
<div class="form-group required">
<label class="col-sm-2 control-label" for="entry_secret_key"><?php echo $entry_secret_key; ?></label>
<label class="col-sm-2 control-label" for="bluepay_redirect_secret_key"><?php echo $entry_secret_key; ?></label>
<div class="col-sm-10">
<input type="text" name="bluepay_redirect_secret_key" value="<?php echo $bluepay_redirect_secret_key; ?>" placeholder="<?php echo $entry_secret_key; ?>" id="bluepay_redirect_secret_key" class="form-control" />
<?php if ($error_secret_key) { ?>
@@ -159,4 +159,4 @@
</div>
</div>
</div>
<?php echo $footer; ?>
<?php echo $footer; ?>
@@ -73,6 +73,12 @@ public function callback() {
if ($response_data['Result'] == 'APPROVED') {
$bluepay_hosted_order_id = $this->model_payment_bluepay_hosted->addOrder($order_info, $response_data);
if ($this->config->get('bluepay_hosted_transaction') == 'SALE') {
$this->model_payment_globalpay->addTransaction($bluepay_hosted_order_id, 'payment', $order_info);
} else {
$this->model_payment_globalpay->addTransaction($bluepay_hosted_order_id, 'auth', $order_info);
}
$this->model_payment_bluepay_hosted->addTransaction($bluepay_hosted_order_id, $this->config->get('bluepay_hosted_transaction'), $order_info);
$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('bluepay_hosted_order_status_id'));
@@ -117,7 +117,11 @@ public function send() {
if ($response_data['Result'] == 'APPROVED') {
$bluepay_redirect_order_id = $this->model_payment_bluepay_redirect->addOrder($order_info, $response_data);
$this->model_payment_bluepay_redirect->addTransaction($bluepay_redirect_order_id, $this->config->get('bluepay_redirect_transaction'), $order_info);
if ($this->config->get('bluepay_hosted_transaction') == 'SALE') {
$this->model_payment_globalpay->addTransaction($bluepay_redirect_order_id, 'payment', $order_info);
} else {
$this->model_payment_globalpay->addTransaction($bluepay_redirect_order_id, 'auth', $order_info);
}
$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('bluepay_redirect_order_status_id'));

0 comments on commit ac24c81

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.