Skip to content

Commit 79cd43f

Browse files
committed
Send Email + Wire Ref Id sending in email and shown in order view both admin and user
1 parent 985d08a commit 79cd43f

File tree

21 files changed

+516
-150
lines changed

21 files changed

+516
-150
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Magento
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Academic Free License (AFL 3.0)
8+
* that is bundled with this package in the file LICENSE_AFL.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/afl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to [email protected] so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade Magento to newer
18+
* versions in the future. If you wish to customize Magento for your
19+
* needs please refer to http://www.magentocommerce.com for more information.
20+
*
21+
* @category Mage
22+
* @package GlobalExperts_Hypercharge
23+
* @copyright Copyright (c) 2014 Global Experts GmbH (http://www.globalexperts.ch/)
24+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25+
*/
26+
27+
class GlobalExperts_Hypercharge_Block_Form_Purchaseonaccountgtd extends Mage_Payment_Block_Form_Ccsave {
28+
29+
/**
30+
* Prepare payment form
31+
*/
32+
protected function _construct() {
33+
parent::_construct();
34+
$this->setTemplate('hypercharge/form/purchaseonaccountgtd.phtml');
35+
}
36+
37+
public function getSubmitUrl() {
38+
return 'hypercharge-mobile-purchase-on-account-gtd';
39+
}
40+
41+
}

app/code/community/GlobalExperts/Hypercharge/Block/Info/Cc.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ protected function _prepareSpecificInformation($transport = null) {
4848
Mage::helper('bithypercharge')->__('Transaction Status') => $this->htmlEscape($payment->getAdditionalInformation('Transaction Status'))
4949
));
5050
}
51+
52+
if ($this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))) {
53+
$transport->addData(array(
54+
Mage::helper('bithypercharge')->__('Wire Reference ID') => $this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))
55+
));
56+
}
5157
return $transport;
5258
}
5359

app/code/community/GlobalExperts/Hypercharge/Block/Info/Debit.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ protected function _prepareSpecificInformation($transport = null) {
5858
));
5959
}
6060

61+
if ($this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))) {
62+
$transport->addData(array(
63+
Mage::helper('bithypercharge')->__('Wire Reference ID') => $this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))
64+
));
65+
}
66+
6167
if ($this->htmlEscape($payment->getAdditionalInformation('transaction_id')) && $payment->getMethodInstance()->getCode() == Mage::getModel("bithypercharge/sepa")->getCode()) {
6268

6369
$orderId = current(explode("---", $payment->getAdditionalInformation('transaction_id')));

app/code/community/GlobalExperts/Hypercharge/Block/Info/Wpf.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ protected function _prepareSpecificInformation($transport = null) {
5757
Mage::helper('bithypercharge')->__('Transaction Status') => $this->htmlEscape($payment->getAdditionalInformation('Transaction Status'))
5858
));
5959
}
60+
61+
if ($this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))) {
62+
$transport->addData(array(
63+
Mage::helper('bithypercharge')->__('Wire Reference ID') => $this->htmlEscape($payment->getAdditionalInformation('Wire Reference ID'))
64+
));
65+
}
6066
return $transport;
6167
}
6268
}

app/code/community/GlobalExperts/Hypercharge/Model/Checkout.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,9 @@ public function wpfResponse($post) {
811811
->registerPaymentReviewAction(
812812
Mage_Sales_Model_Order_Payment
813813
::REVIEW_ACTION_UPDATE, false);
814+
if (!$order->getEmailSent()) {
815+
$order->sendNewOrderEmail();
816+
}
814817
$order->save();
815818
break;
816819
}

app/code/community/GlobalExperts/Hypercharge/Model/Mobile.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,6 @@ public function hyperResponse($post) {
255255
->setIsTransactionClosed(0);
256256
$order->registerCancellation('Payment error.', false);
257257
$order->save();
258-
// // send mail for POA with Payolution
259-
// if ($paymentMethod == 'GlobalExperts_Hypercharge_Model_Mobilepurchaseaccount') {
260-
// $comment = Mage::getStoreConfig('payment/hypercharge_mobile_purchase_on_account/errormsg');
261-
// $comment = str_replace("{{shop_email_address}}", Mage::getStoreConfig('general/ident_sales/email', $order->getStoreId()), $comment);
262-
// $order->addStatusToHistory($order->getStatus(), $comment, false);
263-
// $order->sendOrderUpdateEmail(true, $comment);
264-
// $order->save();
265-
// }
266258
return $xml;
267259
}
268260

@@ -367,18 +359,28 @@ public function hyperResponse($post) {
367359
else
368360
$transactionAmount = $response->amount;
369361

362+
//get wire_ref_id
363+
$wire_reference_id = "";
364+
if($transaction && $transaction->wire_reference_id) {
365+
$wire_reference_id = $transaction->wire_reference_id;
366+
}
367+
370368

371369
// Set some extra info
372370
$order->getPayment()
373371
->setAdditionalInformation('Last Transaction ID', $transactionId)
374372
->setAdditionalInformation('Transaction Type', $transactionType)
375373
->setAdditionalInformation('Transaction Status', $response->status);
376-
374+
375+
if ($wire_reference_id) {
376+
$order->getPayment()->setAdditionalInformation('Wire Reference ID', $wire_reference_id);
377+
}
378+
377379
try {
378380
switch($response->status) {
379381
case 'approved':
380382
case 'chargeback_reversed':
381-
if($is_sale) {
383+
if ($is_sale) {
382384
$order->getPayment()
383385
->setPreparedMessage('Payment authorized.')
384386
->setTransactionId($transactionId)
@@ -393,7 +395,7 @@ public function hyperResponse($post) {
393395
$order->save();
394396
$order->getPayment()->capture();
395397
break;
396-
}
398+
}
397399
$order->getPayment()
398400
->setTransactionId($transactionId)
399401
->setPreparedMessage('Transaction successful.')
@@ -433,6 +435,9 @@ public function hyperResponse($post) {
433435
->setAdditionalInformation('Transaction Status', $response->status)
434436
->setIsTransactionClosed(0)
435437
->registerPaymentReviewAction(Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, false);
438+
if (!$order->getEmailSent()) {
439+
$order->sendNewOrderEmail();
440+
}
436441
$order->save();
437442
break;
438443
}

app/code/community/GlobalExperts/Hypercharge/Model/Mobilepurchaseaccount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GlobalExperts_Hypercharge_Model_Mobilepurchaseaccount extends GlobalExpert
4848
// Can save credit card information for future processing?
4949
protected $_canSaveCc = false;
5050

51-
protected $_jsonTransactionType = "";
51+
protected $_jsonTransactionType = "purchase_on_account";
5252
/**
5353
* Validate payment method information object
5454
*

0 commit comments

Comments
 (0)