Set the TransactionType (with Input Validation)
182285
def transaction_type(self, value):
        """"""
        if value is not None:
            if value not in self.ALLOWED_TRANSACTION_TYPES:
                raise AttributeError('%s transaction_type element must be one of %s not %s' % (
                    self.__class__.__name__, ','.join(self.ALLOWED_TRANSACTION_TYPES), value,))
        self._transaction_type = value
801344
def set_input_format(self, content_type, handler):
        """"""
        if getattr(self, '_input_format', None) is None:
            self._input_format = {}
        self._input_format[content_type] = handler
691307
function tableCheckup() {
    global $db, $sniffer;
    $fieldOkay1 = (method_exists($sniffer, 'field_type')) ? $sniffer->field_type(TABLE_AUTHORIZENET, 'transaction_id', 'bigint(20)', true) : -1;
    if ($fieldOkay1 !== true) {
      $db->Execute("ALTER TABLE " . TABLE_AUTHORIZENET . " CHANGE transaction_id transaction_id bigint(20) default NULL");
    }
  }
1141078
void setDataType(Session session, Type type) {

        if (opType == OpTypes.VALUE) {
            valueData = type.convertToType(session, valueData, dataType);
        }

        dataType = type;
    }
1315570
public function validate()
	{
		$this->validateAttributes([
			Request::ATTRIBUTE_INTERFACE,
			Request::ATTRIBUTE_TRANSACTION_TYPE,
		]);

		$transactionType = $this->getTransactionType();

		switch ($transactionType) {
			case Request::TRANSACTION_TYPE_PURCHASE:
			case Request::TRANSACTION_TYPE_PRE_AUTH: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
				], [
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_REFUND: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_COMPLETION: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					[
						Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
						Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					],
					[
						Request::ATTRIBUTE_AUTH_CODE,
						Request::ATTRIBUTE_AUTH_NUMBER,
						Request::ATTRIBUTE_AUTHORISATION_CODE,
						Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					],
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_STATUS: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_TAX_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_CODE,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					Request::ATTRIBUTE_CLIENT_REFERENCE,
					Request::ATTRIBUTE_COMMENT,
					Request::ATTRIBUTE_MERCHANT_CARD_HOLDER_NAME,
					Request::ATTRIBUTE_MERCHANT_DESCRIPTION,
					Request::ATTRIBUTE_TERMINAL_TYPE,
					Request::ATTRIBUTE_CVC2,
				]);

				break;
			}
		}

		return TRUE;
	}
146154
public JWTPayload setType(String type) {
        this.type = type;
        this.put(PayloadConstants.TYPE, type);
        return this;
    }
601185
public void setDataType(String type)  {
        addField(ConfigureNodeFields.type, FormField.Type.text_single);
        setAnswer(ConfigureNodeFields.type.getFieldName(), type);
    }
1182593
public function setTransactionId($transactionId)
    {
        if (is_numeric($transactionId) || $transactionId === false) {
            $this->params['transactionId'] = $transactionId;
            return $this;
        }
        throw new Exception("Please use a numeric value for transaction ID");
    }
1337566
public static final void checkTxAttrs(TransactionAttribute[] txAttrs,
                                          String[] methodNames, String[] methodSignatures,//PQ63130
                                          String[] checkedNames, String[] checkedSignatures,//PQ63130

                                          TransactionAttribute prescribedAttr)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "checkTxAttrs");
        for (int i = 0; i < methodNames.length; ++i) {
            for (int j = 0; j < checkedNames.length; ++j) {

                //PQ63130 added check of method signature
                if (((methodNames[i].equals(checkedNames[j])) && (methodSignatures[i].equals(checkedSignatures[j]))) | checkedNames[j].equals("*")) {

                    txAttrs[i] = prescribedAttr;
                    break;
                }
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "checkTxAttrs");

    }
234644
function(cb) {
      //console.log('tx running for ' + scope);
      // me.not_ready_ = true;
      // transaction should be active now
      var tx = me.mu_tx_.getTx();
      me.r_no_++;
      req.setTx(tx, me.getLabel() + 'R' + me.r_no_);
    }
1288864
def _set_market_trade_type(self, ttype):
        """"""
        selects = self._main.child_window(
            control_id=self._config.TRADE_MARKET_TYPE_CONTROL_ID,
            class_name="ComboBox",
        )
        for i, text in selects.texts():
            # skip 0 index, because 0 index is current select index
            if i == 0:
                continue
            if ttype in text:
                selects.select(i - 1)
                break
        else:
            raise TypeError("不支持对应的市价类型: {}".format(ttype))
