Skip to content

Commit a04b988

Browse files
author
Marc Bernabeu
committed
send invoice customer option
1 parent 6b626c8 commit a04b988

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

app/code/community/Devopensource/Redsys/Helper/Data.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ public function createInvoice($order){
210210
$this->fixCreditCustomer();
211211
$order->addStatusHistoryComment($this->__('Invoice %s created', $invoice->getIncrementId()), false);
212212
$order->save();
213+
214+
$sendinvoice = Mage::getStoreConfig('payment/redsys/sendinvoice', Mage::app()->getStore());
215+
if($sendinvoice){
216+
$invoice->sendEmail();
217+
}
218+
213219
}
214220
}
215221

app/code/community/Devopensource/Redsys/controllers/IndexController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ public function callbackAction()
115115
}
116116

117117
try {
118-
$this->helper->createInvoice($order);
119118
$comment = $this->__('TPV payment accepted. (response: %s, authorization: %s)',$response,$authorisationcode);
120119
$this->helper->stateConfirmTpv($order,$comment);
121120
$order->sendNewOrderEmail();
121+
$this->helper->createInvoice($order);
122122
$this->helper->createTransaction($order,$decodeData);
123123
} catch (Exception $e) {
124124
$order->addStatusHistoryComment($this->__("TPV Error: %s",$e->getMessage()), false);

app/code/community/Devopensource/Redsys/etc/system.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@
115115
<show_in_website>1</show_in_website>
116116
<show_in_store>1</show_in_store>
117117
</autoinvoice>
118+
<sendinvoice translate="label comment">
119+
<label>Send Email Customer Invoice</label>
120+
<frontend_type>select</frontend_type>
121+
<source_model>adminhtml/system_config_source_yesno</source_model>
122+
<sort_order>110</sort_order>
123+
<show_in_default>1</show_in_default>
124+
<show_in_website>1</show_in_website>
125+
<show_in_store>1</show_in_store>
126+
<depends><autoinvoice>1</autoinvoice></depends>
127+
</sendinvoice>
118128
<order_status translate="label" module="payment">
119129
<label>New order status</label>
120130
<frontend_type>select</frontend_type>

0 commit comments

Comments
 (0)