/* PAGE DESCRIPTION: This page is a form handler for the "changeauth.html" form. This page is called if the user chooses to capture an authorized transaction. This handler may also be called when an Auto-Capture is to be performed before settling a batch. */ // //////////////////// BEGIN MAIN ///////////////////// var merchantReference = null; /* Merchants may want to assign their own meaningful values to the merchantReference variable here. It is used in the transaction processing and is stored in the database. If left as null, the program will generate a value for it at the time of the transaction process. However, some merchants may want to insert some more meaningful data into this field. Please see "MakeValidMerchantReference()" for length restrictions on the "merchantReference" variable. */ registerLivePayment(); // Construct required objects for transaction processing // merchant = new Merchant(); terminal = new Terminal(); processor = new Processor(project.acquirer); if (processor.bad()) { PrintFmtError("Failed to construct processor object.", processor.getStatusMessage()); } // Determine if this is an Auto-capture or a single transaction capture // Since properties of the REQUEST object are always read as strings, // we must also convert the string to a boolean. // if (request.all == "true") all = true; else all = false; /* If database type is INFORMIX, Set database server to wait 20 seconds if table/row is locked. *** THIS COMMAND IS SPECIFIC TO INFORMIX *** */ if (project.dbType.toUpperCase() == "INFORMIX") database.execute("SET LOCK MODE TO WAIT 20"); batch = GetCurrentBatch(merchant, terminal, processor); // Change the authorization indicated in request.id to CAPTURING status // or change ALL transactions in the AUTHORIZED status to CAPTURING. // AuthToCapturing(batch, request.id, all); // Capture all transactions in the CAPTURING state/status. // success = Capture(request.id, batch, merchant, terminal, processor, merchantReference, all); // Print out a confirmation of the function // if (success) Confirm(success, "capture"); else PrintError("Capture Failed", "The capture or auto-capture has failed.");