Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

mtserv

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;
  
} 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.