set list0 "0 1 2 3 4 5" set list1 [lappend list0 "6" "7" "8" "9" "10"] puts "$list1\n"; set i 0 foreach number $list1 { puts "$number is the $i element in the list\n" incr i; } set a [lindex $list1 5] set b [lindex $list1 10] set sum [expr {$a + $b}] puts " \nthe sum of two element is : $sum"
set a [] set b [] switch $a { 100 { puts "This is part of outer switch" switch $b { 200 { puts "This is part of inner switch!" } } } } puts "Exact value of a is : $a" puts "Exact value of a is : $b"
set var1 [list not and or nand nor xor xnor] set var1 { not and or nand nor xor xnor } set var1 "not and or nand nor xor xnor" set var1 [split "not_and_or_nand_nor_xor_xnor"] set var2 [list and 2 xor 3 nor 4] set var3 [list xor [list nand buff inv] [list cell1 cell2 ]] set a [llength $var1] set b []
#!/usr/bin/tclsh set variableA 10 set {variable B} test puts $variableA puts ${variable B}
set list [list {Washington 1789} {Adams 1797} {Jefferson 1801} \ {Madison 1809} {Monroe 1817} {Adams 1825} ] set x [lsearch $list Washington*] set y [lsearch $list Madison*] incr x incr y -1 ;# Set range to be not-inclusive set subsetlist [lrange $list $x $y] puts "The following presidents served between Washington and Madison" foreach item $subsetlist { puts "Starting in [lindex $item 1]: President [lindex $item 0] " } set x [lsearch $list Madison*] set srtlist [lsort $list] set y [lsearch $srtlist Madison*] puts "\n$x Presidents came before Madison chronologically" puts "$y Presidents came before Madison alphabetically" # Matches string match f* foo # Matches string match f?? foo # Doesn't match string match f foo # Returns a big list of files on my Debian system. set bins [glob /usr/bin/*] puts "\n.....................................\n" set string "this is my test string" puts "There are [string length $string] characters in \"$string\"" puts "[string index $string 1] is the second character in \"$string\"" puts "\"[string range $string 5 10]\" are characters between the 5'th and 10'th"
package com.dat.digipay.digiposgateway.backoffice.gateway; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.dat.digipay.digiposgateway.backoffice.domain.*; import com.dat.digipay.digiposgateway.backoffice.repository.*; import com.dat.digipay.digiposgateway.backoffice.repository.search.*; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.FileInputStream; import java.io.OutputStream; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Date; import java.util.Map; //import javax.transaction.Transactional; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; //import java.io.*; import org.jpos.iso.*; import org.jpos.util.*; import org.jpos.iso.channel.*; import org.jpos.iso.packager.*; /** * A class to test interactions with the MySQL database using the UserDao class. * * @author Philippe MONSAN */ @Service @Transactional public class MoneyTransferService { static Logger logger = LoggerFactory.getLogger(MoneyTransferService.class); static String MESSAGE_TYPE = ""; String terminalid; String meansofpayment; String beneficiary; String secretcode; String transactionid; double amount; public void initService(String terminalid, String meansofpayment, String beneficiary, String secretcode, String transactionid, double amount){ this.terminalid = terminalid; this.meansofpayment = meansofpayment; this.beneficiary = beneficiary; this.secretcode = secretcode; this.transactionid = transactionid; this.amount = amount; } public void produceMessage() throws IOException{ try{ DpService dpService = null; MessageType messageType = serviceUtils.getMessageType(MESSAGE_TYPE); Device device = serviceUtils.getDevice(terminalid); Meansofpayment meansofpaymentSelected = serviceUtils.getMeansofpayment(this.meansofpayment); Beneficiary beneficiarySelected = serviceUtils.getBeneficiary(this.beneficiary); SecurityEndpoint securityEndpoint; if (device == null){ return; } Merchant merchant = device.getMerchant(); MessageSetting ms = serviceUtils.getMessageSetting(MESSAGE_TYPE, beneficiarySelected.getBeneficiaryType()); if (ms != null){ DpService dpService = ms.getDpService(); securityEndpoint = ms.getSecurityEndpoint(); } if (dpService == null){ return; } /* String isoMessage; ISO87APackager packager = new ISO87APackager(); ISOMsg m = new ISOMsg(); m.setMTI ("0200"); m.set (2, meansofpayment); m.set (3, "20021"); m.set (4, amount + ""); m.set (11, "000001"); m.set (32, issuerCode); m.set (41, this.terminalid); m.set (42, merchantId); //m.set (60, "jPOS 6"); //m.set (70, "301"); logISOMsg(m); m.setPackager (packager); byte[] binaryImage = m.pack(); isoMessage = new String(binaryImage); */ String isoMessage = generateIsoMessage(dpService, device, merchant, meansofpaymentSelected, beneficiarySelected); Message message = serviceUtils.createMessage(dpService, MESSAGE_TYPE, this.transactionid, device, meansofpaymentSelected, beneficiarySelected, this.amount, isoMessage, securityEndpoint); //Message message = serviceUtils.createMessage(service, MESSAGE_TYPE, this.transactionid, this.terminalid, merchantId, issuerCode, meansofpaymentType, this.meansofpayment, beneficiaryType, this.beneficiar, this.amount, isoMessage, securityEndpoint); } catch(ISOException e){ } } private void logISOMsg(ISOMsg msg) { System.out.println("----ISO MESSAGE-----"); try { System.out.println(" MTI : " + msg.getMTI()); for (int i=1;i<=msg.getMaxField();i++) { if (msg.hasField(i)) { System.out.println(" Field-"+i+" : "+msg.getString(i)); } } } catch (ISOException e) { e.printStackTrace(); } finally { System.out.println("--------------------"); } } @Autowired private DeviceRepository deviceDao; @Autowired private DpServiceRepository dpServiceDao; @Autowired private IsoSettingRepository isoSettingDao; @Autowired private IsoMessageRepository isoMessageDao; @Autowired private IsoMessageFieldRepository isoMessageFieldDao; @Autowired private MessageRepository messageDao; @Autowired private IsoServerRepository isoServerDao; @Autowired private ServiceUtils serviceUtils; }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more