1162694
function validatePayment(conn, payload, message_index, objUnit, objValidationState, callback){

	if (!("asset" in payload)){ // base currency
		if (hasFieldsExcept(payload, ["inputs", "outputs"]))
			return callback("unknown fields in payment message");
		if (objValidationState.bHasBasePayment)
			return callback("can have only one base payment");
		objValidationState.bHasBasePayment = true;
		return validatePaymentInputsAndOutputs(conn, payload, null, message_index, objUnit, objValidationState, callback);
	}
	
	// asset
	if (!isStringOfLength(payload.asset, constants.HASH_LENGTH))
		return callback("invalid asset");
	
	var arrAuthorAddresses = objUnit.authors.map(function(author) { return author.address; } );
	// note that light clients cannot check attestations
	storage.loadAssetWithListOfAttestedAuthors(conn, payload.asset, objValidationState.last_ball_mci, arrAuthorAddresses, function(err, objAsset){
		if (err)
			return callback(err);
		if (hasFieldsExcept(payload, ["inputs", "outputs", "asset", "denomination"]))
			return callback("unknown fields in payment message");
		if (!isNonemptyArray(payload.inputs))
			return callback("no inputs");
		if (!isNonemptyArray(payload.outputs))
			return callback("no outputs");
		if (objAsset.fixed_denominations){
			if (!isPositiveInteger(payload.denomination))
				return callback("no denomination");
		}
		else{
			if ("denomination" in payload)
				return callback("denomination in arbitrary-amounts asset")
		}
		if (!!objAsset.is_private !== !!objValidationState.bPrivate)
			return callback("asset privacy mismatch");
		var bIssue = (payload.inputs[0].type === "issue");
		var issuer_address;
		if (bIssue){
			if (arrAuthorAddresses.length === 1)
				issuer_address = arrAuthorAddresses[0];
			else{
				issuer_address = payload.inputs[0].address;
				if (arrAuthorAddresses.indexOf(issuer_address) === -1)
					return callback("issuer not among authors");
			}
			if (objAsset.issued_by_definer_only && issuer_address !== objAsset.definer_address)
				return callback("only definer can issue this asset");
		}
		if (objAsset.cosigned_by_definer && arrAuthorAddresses.indexOf(objAsset.definer_address) === -1)
			return callback("must be cosigned by definer");
		
		if (objAsset.spender_attested){
			if (conf.bLight && objAsset.is_private) // if the asset is public, we trust witnesses to have checked attestations
				return callback("being light, I can't check attestations for private assets");
			if (objAsset.arrAttestedAddresses.length === 0)
				return callback("none of the authors is attested");
			if (bIssue && objAsset.arrAttestedAddresses.indexOf(issuer_address) === -1)
				return callback("issuer is not attested");
		}
		validatePaymentInputsAndOutputs(conn, payload, objAsset, message_index, objUnit, objValidationState, callback);
	});
}
369538
def transaction_context(self):
        """"""
        class DocumentModelTransaction:
            def __init__(self, document_model):
                self.__document_model = document_model

            def __enter__(self):
                self.__document_model.persistent_object_context.enter_write_delay(self.__document_model)
                return self

            def __exit__(self, type, value, traceback):
                self.__document_model.persistent_object_context.exit_write_delay(self.__document_model)
                self.__document_model.persistent_object_context.rewrite_item(self.__document_model)

        return DocumentModelTransaction(self)
340589
@Override
    public void setTransactionTimeout(int timeout) throws SystemException {
        if (isJustLazyNow()) {
            arrangeLazyProcessIfAllowed(() -> {
                if (logger.isDebugEnabled()) {
                    logger.debug("#lazyTx ...Setting transaction timeout {}: {}", timeout, buildLazyTxExp());
                }
                doSuperSetTransactionTimeout(timeout);
            });
        } else {
            doSuperSetTransactionTimeout(timeout);
        }
    }
817101
public TransactionInput addInput(TransactionInput input) {
        unCache();
        input.setParent(this);
        inputs.add(input);
        adjustLength(inputs.size(), input.length);
        return input;
    }
794684
def executeSingle( self, conn, daoinput, tablename, transaction = False):			
	""""""
	sql1 = " insert into %s%s( " %(self.owner, tablename)
	sql2 =" values("
	"Now loop over all the input keys. We need to check if all the keys are valid !!!"
        for key in daoinput:
            sql1 += "%s," %key.upper()
            sql2 += ":%s," %key.lower()
        
        sql = sql1.strip(',') + ') ' + sql2.strip(',') + ' )'

        self.dbi.processData(sql, daoinput, conn, transaction)
860520
def set_paynet_id(payment_transaction, response)
      if response.payment_paynet_id
        payment_transaction.payment.paynet_id = response.payment_paynet_id
      end
    end