mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
It is time to refund for echeck (business checking).
This commit is contained in:
parent
2532baa19e
commit
be09f12192
2 changed files with 24 additions and 3 deletions
|
@ -335,7 +335,8 @@ function authorize_print_order_details($orderno)
|
||||||
else {
|
else {
|
||||||
$extra->amount = $amount;
|
$extra->amount = $amount;
|
||||||
$message = '';
|
$message = '';
|
||||||
if (AN_APPROVED == authorize_action($order, $message, $extra, AN_ACTION_CREDIT)) {
|
$success = authorize_action($order, $message, $extra, AN_ACTION_CREDIT);
|
||||||
|
if (AN_APPROVED == $success || AN_REVIEW == $success) {
|
||||||
if (empty($CFG->an_test)) {
|
if (empty($CFG->an_test)) {
|
||||||
if (empty($extra->id)) {
|
if (empty($extra->id)) {
|
||||||
$table->data[] = array("<b><font color=red>$strs->error:</font></b>", 'insert record error');
|
$table->data[] = array("<b><font color=red>$strs->error:</font></b>", 'insert record error');
|
||||||
|
@ -593,8 +594,10 @@ function authorize_get_status_action($order)
|
||||||
|
|
||||||
case AN_STATUS_AUTHCAPTURE:
|
case AN_STATUS_AUTHCAPTURE:
|
||||||
if (authorize_settled($order)) {
|
if (authorize_settled($order)) {
|
||||||
if ($order->paymentmethod == AN_METHOD_CC && $canmanage) {
|
if ($canmanage) {
|
||||||
$ret->actions = array(ORDER_REFUND);
|
if (($order->paymentmethod == AN_METHOD_CC) || ($order->paymentmethod == AN_METHOD_ECHECK && !empty($order->refundinfo))) {
|
||||||
|
$ret->actions = array(ORDER_REFUND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$ret->status = 'settled';
|
$ret->status = 'settled';
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ function authorize_process_csv($filename)
|
||||||
$transid = $data[$csvfields['Transaction ID']];
|
$transid = $data[$csvfields['Transaction ID']];
|
||||||
$transtype = $data[$csvfields['Transaction Type']];
|
$transtype = $data[$csvfields['Transaction Type']];
|
||||||
$transstatus = $data[$csvfields['Transaction Status']];
|
$transstatus = $data[$csvfields['Transaction Status']];
|
||||||
|
$reftransid = $data[$csvfields['Reference Transaction ID']];
|
||||||
$settlementdate = strtotime($data[$csvfields['Settlement Date/Time']]);
|
$settlementdate = strtotime($data[$csvfields['Settlement Date/Time']]);
|
||||||
|
|
||||||
if ($transstatus == 'Approved Review' || $transstatus == 'Review Failed') {
|
if ($transstatus == 'Approved Review' || $transstatus == 'Review Failed') {
|
||||||
|
@ -122,6 +123,23 @@ function authorize_process_csv($filename)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($reftransid) && $transstatus == 'Settled Successfully' && $transtype == 'Credit') {
|
||||||
|
if ($refund = get_record('enrol_authorize_refunds', 'transid', $reftransid)) {
|
||||||
|
$order = get_record('enrol_authorize', 'id', $refund->orderid);
|
||||||
|
if (AN_METHOD_ECHECK == $order->paymentmethod) {
|
||||||
|
$refund->status = AN_STATUS_CREDIT;
|
||||||
|
$refund->settletime = $settlementdate;
|
||||||
|
update_record('enrol_authorize_refunds', $refund);
|
||||||
|
$updated++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ignored++;
|
||||||
|
$ignoredlines .= $reftransid . ": Not our business, in refunds\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! ($transstatus == 'Settled Successfully' && $transtype == 'Authorization w/ Auto Capture')) {
|
if (! ($transstatus == 'Settled Successfully' && $transtype == 'Authorization w/ Auto Capture')) {
|
||||||
$ignored++;
|
$ignored++;
|
||||||
$ignoredlines .= $transid . ": Not settled\n";
|
$ignoredlines .= $transid . ": Not settled\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue