conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import org.springframework.http.HttpHeaders;
=======
>>>>>>>
import org.springframework.http.HttpHeaders;
<<<<<<<
import javax.validation.Valid;
=======
>>>>>>>
import javax.validation.Valid;
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import de.adorsys.aspsp.xs2a.consent.api.CmsScaStatus;
=======
import de.adorsys.aspsp.xs2a.consent.api.ais.AccountAccessType;
>>>>>>>
import de.adorsys.aspsp.xs2a.consent.api.CmsScaStatus;
import de.adorsys.aspsp.xs2a.consent.api.ais.AccountAccessType;
<<<<<<<
import de.adorsys.aspsp.xs2a.spi.domain.consent.*;
=======
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiAccountAccess;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiConsentStatus;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiCreateAisConsentRequest;
>>>>>>>
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiAccountAccess;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiConsentStatus;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiCreateAisConsentRequest;
import de.adorsys.aspsp.xs2a.spi.domain.consent.*; |
<<<<<<<
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@GetMapping(path = "/{id}")
public ResponseEntity<SpiAccountDetails> readAccountById(@PathVariable("id") String id) {
return accountService.getAccount(id)
=======
@GetMapping(path = "/{accountId}")
public ResponseEntity<SpiAccountDetails> readAccountById(@PathVariable("accountId") String accountId) {
return accountService.getAccount(accountId)
>>>>>>>
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@GetMapping(path = "/{accountId}")
public ResponseEntity<SpiAccountDetails> readAccountById(@PathVariable("accountId") String accountId) {
return accountService.getAccount(accountId)
<<<<<<<
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@DeleteMapping(path = "/{id}")
public ResponseEntity deleteAccount(@PathVariable("id") String id) {
if (accountService.deleteAccountById(id)) {
=======
@DeleteMapping(path = "/{accountId}")
public ResponseEntity deleteAccount(@PathVariable("accountId") String accountId) {
if (accountService.deleteAccountById(accountId)) {
>>>>>>>
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@DeleteMapping(path = "/{accountId}")
public ResponseEntity deleteAccount(@PathVariable("accountId") String accountId) {
if (accountService.deleteAccountById(accountId)) {
<<<<<<<
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@GetMapping(path = "/{id}/balances")
public ResponseEntity<List<SpiBalances>> readBalancesById(@PathVariable("id") String id) {
return accountService.getBalances(id)
=======
@GetMapping(path = "/{accountId}/balances")
public ResponseEntity<List<SpiBalances>> readBalancesById(@PathVariable("accountId") String accountId) {
return accountService.getBalances(accountId)
>>>>>>>
@ApiOperation(value = "", authorizations = { @Authorization(value="oauth2", scopes = { @AuthorizationScope(scope = "read", description = "Access read API") }) })
@GetMapping(path = "/{accountId}/balances")
public ResponseEntity<List<SpiBalances>> readBalancesById(@PathVariable("accountId") String accountId) {
return accountService.getBalances(accountId) |
<<<<<<<
@ApiImplicitParam(name = "tpp-signature-certificate", value = "some certificate", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "tpp-qwac-certificate", value = "qwac certificate", dataType = "String", paramType = "header")})
=======
@ApiImplicitParam(name = "tpp-signature-certificate", defaultValue = TPP_INFO, dataType = "String", paramType = "header")})
>>>>>>>
@ApiImplicitParam(name = "tpp-signature-certificate", value = "some certificate", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "tpp-qwac-certificate", value = "qwac certificate", dataType = "String", paramType = "header")})
<<<<<<<
@ApiImplicitParam(name = "tpp-signature-certificate", value = "some certificate", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "tpp-qwac-certificate", value = "qwac certificate", dataType = "String", paramType = "header")})
public ResponseEntity<TransactionStatus> getPaymentInitiationStatusById(
=======
@ApiImplicitParam(name = "tpp-signature-certificate", value = "some certificate", dataType = "String", paramType = "header")})
public ResponseEntity<TransactionStatusResponse> getPaymentInitiationStatusById(
>>>>>>>
@ApiImplicitParam(name = "tpp-signature-certificate", value = "some certificate", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "tpp-qwac-certificate", value = "qwac certificate", dataType = "String", paramType = "header")})
public ResponseEntity<TransactionStatusResponse> getPaymentInitiationStatusById( |
<<<<<<<
=======
//NOPMD TODO implement http signature filter, https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/141
//@Component
//@Order(3)
>>>>>>>
<<<<<<<
} else {
chain.doFilter(request, response);
=======
} else {
chain.doFilter(request, response);
>>>>>>>
} else {
chain.doFilter(request, response); |
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.pis.PisConsent;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiConsentStatus;
=======
import de.adorsys.aspsp.xs2a.domain.PisConsent;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.PisConsent;
import de.adorsys.aspsp.xs2a.domain.pis.PisConsent;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiConsentStatus; |
<<<<<<<
import de.adorsys.aspsp.xs2a.consent.api.AisConsentRequestType;
import de.adorsys.aspsp.xs2a.consent.api.ConsentActionRequest;
=======
>>>>>>>
import de.adorsys.aspsp.xs2a.consent.api.AisConsentRequestType;
import de.adorsys.aspsp.xs2a.consent.api.ConsentActionRequest;
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.*;
=======
import de.adorsys.aspsp.xs2a.domain.AccountAccess;
import de.adorsys.aspsp.xs2a.domain.AisConsent;
import de.adorsys.aspsp.xs2a.domain.AisConsentAction;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.*;
import de.adorsys.aspsp.xs2a.domain.AccountAccess;
import de.adorsys.aspsp.xs2a.domain.AisConsent;
import de.adorsys.aspsp.xs2a.domain.AisConsentAction; |
<<<<<<<
import de.adorsys.aspsp.xs2a.service.consent.PisConsentDataService;
import de.adorsys.aspsp.xs2a.service.consent.PisConsentService;
=======
import de.adorsys.aspsp.xs2a.service.consent.Xs2aPisConsentService;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.consent.PisConsentDataService;
import de.adorsys.aspsp.xs2a.service.consent.PisConsentService;
import de.adorsys.aspsp.xs2a.service.consent.Xs2aPisConsentService; |
<<<<<<<
import com.google.gson.Gson;
=======
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
>>>>>>>
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import com.google.gson.Gson;
<<<<<<<
import org.apache.commons.io.IOUtils;
import org.junit.Before;
=======
>>>>>>>
import org.apache.commons.io.IOUtils;
import org.junit.Before;
<<<<<<<
@MockBean(name = "accountService")
=======
@MockBean
>>>>>>>
@MockBean(name = "accountService")
<<<<<<<
=======
/*
// TODO Make a AccountServiceTest for it
@Test(expected = ConstraintViolationException.class)
public void shouldFail_getBalance_emptyAccountWithBalanceAndPsuInvolved() {
//Given:
String accountId = "";
boolean psuInvolved = true;
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
Balances expectedResult = accountService.getBalances(accountId, psuInvolved);
//When:
ResponseEntity<Balances> actualResponse = accountController.getBalances(accountId, psuInvolved);
//Then:
HttpStatus actualStatusCode = actualResponse.getStatusCode();
Balances actualResult = actualResponse.getBody();
assertThat(actualStatusCode).isEqualTo(expectedStatusCode);
assertThat(actualResult).isEqualTo(expectedResult);
}
*/
>>>>>>>
<<<<<<<
private void checkTransactionResults(String accountId, Date dateFrom, Date dateTo, String transactionId,
boolean psuInvolved) {
=======
// TODO Make a AccountServiceTest for it
/*
@Test(expected = ConstraintViolationException.class)
public void shouldFail_getTransactions_noTransactionIdNoPsuInvolved() {
//Given:
String transactionId = "";
boolean psuInvolved = false;
checkTransactionResults(ACCOUNT_ID, null, null, transactionId, psuInvolved);
}
*/
/*
// TODO Make a AccountServiceTest for it
@Test(expected = ConstraintViolationException.class)
public void shouldFail_getTransactions_noAccountId() {
//Given:
String accountId = "";
String transactionId = "";
boolean psuInvolved = false;
checkTransactionResults(accountId, null, null, transactionId, psuInvolved);
}
*/
private void checkTransactionResults(
String accountId, Date dateFrom, Date dateTo, String transactionId,
boolean psuInvolved
) {
>>>>>>>
private void checkTransactionResults(String accountId, Date dateFrom, Date dateTo, String transactionId,
boolean psuInvolved) {
<<<<<<<
ResponseEntity<AccountReport> actualResponse = accountController.getTransactions(accountId, dateFrom, dateTo, transactionId, psuInvolved, "both", false, false);
=======
ResponseEntity<AccountReport> actualResponse = accountController.getTransactions(accountId,
dateFrom,
dateTo,
transactionId,
psuInvolved);
>>>>>>>
ResponseEntity<AccountReport> actualResponse = accountController.getTransactions(accountId, dateFrom, dateTo, transactionId, psuInvolved, "both", false, false);
<<<<<<<
expectedResult.put("accountList", accountService.getAccountDetailsList(withBalance, psuInvolved).getData().get("accountList"));
=======
expectedResult.put("accountList", accountDetailsList);
when(accountService.getAccountDetailsList(withBalance, psuInvolved))
.thenReturn(Collections.singletonList(accountDetails));
>>>>>>>
expectedResult.put("accountList", accountService.getAccountDetailsList(withBalance, psuInvolved).getData().get("accountList"));
expectedResult.put("accountList", accountDetailsList);
when(accountService.getAccountDetailsList(withBalance, psuInvolved))
.thenReturn(Collections.singletonList(accountDetails)); |
<<<<<<<
private PaymentInitialisationResponse createConsentForPeriodicPaymentAndExtendPaymentResponse(CreatePisConsentData createPisConsentData, PaymentInitialisationResponse response) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForPeriodicPayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForPeriodicPaymentAndGetId(request);
String iban = createPisConsentData.getPeriodicPayment().getDebtorAccount().getIban();
=======
private PaymentInitialisationResponse createConsentForPeriodicPaymentAndExtendPaymentResponse(CreateConsentRequest createConsentRequest, PaymentInitialisationResponse response) {
String pisConsentId = pisConsentService.createPisConsentForPeriodicPaymentAndGetId(createConsentRequest, response.getPaymentId());
>>>>>>>
private PaymentInitialisationResponse createConsentForPeriodicPaymentAndExtendPaymentResponse(CreatePisConsentData createPisConsentData, PaymentInitialisationResponse response) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForPeriodicPayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForPeriodicPaymentAndGetId(request);
String iban = createPisConsentData.getPeriodicPayment().getDebtorAccount().getIban();
private PaymentInitialisationResponse createConsentForPeriodicPaymentAndExtendPaymentResponse(CreateConsentRequest createConsentRequest, PaymentInitialisationResponse response) {
String pisConsentId = pisConsentService.createPisConsentForPeriodicPaymentAndGetId(createConsentRequest, response.getPaymentId());
<<<<<<<
private List<PaymentInitialisationResponse> createConsentForBulkPaymentAndExtendPaymentResponses(CreatePisConsentData createPisConsentData) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForBulkPayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForBulkPaymentAndGetId(request);
List<SinglePayment> singlePayments = Lists.newArrayList(createPisConsentData.getPaymentIdentifierMap().keySet());
List<PaymentInitialisationResponse> responses = Lists.newArrayList(createPisConsentData.getPaymentIdentifierMap().values());
return getDebtorIbanFromPayments(singlePayments)
.map(iban -> responses.stream()
.map(resp -> extendPaymentResponseFields(resp, iban, pisConsentId))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
=======
private List<PaymentInitialisationResponse> createConsentForBulkPaymentAndExtendPaymentResponses(CreateConsentRequest createConsentRequest) {
String pisConsentId = pisConsentService.createPisConsentForBulkPaymentAndGetId(createConsentRequest);
List<PaymentInitialisationResponse> responses = Lists.newArrayList(createConsentRequest.getPaymentIdentifierMap().values());
return responses.stream()
.map(resp -> extendPaymentResponseFields(resp, pisConsentId))
.collect(Collectors.toList());
>>>>>>>
private List<PaymentInitialisationResponse> createConsentForBulkPaymentAndExtendPaymentResponses(CreatePisConsentData createPisConsentData) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForBulkPayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForBulkPaymentAndGetId(request);
List<SinglePayment> singlePayments = Lists.newArrayList(createPisConsentData.getPaymentIdentifierMap().keySet());
List<PaymentInitialisationResponse> responses = Lists.newArrayList(createPisConsentData.getPaymentIdentifierMap().values());
return getDebtorIbanFromPayments(singlePayments)
.map(iban -> responses.stream()
.map(resp -> extendPaymentResponseFields(resp, iban, pisConsentId))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
private List<PaymentInitialisationResponse> createConsentForBulkPaymentAndExtendPaymentResponses(CreateConsentRequest createConsentRequest) {
String pisConsentId = pisConsentService.createPisConsentForBulkPaymentAndGetId(createConsentRequest);
List<PaymentInitialisationResponse> responses = Lists.newArrayList(createConsentRequest.getPaymentIdentifierMap().values());
return responses.stream()
.map(resp -> extendPaymentResponseFields(resp, pisConsentId))
.collect(Collectors.toList());
<<<<<<<
private PaymentInitialisationResponse createConsentForSinglePaymentAndExtendPaymentResponse(CreatePisConsentData createPisConsentData, PaymentInitialisationResponse response) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForSinglePayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForSinglePaymentAndGetId(request);
String iban = createPisConsentData.getSinglePayment().getDebtorAccount().getIban();
=======
private PaymentInitialisationResponse createConsentForSinglePaymentAndExtendPaymentResponse(CreateConsentRequest createConsentRequest, PaymentInitialisationResponse response) {
String pisConsentId = pisConsentService.createPisConsentForSinglePaymentAndGetId(createConsentRequest, response.getPaymentId());
>>>>>>>
private PaymentInitialisationResponse createConsentForSinglePaymentAndExtendPaymentResponse(CreatePisConsentData createPisConsentData, PaymentInitialisationResponse response) {
SpiPisConsentRequest request = pisConsentMapper.mapToSpiPisConsentRequestForSinglePayment(createPisConsentData);
String pisConsentId = consentSpi.createPisConsentForSinglePaymentAndGetId(request);
String iban = createPisConsentData.getSinglePayment().getDebtorAccount().getIban();
private PaymentInitialisationResponse createConsentForSinglePaymentAndExtendPaymentResponse(CreateConsentRequest createConsentRequest, PaymentInitialisationResponse response) {
String pisConsentId = pisConsentService.createPisConsentForSinglePaymentAndGetId(createConsentRequest, response.getPaymentId()); |
<<<<<<<
/**
* Read AllPsd2Support status
*/
public boolean isAllPsd2Support() {
return profileConfiguration.isAllPsd2Support();
}
/**
* Update AllPsd2Support status
*
* @param allPsd2Support AllPsd2Support status to substitute existing one
*/
public void updateAllPsd2Support(boolean allPsd2Support) {
profileConfiguration.setAllPsd2Support(allPsd2Support);
}
=======
/**
* Read the limit of a maximum lifetime of consent
*/
public int getConsentLifetime() {
return profileConfiguration.getConsentLifetime();
}
/**
* Update the value of a maximum lifetime of consent
*
* @param consentLifetime the value of a maximum lifetime of consent to substitute existing one
*/
public void updateConsentLifetime(int consentLifetime) {
profileConfiguration.setConsentLifetime(consentLifetime);
}
/**
* Read the limit of a maximum lifetime of transaction set in days
*/
public int getTransactionLifetime() {
return profileConfiguration.getTransactionLifetime();
}
/**
* Update the value of a maximum lifetime of transaction set in days
*
* @param transactionLifetime the value of a maximum lifetime of transaction to substitute existing one
*/
public void updateTransactionLifetime(int transactionLifetime) {
profileConfiguration.setTransactionLifetime(transactionLifetime);
}
>>>>>>>
/**
* Read the limit of a maximum lifetime of consent
*/
public int getConsentLifetime() {
return profileConfiguration.getConsentLifetime();
}
/**
* Update the value of a maximum lifetime of consent
*
* @param consentLifetime the value of a maximum lifetime of consent to substitute existing one
*/
public void updateConsentLifetime(int consentLifetime) {
profileConfiguration.setConsentLifetime(consentLifetime);
}
/**
* Read the limit of a maximum lifetime of transaction set in days
*/
public int getTransactionLifetime() {
return profileConfiguration.getTransactionLifetime();
}
/**
* Update the value of a maximum lifetime of transaction set in days
*
* @param transactionLifetime the value of a maximum lifetime of transaction to substitute existing one
*/
public void updateTransactionLifetime(int transactionLifetime) {
profileConfiguration.setTransactionLifetime(transactionLifetime);
}
/**
* Read AllPsd2Support status
*/
public boolean isAllPsd2Support() {
return profileConfiguration.isAllPsd2Support();
}
/**
* Update AllPsd2Support status
*
* @param allPsd2Support AllPsd2Support status to substitute existing one
*/
public void updateAllPsd2Support(boolean allPsd2Support) {
profileConfiguration.setAllPsd2Support(allPsd2Support);
} |
<<<<<<<
private static final boolean ALL_PSD_2_SUPPORT = false;
=======
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
>>>>>>>
private static final boolean ALL_PSD_2_SUPPORT = false;
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
<<<<<<<
when(profileConfiguration.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
=======
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
>>>>>>>
when(profileConfiguration.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
<<<<<<<
@Test
public void getAllPsd2Support() {
//When:
Boolean actualResponse = aspspProfileService.isAllPsd2Support();
//Then:
assertThat(actualResponse).isEqualTo(ALL_PSD_2_SUPPORT);
}
=======
@Test
public void isBankOfferedConsentSupport() {
//When
boolean actualResponse = aspspProfileService.isBankOfferedConsentSupport();
//Then
assertThat(actualResponse).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
}
>>>>>>>
@Test
public void getAllPsd2Support() {
//When:
Boolean actualResponse = aspspProfileService.isAllPsd2Support();
//Then:
assertThat(actualResponse).isEqualTo(ALL_PSD_2_SUPPORT);
}
@Test
public void isBankOfferedConsentSupport() {
//When
boolean actualResponse = aspspProfileService.isBankOfferedConsentSupport();
//Then
assertThat(actualResponse).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
} |
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataResponse;
=======
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataResponse;
import de.adorsys.aspsp.xs2a.service.authorization.pis.PisAuthorisationService;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataResponse;
<<<<<<<
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiToXs2aAuthenticationObjectMapper;
=======
import de.adorsys.aspsp.xs2a.service.mapper.consent.SpiCmsPisMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiErrorMapper;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiToXs2aAuthenticationObjectMapper;
<<<<<<<
=======
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiAuthorizationCodeResult;
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiScaMethod;
>>>>>>>
<<<<<<<
public PisScaStartAuthorisationStage(PaymentAuthorisationSpi paymentAuthorisationSpi, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper, Xs2aPisConsentMapper xs2aPisConsentMapper) {
super(paymentAuthorisationSpi, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiToXs2aAuthenticationObjectMapper, xs2aPisConsentMapper);
=======
public PisScaStartAuthorisationStage(PisAuthorisationService pisAuthorisationService, PaymentAuthorisationSpi paymentAuthorisationSpi, SpiCmsPisMapper spiCmsPisMapper, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiErrorMapper spiErrorMapper) {
super(pisAuthorisationService, paymentAuthorisationSpi, spiCmsPisMapper, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiErrorMapper);
>>>>>>>
public PisScaStartAuthorisationStage(PaymentAuthorisationSpi paymentAuthorisationSpi, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper, Xs2aPisConsentMapper xs2aPisConsentMapper) {
super(paymentAuthorisationSpi, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiToXs2aAuthenticationObjectMapper, xs2aPisConsentMapper); |
<<<<<<<
=======
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
>>>>>>>
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors; |
<<<<<<<
import io.nuls.consensus.download.DownloadCacheHandler;
=======
import io.nuls.account.entity.Address;
>>>>>>>
import io.nuls.consensus.download.DownloadCacheHandler;
<<<<<<<
// BlockLog.info("download block height:" + block.getHeader().getHeight() + ", preHash:" + block.getHeader().getPreHash() + " , hash:" + block.getHeader().getHash() + ", address:" + block.getHeader().getPackingAddress());
// if (BlockBatchDownloadUtils.getInstance().downloadedBlock(fromId, block)) {
// return;
// }
//blockCacheManager.addBlock(block, true, fromId);
=======
BlockLog.info("download block height:" + block.getHeader().getHeight() + ", preHash:" + block.getHeader().getPreHash() + " , hash:" + block.getHeader().getHash() + ", address:" + Address.fromHashs(block.getHeader().getPackingAddress()));
if (BlockBatchDownloadUtils.getInstance().downloadedBlock(fromId, block)) {
return;
}
>>>>>>>
BlockLog.info("download block height:" + block.getHeader().getHeight() + ", preHash:" + block.getHeader().getPreHash() + " , hash:" + block.getHeader().getHash() + ", address:" + block.getHeader().getPackingAddress());
if (BlockBatchDownloadUtils.getInstance().downloadedBlock(fromId, block)) {
return;
}
//blockCacheManager.addBlock(block, true, fromId); |
<<<<<<<
void applyStrongUserAuthorisation(SpiScaConfirmation spiScaConfirmation, AspspConsentData aspspConsentData);
=======
SpiResponse<Void> applyStrongUserAuthorisation(SpiPaymentConfirmation spiPaymentConfirmation, AspspConsentData aspspConsentData);
>>>>>>>
SpiResponse<Void> applyStrongUserAuthorisation(SpiScaConfirmation spiScaConfirmation, AspspConsentData aspspConsentData); |
<<<<<<<
import de.adorsys.aspsp.xs2a.service.mapper.AccountMapper;
import de.adorsys.aspsp.xs2a.service.mapper.consent.AisConsentMapper;
=======
import de.adorsys.aspsp.xs2a.service.consent.ais.AisConsentService;
import de.adorsys.aspsp.xs2a.service.mapper.ConsentMapper;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.mapper.AccountMapper;
import de.adorsys.aspsp.xs2a.service.mapper.consent.AisConsentMapper;
<<<<<<<
import de.adorsys.aspsp.xs2a.spi.domain.account.SpiAccountDetails;
import de.adorsys.aspsp.xs2a.spi.domain.consent.AspspConsentData;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiCreateAisConsentRequest;
import de.adorsys.aspsp.xs2a.spi.service.AccountSpi;
import de.adorsys.aspsp.xs2a.spi.service.ConsentSpi;
=======
>>>>>>>
import de.adorsys.aspsp.xs2a.spi.domain.account.SpiAccountDetails;
import de.adorsys.aspsp.xs2a.spi.domain.consent.AspspConsentData;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiCreateAisConsentRequest;
import de.adorsys.aspsp.xs2a.spi.service.AccountSpi;
import de.adorsys.aspsp.xs2a.spi.service.ConsentSpi;
<<<<<<<
private final AisConsentMapper aisConsentMapper;
private final ConsentSpi consentSpi;
private final AccountSpi accountSpi;
private final AccountMapper accountMapper;
=======
private final ConsentMapper consentMapper;
private final AisConsentService aisConsentService;
>>>>>>>
private final AisConsentMapper aisConsentMapper;
private final ConsentSpi consentSpi;
private final AccountSpi accountSpi;
private final AccountMapper accountMapper;
<<<<<<<
SpiCreateAisConsentRequest createAisConsentRequest = aisConsentMapper.mapToSpiCreateAisConsentRequest(request, psuId, tppId, new AspspConsentData("zzzzzzzzzzzzzz".getBytes()));
String consentId = isNotEmptyAccess(checkedRequest.getAccess())
? consentSpi.createConsent(createAisConsentRequest)
: null;
=======
String consentId = aisConsentService.createConsent(request, psuId, tppId);
>>>>>>>
SpiCreateAisConsentRequest createAisConsentRequest = aisConsentMapper.mapToSpiCreateAisConsentRequest(request, psuId, tppId, new AspspConsentData("zzzzzzzzzzzzzz".getBytes()));
String consentId = isNotEmptyAccess(checkedRequest.getAccess())
? consentSpi.createConsent(createAisConsentRequest)
: null;
String consentId = aisConsentService.createConsent(request, psuId, tppId); |
<<<<<<<
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
=======
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
>>>>>>>
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
<<<<<<<
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<SpiPeriodicPayment> getPaymentById(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<SpiPeriodicPayment> getPaymentById(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<SpiPeriodicPayment> getPaymentById(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
default SpiResponse<SpiPeriodicPayment> getPaymentById(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<SpiTransactionStatus> getPaymentStatusById(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<SpiTransactionStatus> getPaymentStatusById(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<SpiTransactionStatus> getPaymentStatusById(@NotNull SpiPsuData psuData, @NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
default SpiResponse<SpiTransactionStatus> getPaymentStatusById(@NotNull SpiPeriodicPayment payment, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<SpiAuthorisationStatus> authorisePsu(@NotNull String psuId, @NotNull String password, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<SpiAuthorisationStatus> authorisePsu(@NotNull SpiPsuData psuData, String password, SpiPeriodicPayment businessObject, AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<SpiAuthorisationStatus> authorisePsu(@NotNull SpiPsuData psuData, String password, SpiPeriodicPayment businessObject, AspspConsentData aspspConsentData) {
default SpiResponse<SpiAuthorisationStatus> authorisePsu(@NotNull String psuId, @NotNull String password, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<List<SpiScaMethod>> requestAvailableScaMethods(@NotNull String psuId, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<List<SpiScaMethod>> requestAvailableScaMethods(@NotNull SpiPsuData psuData, SpiPeriodicPayment businessObject, AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<List<SpiScaMethod>> requestAvailableScaMethods(@NotNull SpiPsuData psuData, SpiPeriodicPayment businessObject, AspspConsentData aspspConsentData) {
default SpiResponse<List<SpiScaMethod>> requestAvailableScaMethods(@NotNull String psuId, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull String psuId, @NotNull SpiScaMethod scaMethod, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull SpiPsuData psuData, @NotNull SpiScaMethod scaMethod, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull SpiPsuData psuData, @NotNull SpiScaMethod scaMethod, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull String psuId, @NotNull SpiScaMethod scaMethod, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<VoidResponse> verifyAuthorisationCodeAndExecuteRequest(@NotNull SpiScaConfirmation spiScaConfirmation, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<VoidResponse> verifyAuthorisationCodeAndExecuteRequest(@NotNull SpiPsuData psuData, @NotNull SpiScaConfirmation spiScaConfirmation, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
@NotNull
default SpiResponse<VoidResponse> verifyAuthorisationCodeAndExecuteRequest(@NotNull SpiPsuData psuData, @NotNull SpiScaConfirmation spiScaConfirmation, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) {
default SpiResponse<VoidResponse> verifyAuthorisationCodeAndExecuteRequest(@NotNull SpiScaConfirmation spiScaConfirmation, @NotNull SpiPeriodicPayment businessObject, @NotNull AspspConsentData aspspConsentData) { |
<<<<<<<
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
=======
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
>>>>>>>
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
<<<<<<<
private static final Logger LOGGER = LoggerFactory.getLogger(AccountController.class);
private final int maxNumberOfCharInTransactionJson;
private final AccountSpi accountSpi;
private final AccountMapper accountMapper;
private final ValueValidatorService validatorService;
=======
private final int maxNumberOfCharInTransactionJson;
private final AccountSpi accountSpi;
private final AccountMapper accountMapper;
private final ValueValidatorService validatorService;
private final JsonConverter jsonConverter;
>>>>>>>
private final int maxNumberOfCharInTransactionJson;
private final AccountSpi accountSpi;
private final AccountMapper accountMapper;
private final ValueValidatorService validatorService;
private final JsonConverter jsonConverter;
<<<<<<<
public ResponseObject<List<Balances>> getBalances(String accountId, boolean psuInvolved) {
List<SpiBalances> spiBalances = accountSpi.readBalances(accountId, psuInvolved);
return Optional.ofNullable(spiBalances)
.map(sb -> new ResponseObject<>(accountMapper.mapFromSpiBalancesList(sb)))
.orElse(new ResponseObject<>(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404)
.text("Wrong account ID"))));
=======
public ResponseObject<List<Balances>> getBalancesList(String accountId, boolean psuInvolved) {
List<SpiBalances> spiBalances = accountSpi.readBalances(accountId, psuInvolved);
return Optional.ofNullable(spiBalances)
.map(sb -> ResponseObject.builder().body(accountMapper.mapFromSpiBalancesList(sb)).build())
.orElse(ResponseObject.builder().fail(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404)
.text("Wrong account ID"))).build());
>>>>>>>
public ResponseObject<List<Balances>> getBalances(String accountId, boolean psuInvolved) {
List<SpiBalances> spiBalances = accountSpi.readBalances(accountId, psuInvolved);
return Optional.ofNullable(spiBalances)
.map(sb -> ResponseObject.builder().body(accountMapper.mapFromSpiBalancesList(sb)).build())
.orElse(ResponseObject.builder().fail(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404)
.text("Wrong account ID"))).build());
<<<<<<<
return new ResponseObject<>(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404)));
=======
return ResponseObject.builder()
.fail(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404))).build();
>>>>>>>
return ResponseObject.builder()
.fail(new MessageError(new TppMessageInformation(ERROR, RESOURCE_UNKNOWN_404))).build();
<<<<<<<
AccountReport accountReport = getAccountReport(accountId, dateFrom, dateTo, transactionId, psuInvolved, withBalance);
return new ResponseObject<>(getReportAccordingMaxSize(accountReport, accountId));
=======
try {
AccountReport accountReport = getAccountReport(accountId, dateFrom, dateTo, transactionId, psuInvolved, withBalance);
return ResponseObject.builder()
.body(getReportAccordingMaxSize(accountReport, accountId)).build();
} catch (ValidationException ex) {
TppMessageInformation tppMessageInformation = new TppMessageInformation(ERROR, MessageCode.FORMAT_ERROR);
tppMessageInformation.setText(ex.getMessage());
return ResponseObject.builder()
.fail(new MessageError(tppMessageInformation)).build();
}
>>>>>>>
AccountReport accountReport = getAccountReport(accountId, dateFrom, dateTo, transactionId, psuInvolved, withBalance);
return ResponseObject.builder()
.body(getReportAccordingMaxSize(accountReport, accountId)).build(); |
<<<<<<<
Xs2aAmount amount = new Xs2aAmount();
amount.setContent(a.getContent().toString());
=======
Amount amount = new Amount();
amount.setAmount(a.getContent().toString());
>>>>>>>
Xs2aAmount amount = new Xs2aAmount();
amount.setAmount(a.getContent().toString());
<<<<<<<
private List<Xs2aBalance> mapToBalancesList(List<SpiAccountBalance> spiBalances) {
=======
public List<SpiAccountReference> mapToSpiAccountReferencesFromDetails(List<SpiAccountDetails> details) {
return Optional.ofNullable(details)
.map(det -> det.stream()
.map(spiDetail -> new SpiAccountReference(
spiDetail.getIban(),
spiDetail.getBban(),
spiDetail.getPan(),
spiDetail.getMaskedPan(),
spiDetail.getMsisdn(),
spiDetail.getCurrency()
))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
}
private List<Balance> mapToBalancesList(List<SpiAccountBalance> spiBalances) {
>>>>>>>
public List<SpiAccountReference> mapToSpiAccountReferencesFromDetails(List<SpiAccountDetails> details) {
return Optional.ofNullable(details)
.map(det -> det.stream()
.map(spiDetail -> new SpiAccountReference(
spiDetail.getIban(),
spiDetail.getBban(),
spiDetail.getPan(),
spiDetail.getMaskedPan(),
spiDetail.getMsisdn(),
spiDetail.getCurrency()
))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
}
private List<Xs2aBalance> mapToBalancesList(List<SpiAccountBalance> spiBalances) {
<<<<<<<
public List<Xs2aAccountDetails> mapToAccountDetailsNoBalances(List<Xs2aAccountDetails> details) {
=======
public List<AccountDetails> mapToAccountDetailsListNoBalances(List<AccountDetails> details) {
>>>>>>>
public List<Xs2aAccountDetails> mapToAccountDetailsNoBalances(List<Xs2aAccountDetails> details) { |
<<<<<<<
/**
* This field contains the limit of an expiration time of redirect url for payment cancellation set in milliseconds
*/
private long paymentCancellationRedirectUrlExpirationTimeMs;
=======
/**
* The limit of an expiration time of not confirmed consent url set in milliseconds
*/
private long notConfirmedConsentExpirationPeriodMs;
/**
* The limit of an expiration time of not confirmed payment url set in milliseconds
*/
private long notConfirmedPaymentExpirationPeriodMs;
/**
* A matrix payment-product/payment-type which allows to choose needed types
*/
private Map<PaymentType, Set<String>> supportedPaymentTypeAndProductMatrix;
>>>>>>>
/**
* The limit of an expiration time of not confirmed consent url set in milliseconds
*/
private long notConfirmedConsentExpirationPeriodMs;
/**
* The limit of an expiration time of not confirmed payment url set in milliseconds
*/
private long notConfirmedPaymentExpirationPeriodMs;
/**
* A matrix payment-product/payment-type which allows to choose needed types
*/
private Map<PaymentType, Set<String>> supportedPaymentTypeAndProductMatrix;
/**
* This field contains the limit of an expiration time of redirect url for payment cancellation set in milliseconds
*/
private long paymentCancellationRedirectUrlExpirationTimeMs; |
<<<<<<<
Optional<Xsa2CreatePisConsentAuthorisationResponse> consentAuthorisation = pisScaAuthorisationService.createConsentAuthorisation(externalPaymentId, PaymentType.PERIODIC);
=======
Optional<Xsa2CreatePisConsentAuthorisationResponse> consentAuthorisation = pisScaAuthorisationService.createConsentAuthorisation(response.getPaymentId(), PaymentType.PERIODIC, paymentInitiationParameters.getPsuData());
>>>>>>>
Optional<Xsa2CreatePisConsentAuthorisationResponse> consentAuthorisation = pisScaAuthorisationService.createConsentAuthorisation(externalPaymentId, PaymentType.PERIODIC, paymentInitiationParameters.getPsuData()); |
<<<<<<<
import javax.validation.ConstraintViolationException;
import javax.validation.ValidationException;
=======
import java.util.ArrayList;
import java.util.Collections;
import java.util.Currency;
>>>>>>>
import javax.validation.ConstraintViolationException;
import javax.validation.ValidationException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Currency;
<<<<<<<
=======
/*
// TODO Make a AccountServiceTest for it
@Test(expected = ConstraintViolationException.class)
>>>>>>>
<<<<<<<
@Test(expected = ValidationException.class)
=======
// TODO Make a AccountServiceTest for it
/*
@Test(expected = ConstraintViolationException.class)
>>>>>>>
@Test(expected = ValidationException.class) |
<<<<<<<
import de.adorsys.psd2.xs2a.spi.domain.payment.response.SpiSinglePaymentInitiateResponse;
=======
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
>>>>>>>
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.payment.response.SpiSinglePaymentInitiateResponse;
<<<<<<<
public SpiResponse<SpiSinglePaymentInitiateResponse> initiatePayment(@NotNull SpiSinglePayment spiSinglePayment, @NotNull AspspConsentData initialAspspConsentData) {
=======
@NotNull
public SpiResponse<SpiSinglePayment> initiatePayment(@NotNull SpiPsuData psuData, @NotNull SpiSinglePayment spiSinglePayment, @NotNull AspspConsentData initialAspspConsentData) {
>>>>>>>
@NotNull
public SpiResponse<SpiSinglePaymentInitiateResponse> initiatePayment(@NotNull SpiPsuData psuData, @NotNull SpiSinglePayment spiSinglePayment, @NotNull AspspConsentData initialAspspConsentData) { |
<<<<<<<
import de.adorsys.psd2.model.ScaStatus;
=======
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiResponseStatusToXs2aMessageErrorCodeMapper;
import de.adorsys.psd2.xs2a.core.sca.ScaStatus;
import de.adorsys.psd2.xs2a.spi.domain.account.SpiAccountConsent;
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiAuthorisationStatus;
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiAuthorizationCodeResult;
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiScaMethod;
import de.adorsys.psd2.xs2a.spi.domain.consent.SpiConsentStatus;
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.service.AisConsentSpi;
>>>>>>>
import de.adorsys.psd2.xs2a.core.sca.ScaStatus;
<<<<<<<
=======
private boolean isPsuAuthenticationStage(AccountConsentAuthorization consentAuthorization) {
return consentAuthorization.getScaStatus() == ScaStatus.STARTED;
}
private boolean isScaMethodSelectionStage(AccountConsentAuthorization consentAuthorization) {
return consentAuthorization.getScaStatus() == ScaStatus.PSUAUTHENTICATED;
}
private boolean isAuthorizationStage(AccountConsentAuthorization consentAuthorization) {
return consentAuthorization.getScaStatus() == ScaStatus.SCAMETHODSELECTED;
}
private boolean isMultipleScaMethods(List<SpiScaMethod> availableMethods) {
return availableMethods.size() > 1;
}
private UpdateConsentPsuDataResponse proceedPsuAuthenticationStage(UpdateConsentPsuDataReq request) {
UpdateConsentPsuDataResponse response = new UpdateConsentPsuDataResponse();
SpiAccountConsent accountConsent = aisConsentService.getAccountConsentById(request.getConsentId());
SpiPsuData psuData = new SpiPsuData(request.getPsuId(), null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/332
SpiResponse<SpiAuthorisationStatus> authorisationStatusSpiResponse = aisConsentSpi.authorisePsu(psuData, request.getPassword(), accountConsent, aisConsentDataService.getAspspConsentDataByConsentId(request.getConsentId()));
aisConsentDataService.updateAspspConsentData(authorisationStatusSpiResponse.getAspspConsentData());
if (authorisationStatusSpiResponse.getPayload() == SpiAuthorisationStatus.FAILURE) {
response.setScaStatus(ScaStatus.FAILED);
return response;
}
response.setPsuId(request.getPsuId());
response.setPassword(request.getPassword());
SpiResponse<List<SpiScaMethod>> spiResponse = aisConsentSpi.requestAvailableScaMethods(psuData, accountConsent, aisConsentDataService.getAspspConsentDataByConsentId(request.getConsentId()));
aisConsentDataService.updateAspspConsentData(authorisationStatusSpiResponse.getAspspConsentData());
List<SpiScaMethod> availableScaMethods = spiResponse.getPayload();
if (CollectionUtils.isNotEmpty(availableScaMethods)) {
if (isMultipleScaMethods(availableScaMethods)) {
proceedResponseForMultipleAvailableMethods(response, availableScaMethods);
} else {
proceedResponseForOneAvailableMethod(response, accountConsent, availableScaMethods, request.getConsentId());
}
} else {
proceedResponseForNoneAvailableScaMethod(response, request.getConsentId());
}
return response;
}
private UpdateConsentPsuDataResponse proceedScaMethodSelectionStage(UpdateConsentPsuDataReq request) {
UpdateConsentPsuDataResponse response = new UpdateConsentPsuDataResponse();
SpiAccountConsent accountConsent = aisConsentService.getAccountConsentById(request.getConsentId());
String authenticationMethodId = request.getAuthenticationMethodId();
SpiPsuData psuData = new SpiPsuData(request.getPsuId(), null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/332
SpiResponse<SpiAuthorizationCodeResult> spiResponse = aisConsentSpi.requestAuthorisationCode(psuData, SpiScaMethod.valueOf(authenticationMethodId), accountConsent, aisConsentDataService.getAspspConsentDataByConsentId(request.getConsentId()));
aisConsentDataService.updateAspspConsentData(spiResponse.getAspspConsentData());
if (spiResponse.hasError()) {
response.setErrorCode(messageErrorCodeMapper.mapToMessageErrorCode(spiResponse.getResponseStatus()));
return response;
}
response.setChosenScaMethod(authenticationMethodId);
response.setScaStatus(ScaStatus.SCAMETHODSELECTED);
response.setResponseLinkType(START_AUTHORISATION_WITH_TRANSACTION_AUTHORISATION);
return response;
}
private UpdateConsentPsuDataResponse proceedAuthorizationStage(UpdateConsentPsuDataReq request) {
UpdateConsentPsuDataResponse response = new UpdateConsentPsuDataResponse();
SpiAccountConsent accountConsent = aisConsentService.getAccountConsentById(request.getConsentId());
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/332
SpiResponse<VoidResponse> spiResponse = aisConsentSpi.verifyScaAuthorisation(psuData, aisConsentMapper.mapToSpiScaConfirmation(request), accountConsent, aisConsentDataService.getAspspConsentDataByConsentId(request.getConsentId()));
aisConsentDataService.updateAspspConsentData(spiResponse.getAspspConsentData());
if (spiResponse.hasError()) {
response.setErrorCode(messageErrorCodeMapper.mapToMessageErrorCode(spiResponse.getResponseStatus()));
return response;
}
response.setScaAuthenticationData(request.getScaAuthenticationData());
response.setScaStatus(ScaStatus.FINALISED);
response.setResponseLinkType(START_AUTHORISATION_WITH_AUTHENTICATION_METHOD_SELECTION);
aisConsentService.updateConsentStatus(request.getConsentId(), SpiConsentStatus.VALID);
return response;
}
private void proceedResponseForMultipleAvailableMethods(UpdateConsentPsuDataResponse response, List<SpiScaMethod> availableScaMethods) {
response.setAvailableScaMethods(aisConsentMapper.mapToCmsScaMethods(availableScaMethods));
response.setScaStatus(ScaStatus.PSUAUTHENTICATED);
response.setResponseLinkType(START_AUTHORISATION_WITH_AUTHENTICATION_METHOD_SELECTION);
}
private void proceedResponseForOneAvailableMethod(UpdateConsentPsuDataResponse response, SpiAccountConsent accountConsent, List<SpiScaMethod> availableScaMethods, String consentId) {
SpiPsuData psuData = new SpiPsuData(response.getPsuId(), null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/332
SpiResponse<SpiAuthorizationCodeResult> spiResponse = aisConsentSpi.requestAuthorisationCode(psuData, availableScaMethods.get(0), accountConsent, aisConsentDataService.getAspspConsentDataByConsentId(consentId));
aisConsentDataService.updateAspspConsentData(spiResponse.getAspspConsentData());
if (spiResponse.hasError()) {
response.setErrorCode(messageErrorCodeMapper.mapToMessageErrorCode(spiResponse.getResponseStatus()));
return;
}
response.setChosenScaMethod(availableScaMethods.get(0).name());
response.setScaStatus(ScaStatus.SCAMETHODSELECTED);
response.setResponseLinkType(START_AUTHORISATION_WITH_TRANSACTION_AUTHORISATION);
}
private void proceedResponseForNoneAvailableScaMethod(UpdateConsentPsuDataResponse response, String consentId) {
response.setScaStatus(ScaStatus.FAILED);
response.setErrorCode(MessageErrorCode.SCA_METHOD_UNKNOWN);
aisConsentService.updateConsentStatus(consentId, SpiConsentStatus.REJECTED);
}
private Optional<CreateConsentAuthorizationResponse> createConsentAuthorizationAndGetResponse(ScaStatus scaStatus, ConsentAuthorizationResponseLinkType linkType, String consentId, String psuId) {
return aisConsentService.createAisConsentAuthorization(consentId, scaStatus, psuId)
.map(authId -> {
CreateConsentAuthorizationResponse resp = new CreateConsentAuthorizationResponse();
resp.setConsentId(consentId);
resp.setAuthorizationId(authId);
resp.setScaStatus(scaStatus);
resp.setResponseLinkType(linkType);
return resp;
});
}
>>>>>>> |
<<<<<<<
private List<SpiSinglePayment> mapToListSpiSinglePayments(@NotNull List<de.adorsys.aspsp.xs2a.spi.domain.payment.SpiSinglePayment> payments, SpiPaymentProduct paymentProduct) {
return payments.stream()
=======
private List<SpiSinglePayment> mapToListSpiSinglePayment(@NotNull de.adorsys.aspsp.xs2a.spi.domain.payment.SpiBulkPayment payment, PaymentProduct paymentProduct) {
return payment.getPayments().stream()
>>>>>>>
private List<SpiSinglePayment> mapToListSpiSinglePayment(@NotNull de.adorsys.aspsp.xs2a.spi.domain.payment.SpiBulkPayment payment, PaymentProduct paymentProduct) {
return payment.getPayments().stream()
private List<SpiSinglePayment> mapToListSpiSinglePayments(@NotNull List<de.adorsys.aspsp.xs2a.spi.domain.payment.SpiSinglePayment> payments, SpiPaymentProduct paymentProduct) {
return payments.stream() |
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataResponse;
=======
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataResponse;
import de.adorsys.aspsp.xs2a.service.authorization.pis.PisAuthorisationService;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aUpdatePisConsentPsuDataResponse;
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataRequest;
import de.adorsys.aspsp.xs2a.domain.consent.pis.Xs2aUpdatePisConsentPsuDataResponse;
import de.adorsys.aspsp.xs2a.service.authorization.pis.PisAuthorisationService;
<<<<<<<
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiToXs2aAuthenticationObjectMapper;
=======
import de.adorsys.aspsp.xs2a.service.mapper.consent.SpiCmsPisMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiErrorMapper;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiToXs2aAuthenticationObjectMapper;
import de.adorsys.aspsp.xs2a.service.mapper.consent.SpiCmsPisMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.SpiErrorMapper;
<<<<<<<
public PisScaFinalisedStage(PaymentAuthorisationSpi paymentAuthorisationSpi, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper, Xs2aPisConsentMapper xs2aPisConsentMapper) {
super(paymentAuthorisationSpi, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiToXs2aAuthenticationObjectMapper, xs2aPisConsentMapper);
=======
public PisScaFinalisedStage(PisAuthorisationService pisAuthorisationService, PaymentAuthorisationSpi paymentAuthorisationSpi, SpiCmsPisMapper spiCmsPisMapper, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiErrorMapper spiErrorMapper) {
super(pisAuthorisationService, paymentAuthorisationSpi, spiCmsPisMapper, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiErrorMapper);
>>>>>>>
public PisScaFinalisedStage(PaymentAuthorisationSpi paymentAuthorisationSpi, PisConsentDataService pisConsentDataService, CmsToXs2aPaymentMapper cmsToXs2aPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper, Xs2aToSpiSinglePaymentMapper xs2aToSpiSinglePaymentMapper, Xs2aToSpiBulkPaymentMapper xs2aToSpiBulkPaymentMapper, SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper, Xs2aPisConsentMapper xs2aPisConsentMapper) {
super(paymentAuthorisationSpi, pisConsentDataService, cmsToXs2aPaymentMapper, xs2aToSpiPeriodicPaymentMapper, xs2aToSpiSinglePaymentMapper, xs2aToSpiBulkPaymentMapper, spiToXs2aAuthenticationObjectMapper, xs2aPisConsentMapper); |
<<<<<<<
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
=======
import de.adorsys.psd2.xs2a.core.consent.ConsentStatus;
>>>>>>>
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
import de.adorsys.psd2.xs2a.core.consent.ConsentStatus; |
<<<<<<<
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData());
SpiResponse<SpiSinglePaymentInitiationResponse> response = singlePaymentSpi.initiatePayment(spiPsuData, xs2AToSpiSinglePaymentMapper.mapToSpiSinglePayment(payment, paymentProduct), aspspConsentData);
=======
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/458
>>>>>>>
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData());
<<<<<<<
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData());
SpiResponse<SpiPeriodicPaymentInitiationResponse> response = periodicPaymentSpi.initiatePayment(spiPsuData, xs2aToSpiPeriodicPaymentMapper.mapToSpiPeriodicPayment(payment, paymentProduct), aspspConsentData);
=======
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/458
>>>>>>>
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData());
<<<<<<<
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData());
SpiResponse<SpiBulkPaymentInitiationResponse> response = bulkPaymentSpi.initiatePayment(spiPsuData, xs2aToSpiBulkPaymentMapper.mapToSpiBulkPayment(bulkPayment, paymentProduct), aspspConsentData);
=======
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/458
>>>>>>>
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(pisConsent.getPsuData()); |
<<<<<<<
import de.adorsys.psd2.consent.server.service.security.DecryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService;
=======
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
>>>>>>>
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
import de.adorsys.psd2.consent.server.service.security.DecryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService; |
<<<<<<<
public ResponseObject<AccountReport> getAccountReport(String consentId, String accountId, LocalDate dateFrom,
LocalDate dateTo, String transactionId, boolean psuInvolved,
Xs2aBookingStatus bookingStatus, boolean withBalance, boolean deltaList) {
ResponseObject<AccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
=======
public ResponseObject<Xs2aAccountReport> getAccountReport(String consentId, String accountId, LocalDate dateFrom,
LocalDate dateTo, String transactionId, boolean psuInvolved,
BookingStatus bookingStatus, boolean withBalance, boolean deltaList) {
ResponseObject<Xs2aAccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
>>>>>>>
public ResponseObject<Xs2aAccountReport> getAccountReport(String consentId, String accountId, LocalDate dateFrom,
LocalDate dateTo, String transactionId, boolean psuInvolved,
Xs2aBookingStatus bookingStatus, boolean withBalance, boolean deltaList) {
ResponseObject<Xs2aAccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
<<<<<<<
public ResponseObject<AccountReport> getAccountReportByPeriod(String consentId, String accountId, LocalDate dateFrom,
LocalDate dateTo, Xs2aBookingStatus bookingStatus, boolean withBalance) {
ResponseObject<AccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
=======
public ResponseObject<Xs2aAccountReport> getAccountReportByPeriod(String accountId, boolean withBalance, String consentId, LocalDate dateFrom,
LocalDate dateTo, BookingStatus bookingStatus) {
ResponseObject<Xs2aAccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
>>>>>>>
public ResponseObject<Xs2aAccountReport> getAccountReportByPeriod(String accountId, boolean withBalance, String consentId, LocalDate dateFrom,
LocalDate dateTo, Xs2aBookingStatus bookingStatus) {
ResponseObject<Xs2aAccountAccess> allowedAccountData = consentService.getValidatedConsent(consentId);
<<<<<<<
private Optional<AccountReport> getAccountReport(String accountId, LocalDate dateFrom, LocalDate dateTo, String transactionId,
Xs2aBookingStatus bookingStatus) {
=======
private Optional<Xs2aAccountReport> getAccountReport(String accountId, LocalDate dateFrom, LocalDate dateTo, String transactionId,
BookingStatus bookingStatus) {
>>>>>>>
private Optional<Xs2aAccountReport> getAccountReport(String accountId, LocalDate dateFrom, LocalDate dateTo, String transactionId,
Xs2aBookingStatus bookingStatus) {
<<<<<<<
private AccountReport filterByBookingStatus(AccountReport report, Xs2aBookingStatus bookingStatus) {
return new AccountReport(
EnumSet.of(Xs2aBookingStatus.BOOKED, Xs2aBookingStatus.BOTH).contains(bookingStatus)
=======
private Xs2aAccountReport filterByBookingStatus(Xs2aAccountReport report, BookingStatus bookingStatus) {
return new Xs2aAccountReport(
EnumSet.of(BookingStatus.BOOKED, BookingStatus.BOTH).contains(bookingStatus)
>>>>>>>
private Xs2aAccountReport filterByBookingStatus(Xs2aAccountReport report, Xs2aBookingStatus bookingStatus) {
return new Xs2aAccountReport(
EnumSet.of(Xs2aBookingStatus.BOOKED, Xs2aBookingStatus.BOTH).contains(bookingStatus) |
<<<<<<<
private static final boolean ALL_PSD_2_SUPPORT = false;
=======
private static final int CONSENT_LIFETIME = 0;
private static final int TRANSACTION_LIFETIME = 0;
>>>>>>>
private static final int CONSENT_LIFETIME = 0;
private static final int TRANSACTION_LIFETIME = 0;
private static final boolean ALL_PSD_2_SUPPORT = false;
<<<<<<<
when(profileConfiguration.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
=======
when(profileConfiguration.getConsentLifetime())
.thenReturn(CONSENT_LIFETIME);
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
>>>>>>>
when(profileConfiguration.getConsentLifetime())
.thenReturn(CONSENT_LIFETIME);
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
when(profileConfiguration.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
<<<<<<<
@Test
public void getAllPsd2Support() {
//When:
Boolean actualResponse = aspspProfileService.isAllPsd2Support();
//Then:
assertThat(actualResponse).isEqualTo(ALL_PSD_2_SUPPORT);
}
=======
@Test
public void getConsentLifetime() {
//When:
int actualResponse = aspspProfileService.getConsentLifetime();
//Then:
assertThat(actualResponse).isEqualTo(CONSENT_LIFETIME);
}
@Test
public void getTransactionLifetime() {
//When:
int actualResponse = aspspProfileService.getTransactionLifetime();
//Then:
assertThat(actualResponse).isEqualTo(TRANSACTION_LIFETIME);
}
>>>>>>>
@Test
public void getConsentLifetime() {
//When:
int actualResponse = aspspProfileService.getConsentLifetime();
//Then:
assertThat(actualResponse).isEqualTo(CONSENT_LIFETIME);
}
@Test
public void getTransactionLifetime() {
//When:
int actualResponse = aspspProfileService.getTransactionLifetime();
//Then:
assertThat(actualResponse).isEqualTo(TRANSACTION_LIFETIME);
}
@Test
public void getAllPsd2Support() {
//When:
Boolean actualResponse = aspspProfileService.isAllPsd2Support();
//Then:
assertThat(actualResponse).isEqualTo(ALL_PSD_2_SUPPORT);
} |
<<<<<<<
@ApiImplicitParams({
@ApiImplicitParam(name = "consent-id", value = "7f53031f-3cd8-4270-b07f-4ea1456ba124", required = true, dataType = "UUID", paramType = "header"),
@ApiImplicitParam(name = "tpp-transaction-id", value = "16d40f49-a110-4344-a949-f99828ae13c9", required = true, dataType = "UUID", paramType = "header"),
@ApiImplicitParam(name = "tpp-request-id", value = "21d40f65-a150-8343-b539-b9a822ae98c0", required = true, dataType = "UUID", paramType = "header")})
public ResponseEntity<Balances> getBalances(
@PathVariable(name = "account-id", required = true) @NotNull String accountId,
=======
public ResponseEntity<List<Balances>> getBalances(
@PathVariable(name = "account-id", required = true) String accountId,
>>>>>>>
@ApiImplicitParams({
@ApiImplicitParam(name = "consent-id", value = "7f53031f-3cd8-4270-b07f-4ea1456ba124", required = true, dataType = "UUID", paramType = "header"),
@ApiImplicitParam(name = "tpp-transaction-id", value = "16d40f49-a110-4344-a949-f99828ae13c9", required = true, dataType = "UUID", paramType = "header"),
@ApiImplicitParam(name = "tpp-request-id", value = "21d40f65-a150-8343-b539-b9a822ae98c0", required = true, dataType = "UUID", paramType = "header")})
public ResponseEntity<List<Balances>> getBalances(
@PathVariable(name = "account-id", required = true) String accountId, |
<<<<<<<
private String getTppId() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.map(authentication -> (HashMap<String, String>) authentication.getCredentials())
.map(credentials -> credentials.get("authorityId"))
.orElse("This is a test TppId");
}
private void proceedEmbeddedImplicitCaseForCreateConsent(CreateConsentResponse response, String psuId, String consentId) {
aisAuthorizationService.createConsentAuthorization(psuId, consentId)
.ifPresent(a -> {
response.setAuthorizationId(a.getAuthorizationId());
});
}
=======
>>>>>>>
private void proceedEmbeddedImplicitCaseForCreateConsent(CreateConsentResponse response, String psuId, String consentId) {
aisAuthorizationService.createConsentAuthorization(psuId, consentId)
.ifPresent(a -> {
response.setAuthorizationId(a.getAuthorizationId());
});
} |
<<<<<<<
public RedirectScaPaymentService(PaymentSpi paymentSpi, PaymentMapper paymentMapper, SinglePaymentSpi singlePaymentSpi, PeriodicPaymentSpi periodicPaymentSpi, Xs2aToSpiPaymentMapper xs2aToSpiPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper) {
super(paymentSpi, paymentMapper, singlePaymentSpi, periodicPaymentSpi, xs2aToSpiPaymentMapper, xs2aToSpiPeriodicPaymentMapper);
=======
public RedirectScaPaymentService(PaymentSpi paymentSpi, PaymentMapper paymentMapper, SinglePaymentSpi singlePaymentSpi, Xs2aToSpiPaymentMapper xs2aToSpiPaymentMapper, SpiToXs2aPaymentMapper spiToXs2aPaymentMapper) {
super(paymentSpi, paymentMapper, singlePaymentSpi, xs2aToSpiPaymentMapper, spiToXs2aPaymentMapper);
>>>>>>>
public RedirectScaPaymentService(PaymentSpi paymentSpi, PaymentMapper paymentMapper, SinglePaymentSpi singlePaymentSpi, Xs2aToSpiPaymentMapper xs2aToSpiPaymentMapper, SpiToXs2aPaymentMapper spiToXs2aPaymentMapper) {
super(paymentSpi, paymentMapper, singlePaymentSpi, xs2aToSpiPaymentMapper, spiToXs2aPaymentMapper);
public RedirectScaPaymentService(PaymentSpi paymentSpi, PaymentMapper paymentMapper, SinglePaymentSpi singlePaymentSpi, PeriodicPaymentSpi periodicPaymentSpi, Xs2aToSpiPaymentMapper xs2aToSpiPaymentMapper, Xs2aToSpiPeriodicPaymentMapper xs2aToSpiPeriodicPaymentMapper) {
super(paymentSpi, paymentMapper, singlePaymentSpi, periodicPaymentSpi, xs2aToSpiPaymentMapper, xs2aToSpiPeriodicPaymentMapper); |
<<<<<<<
String internalPaymentId = pisConsentDataService.getInternalPaymentIdByEncryptedString(paymentId);
payment.setPaymentId(internalPaymentId);
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/458
SpiResponse<SpiSinglePayment> spiResponse = singlePaymentSpi.getPaymentById(psuData, payment, pisConsentDataService.getAspspConsentDataByPaymentId(paymentId));
=======
payment.setPaymentId(paymentId);
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(psuData);
SpiResponse<SpiSinglePayment> spiResponse = singlePaymentSpi.getPaymentById(spiPsuData, payment, pisConsentDataService.getAspspConsentDataByPaymentId(paymentId));
>>>>>>>
String internalPaymentId = pisConsentDataService.getInternalPaymentIdByEncryptedString(paymentId);
payment.setPaymentId(internalPaymentId);
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(psuData);
SpiResponse<SpiSinglePayment> spiResponse = singlePaymentSpi.getPaymentById(spiPsuData, payment, pisConsentDataService.getAspspConsentDataByPaymentId(paymentId)); |
<<<<<<<
private static final boolean ALL_PSD_2_SUPPORT = false;
=======
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
>>>>>>>
private static final boolean ALL_PSD_2_SUPPORT = false;
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
<<<<<<<
when(aspspProfileService.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
=======
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
>>>>>>>
when(aspspProfileService.isAllPsd2Support())
.thenReturn(ALL_PSD_2_SUPPORT);
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
<<<<<<<
@Test
public void getAllPsd2Support() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getAllPsd2Support();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(ALL_PSD_2_SUPPORT);
}
=======
@Test
public void getBankOfferedConsentSupport() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getBankOfferedConsentSupport();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
}
>>>>>>>
@Test
public void getAllPsd2Support() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getAllPsd2Support();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(ALL_PSD_2_SUPPORT);
}
@Test
public void getBankOfferedConsentSupport() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getBankOfferedConsentSupport();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
} |
<<<<<<<
import de.adorsys.aspsp.xs2a.service.validator.RequestValidatorService;
import de.adorsys.aspsp.xs2a.service.validator.parameter.ParametersFactory;
import de.adorsys.aspsp.xs2a.web.interceptor.HandlerInterceptor;
import org.springframework.beans.factory.annotation.Value;
=======
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.validator.RequestValidatorService;
import de.adorsys.aspsp.xs2a.service.validator.parameter.ParametersFactory;
import de.adorsys.aspsp.xs2a.web.interceptor.HandlerInterceptor;
import org.springframework.beans.factory.annotation.Value;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; |
<<<<<<<
String internalPaymentId = pisConsentDataService.getInternalPaymentIdByEncryptedString(paymentId);
SpiPsuData psuData = new SpiPsuData(null, null, null, null); // TODO get it from XS2A Interface https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/458
=======
PsuIdData psuData = pisPsuDataService.getPsuDataByPaymentId(paymentId);
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(psuData);
>>>>>>>
PsuIdData psuData = pisPsuDataService.getPsuDataByPaymentId(paymentId);
String internalPaymentId = pisConsentDataService.getInternalPaymentIdByEncryptedString(paymentId);
SpiPsuData spiPsuData = psuDataMapper.mapToSpiPsuData(psuData);
<<<<<<<
payment.setPaymentId(internalPaymentId);
spiResponse = singlePaymentSpi.getPaymentStatusById(psuData, payment, aspspConsentData);
=======
payment.setPaymentId(paymentId);
spiResponse = singlePaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData);
>>>>>>>
payment.setPaymentId(internalPaymentId);
spiResponse = singlePaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData);
<<<<<<<
payment.setPaymentId(internalPaymentId);
spiResponse = periodicPaymentSpi.getPaymentStatusById(psuData, payment, aspspConsentData);
=======
payment.setPaymentId(paymentId);
spiResponse = periodicPaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData);
>>>>>>>
payment.setPaymentId(internalPaymentId);
spiResponse = periodicPaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData);
<<<<<<<
payment.setPaymentId(internalPaymentId);
spiResponse = bulkPaymentSpi.getPaymentStatusById(psuData, payment, aspspConsentData);
=======
payment.setPaymentId(paymentId);
spiResponse = bulkPaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData);
>>>>>>>
payment.setPaymentId(internalPaymentId);
spiResponse = bulkPaymentSpi.getPaymentStatusById(spiPsuData, payment, aspspConsentData); |
<<<<<<<
/**
* Updates consent authorization
*
* @param authorizationId String representation of the authorisation identifier
* @param request Incoming request for updating authorization
* @param authorizationType Type of authorisation
* @return Response containing SCA status, available and chosen Sca method
*/
Optional<UpdatePisConsentPsuDataResponse> updateConsentAuthorization(String authorizationId, UpdatePisConsentPsuDataRequest request, CmsAuthorisationType authorizationType);
=======
Optional<UpdatePisConsentPsuDataResponse> updateConsentAuthorisation(String authorisationId, UpdatePisConsentPsuDataRequest request);
Optional<UpdatePisConsentPsuDataResponse> updateConsentCancellationAuthorisation(String authorizationId, UpdatePisConsentPsuDataRequest request);
>>>>>>>
/**
* Updates consent authorization
*
* @param authorizationId String representation of the authorisation identifier
* @param request Incoming request for updating authorization
* @return Response containing SCA status, available and chosen Sca method
*/
Optional<UpdatePisConsentPsuDataResponse> updateConsentAuthorisation(String authorisationId, UpdatePisConsentPsuDataRequest request);
Optional<UpdatePisConsentPsuDataResponse> updateConsentCancellationAuthorisation(String authorizationId, UpdatePisConsentPsuDataRequest request);
<<<<<<<
/**
* Get information about Authorisation by authorisation identifier
*
* @param authorizationId String representation of the authorisation identifier
* @param authorizationType Type of authorisation
* @return Response containing information about Authorisation
*/
Optional<GetPisConsentAuthorisationResponse> getPisConsentAuthorizationById(String authorizationId, CmsAuthorisationType authorizationType);
=======
Optional<GetPisConsentAuthorisationResponse> getPisConsentAuthorisationById(String authorisationId);
Optional<GetPisConsentAuthorisationResponse> getPisConsentCancellationAuthorisationById(String cancellationId);
>>>>>>>
/**
* Get information about Authorisation by authorisation identifier
*
* @param authorizationId String representation of the authorisation identifier
* @return Response containing information about Authorisation
*/
Optional<GetPisConsentAuthorisationResponse> getPisConsentAuthorisationById(String authorisationId);
/**
* Get information about Authorisation by cancellation identifier
*
* @param cancellationId String representation of the cancellation identifier
* @return Response containing information about Authorisation
*/
Optional<GetPisConsentAuthorisationResponse> getPisConsentCancellationAuthorisationById(String cancellationId); |
<<<<<<<
import de.adorsys.psd2.model.*;
import org.apache.commons.lang3.StringUtils;
=======
import de.adorsys.psd2.model.*;
import lombok.extern.slf4j.Slf4j;
>>>>>>>
import de.adorsys.psd2.model.*;
import lombok.extern.slf4j.Slf4j;
<<<<<<<
import javax.validation.Valid;
import java.util.Currency;
import java.util.List;
import java.util.Map;
import java.util.Optional;
=======
>>>>>>>
import javax.validation.Valid;
import java.util.Currency;
import java.util.List;
import java.util.Map;
import java.util.Optional;
<<<<<<<
AccountList accountList = new AccountList();
accountDetailsList.forEach((s, accountDetails) -> {
de.adorsys.psd2.model.AccountDetails detailsTarget = new de.adorsys.psd2.model.AccountDetails();
BeanUtils.copyProperties(accountDetails, detailsTarget);
accountList.addAccountsItem(detailsTarget);
});
return accountList;
=======
List<de.adorsys.psd2.model.AccountDetails> details = accountDetailsList.values().stream()
.flatMap(accountDetails -> accountDetails.stream().map(AccountModelMapper::mapToAccountDetails))
.collect(Collectors.toList());
return new AccountList().accounts(details);
>>>>>>>
List<de.adorsys.psd2.model.AccountDetails> details = accountDetailsList.values().stream()
.flatMap(accountDetails -> accountDetails.stream().map(AccountModelMapper::mapToAccountDetails))
.collect(Collectors.toList());
return new AccountList().accounts(details);
<<<<<<<
public static <T> T mapToAccountReference12(AccountReference reference) {
T accountReference = null;
if (StringUtils.isNotBlank(reference.getIban())) {
accountReference = (T) new AccountReferenceIban().iban(reference.getIban());
((AccountReferenceIban) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getBban())) {
accountReference = (T) new AccountReferenceBban().bban(reference.getBban());
((AccountReferenceBban) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getPan())) {
accountReference = (T) new AccountReferencePan().pan(reference.getPan());
((AccountReferencePan) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getMaskedPan())) {
accountReference = (T) new AccountReferenceMaskedPan().maskedPan(reference.getMaskedPan());
((AccountReferenceMaskedPan) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getMsisdn())) {
accountReference = (T) new AccountReferenceMsisdn().msisdn(reference.getMsisdn());
((AccountReferenceMsisdn) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
}
return accountReference;
}
public static Address mapToAddress12(de.adorsys.aspsp.xs2a.domain.address.Address address) {
Address targetAddress = new Address().street(address.getStreet());
targetAddress.setStreet(address.getStreet());
targetAddress.setBuildingNumber(address.getBuildingNumber());
targetAddress.setCity(address.getCity());
targetAddress.setPostalCode(address.getPostalCode());
targetAddress.setCountry(address.getCountry().getCode());
return targetAddress;
}
public static de.adorsys.aspsp.xs2a.domain.address.Address mapToXs2aAddress(@Valid Address address) {
return Optional.ofNullable(address)
.map(a -> {
de.adorsys.aspsp.xs2a.domain.address.Address targetAddress = new de.adorsys.aspsp.xs2a.domain.address.Address();
targetAddress.setStreet(a.getStreet());
targetAddress.setBuildingNumber(a.getBuildingNumber());
targetAddress.setCity(a.getCity());
targetAddress.setPostalCode(a.getPostalCode());
de.adorsys.aspsp.xs2a.domain.address.CountryCode code = new de.adorsys.aspsp.xs2a.domain.address.CountryCode();
code.setCode(a.getCountry());
targetAddress.setCountry(code);
return targetAddress;
})
.orElse(new de.adorsys.aspsp.xs2a.domain.address.Address());
}
public static de.adorsys.aspsp.xs2a.domain.Amount mapToXs2aAmount(@Valid Amount amount) {
return Optional.ofNullable(amount)
.map(a -> {
de.adorsys.aspsp.xs2a.domain.Amount targetAmount = new de.adorsys.aspsp.xs2a.domain.Amount();
targetAmount.setContent(a.getAmount());
targetAmount.setCurrency(Currency.getInstance(a.getCurrency()));
return targetAmount;
})
.orElse(new de.adorsys.aspsp.xs2a.domain.Amount());
}
=======
private static Object createAccountObject(AccountReference accountReference) {
return Optional.ofNullable(accountReference)
.map(account -> {
if (account.getIban() != null) {
return new AccountReferenceIban()
.iban(accountReference.getIban())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getBban() != null) {
return new AccountReferenceBban()
.bban(accountReference.getBban())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getPan() != null) {
return new AccountReferencePan()
.pan(accountReference.getPan())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getMsisdn() != null) {
return new AccountReferenceMsisdn()
.msisdn(accountReference.getMsisdn())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getMaskedPan() != null) {
return new AccountReferenceMaskedPan()
.maskedPan(accountReference.getMaskedPan())
.currency(getCurrencyFromAccountReference(accountReference));
}
return null;
})
.orElse(null);
}
private static String getCurrencyFromAccountReference(AccountReference accountReference) {
return Optional.ofNullable(accountReference.getCurrency())
.map(Currency::getCurrencyCode)
.orElse(null);
}
>>>>>>>
public static <T> T mapToAccountReference12(AccountReference reference) {
T accountReference = null;
if (StringUtils.isNotBlank(reference.getIban())) {
accountReference = (T) new AccountReferenceIban().iban(reference.getIban());
((AccountReferenceIban) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getBban())) {
accountReference = (T) new AccountReferenceBban().bban(reference.getBban());
((AccountReferenceBban) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getPan())) {
accountReference = (T) new AccountReferencePan().pan(reference.getPan());
((AccountReferencePan) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getMaskedPan())) {
accountReference = (T) new AccountReferenceMaskedPan().maskedPan(reference.getMaskedPan());
((AccountReferenceMaskedPan) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
} else if (StringUtils.isNotBlank(reference.getMsisdn())) {
accountReference = (T) new AccountReferenceMsisdn().msisdn(reference.getMsisdn());
((AccountReferenceMsisdn) accountReference).setCurrency(reference.getCurrency().getCurrencyCode());
}
return accountReference;
}
public static Address mapToAddress12(de.adorsys.aspsp.xs2a.domain.address.Address address) {
Address targetAddress = new Address().street(address.getStreet());
targetAddress.setStreet(address.getStreet());
targetAddress.setBuildingNumber(address.getBuildingNumber());
targetAddress.setCity(address.getCity());
targetAddress.setPostalCode(address.getPostalCode());
targetAddress.setCountry(address.getCountry().getCode());
return targetAddress;
}
public static de.adorsys.aspsp.xs2a.domain.address.Address mapToXs2aAddress(@Valid Address address) {
return Optional.ofNullable(address)
.map(a -> {
de.adorsys.aspsp.xs2a.domain.address.Address targetAddress = new de.adorsys.aspsp.xs2a.domain.address.Address();
targetAddress.setStreet(a.getStreet());
targetAddress.setBuildingNumber(a.getBuildingNumber());
targetAddress.setCity(a.getCity());
targetAddress.setPostalCode(a.getPostalCode());
de.adorsys.aspsp.xs2a.domain.address.CountryCode code = new de.adorsys.aspsp.xs2a.domain.address.CountryCode();
code.setCode(a.getCountry());
targetAddress.setCountry(code);
return targetAddress;
})
.orElse(new de.adorsys.aspsp.xs2a.domain.address.Address());
}
public static de.adorsys.aspsp.xs2a.domain.Amount mapToXs2aAmount(@Valid Amount amount) {
return Optional.ofNullable(amount)
.map(a -> {
de.adorsys.aspsp.xs2a.domain.Amount targetAmount = new de.adorsys.aspsp.xs2a.domain.Amount();
targetAmount.setContent(a.getAmount());
targetAmount.setCurrency(Currency.getInstance(a.getCurrency()));
return targetAmount;
})
.orElse(new de.adorsys.aspsp.xs2a.domain.Amount());
}
private static Object createAccountObject(AccountReference accountReference) {
return Optional.ofNullable(accountReference)
.map(account -> {
if (account.getIban() != null) {
return new AccountReferenceIban()
.iban(accountReference.getIban())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getBban() != null) {
return new AccountReferenceBban()
.bban(accountReference.getBban())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getPan() != null) {
return new AccountReferencePan()
.pan(accountReference.getPan())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getMsisdn() != null) {
return new AccountReferenceMsisdn()
.msisdn(accountReference.getMsisdn())
.currency(getCurrencyFromAccountReference(accountReference));
} else if (account.getMaskedPan() != null) {
return new AccountReferenceMaskedPan()
.maskedPan(accountReference.getMaskedPan())
.currency(getCurrencyFromAccountReference(accountReference));
}
return null;
})
.orElse(null);
}
private static String getCurrencyFromAccountReference(AccountReference accountReference) {
return Optional.ofNullable(accountReference.getCurrency())
.map(Currency::getCurrencyCode)
.orElse(null);
} |
<<<<<<<
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.EnumSet;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
=======
import java.util.*;
import java.util.stream.Collectors;
>>>>>>>
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
<<<<<<<
private final AspspProfileService aspspProfileService;
=======
private final TppInfoMapper tppInfoMapper;
>>>>>>>
private final AspspProfileService aspspProfileService;
private final TppInfoMapper tppInfoMapper; |
<<<<<<<
private static final boolean EXPLICIT_PREFERRED = true;
=======
private static final boolean SIGNING_BASKET_SUPPORTED = true;
private static final boolean PAYMENT_CANCELLATION_AUTHORIZATION_MANDATED = false;
>>>>>>>
private static final boolean SIGNING_BASKET_SUPPORTED = true;
private static final boolean PAYMENT_CANCELLATION_AUTHORIZATION_MANDATED = false;
private static final boolean EXPLICIT_PREFERRED = true;
<<<<<<<
TRANSACTIONS_WITHOUT_BALANCES_SUPPORTED,
EXPLICIT_PREFERRED);
=======
TRANSACTIONS_WITHOUT_BALANCES_SUPPORTED,
SIGNING_BASKET_SUPPORTED,
PAYMENT_CANCELLATION_AUTHORIZATION_MANDATED);
>>>>>>>
TRANSACTIONS_WITHOUT_BALANCES_SUPPORTED,
SIGNING_BASKET_SUPPORTED,
PAYMENT_CANCELLATION_AUTHORIZATION_MANDATED,
EXPLICIT_PREFERRED); |
<<<<<<<
import de.adorsys.aspsp.xs2a.consent.api.pis.PisConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisBulkPaymentConsentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisPeriodicPaymentConsentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisSinglePaymentConsentRequest;
=======
import de.adorsys.aspsp.xs2a.consent.api.ConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentBulkPaymentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentPeriodicPaymentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentRequest;
>>>>>>>
import de.adorsys.aspsp.xs2a.consent.api.pis.PisConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisBulkPaymentConsentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisPeriodicPaymentConsentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisSinglePaymentConsentRequest;
import de.adorsys.aspsp.xs2a.consent.api.ConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentBulkPaymentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentPeriodicPaymentRequest;
import de.adorsys.aspsp.xs2a.consent.api.pis.proto.PisConsentRequest; |
<<<<<<<
import de.adorsys.aspsp.xs2a.consent.api.pis.PisConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.PisPaymentService;
=======
import de.adorsys.aspsp.xs2a.consent.api.ConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.PisConsentType;
>>>>>>>
import de.adorsys.aspsp.xs2a.consent.api.pis.PisConsentStatus;
import de.adorsys.aspsp.xs2a.consent.api.pis.PisPaymentService;
<<<<<<<
private PisPaymentService pisPaymentService;
private PisConsentStatus pisConsentStatus;
=======
private PisConsentType pisConsentType;
private ConsentStatus consentStatus;
>>>>>>>
private ConsentStatus consentStatus;
private PisPaymentService pisPaymentService; |
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.account.AccountReport;
import de.adorsys.aspsp.xs2a.domain.consent.AccountAccess;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aAccountAccessType;
=======
import de.adorsys.aspsp.xs2a.domain.account.Xs2aAccountReport;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aAccountAccess;
import de.adorsys.aspsp.xs2a.domain.consent.AccountAccessType;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.account.Xs2aAccountReport;
import de.adorsys.aspsp.xs2a.domain.consent.Xs2aAccountAccess;
<<<<<<<
private AccountAccess getAccessForMock(List<AccountReference> accounts, List<AccountReference> balances, List<AccountReference> transactions, boolean allAccounts, boolean allPsd2) {
return new AccountAccess(accounts, balances, transactions, allAccounts ? Xs2aAccountAccessType.ALL_ACCOUNTS : null, allPsd2 ? Xs2aAccountAccessType.ALL_ACCOUNTS : null);
=======
private Xs2aAccountAccess getAccessForMock(List<AccountReference> accounts, List<AccountReference> balances, List<AccountReference> transactions, boolean allAccounts, boolean allPsd2) {
return new Xs2aAccountAccess(accounts, balances, transactions, allAccounts ? AccountAccessType.ALL_ACCOUNTS : null, allPsd2 ? AccountAccessType.ALL_ACCOUNTS : null);
>>>>>>>
private Xs2aAccountAccess getAccessForMock(List<AccountReference> accounts, List<AccountReference> balances, List<AccountReference> transactions, boolean allAccounts, boolean allPsd2) {
return new Xs2aAccountAccess(accounts, balances, transactions, allAccounts ? AccountAccessType.ALL_ACCOUNTS : null, allPsd2 ? AccountAccessType.ALL_ACCOUNTS : null); |
<<<<<<<
import de.adorsys.aspsp.xs2a.spi.domain.account.SpiAccountDetails;
import de.adorsys.aspsp.xs2a.spi.domain.consent.AspspConsentData;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiScaStatus;
import de.adorsys.aspsp.xs2a.spi.service.AccountSpi;
=======
>>>>>>>
import de.adorsys.aspsp.xs2a.spi.domain.account.SpiAccountDetails;
import de.adorsys.aspsp.xs2a.spi.domain.consent.AspspConsentData;
import de.adorsys.aspsp.xs2a.spi.domain.consent.SpiScaStatus;
import de.adorsys.aspsp.xs2a.spi.service.AccountSpi;
<<<<<<<
String consentId = isNotEmptyAccess(checkedRequest.getAccess())
? aisConsentService.createConsent(checkedRequest, psuId, tppId)
: null;
=======
String consentId = aisConsentService.createConsent(request, psuId, tppId);
>>>>>>>
String consentId = isNotEmptyAccess(checkedRequest.getAccess())
? aisConsentService.createConsent(checkedRequest, psuId, tppId)
: null;
<<<<<<<
private AccountAccess getNecessaryAccess(CreateConsentReq request, String psuId) {
return isAllAccountsRequest(request) && psuId != null
? getAccessByPsuId(AccountAccessType.ALL_ACCOUNTS == request.getAccess().getAllPsd2(), psuId)
: getAccessByRequestedAccess(request.getAccess());
}
private Set<String> getIbansFromAccountReference(List<AccountReference> references) {
return Optional.ofNullable(references)
.map(list -> list.stream()
.map(AccountReference::getIban)
.collect(Collectors.toSet()))
.orElseGet(Collections::emptySet);
}
=======
>>>>>>>
private AccountAccess getNecessaryAccess(CreateConsentReq request, String psuId) {
return isAllAccountsRequest(request) && psuId != null
? getAccessByPsuId(AccountAccessType.ALL_ACCOUNTS == request.getAccess().getAllPsd2(), psuId)
: getAccessByRequestedAccess(request.getAccess());
}
private Set<String> getIbansFromAccountReference(List<AccountReference> references) {
return Optional.ofNullable(references)
.map(list -> list.stream()
.map(AccountReference::getIban)
.collect(Collectors.toSet()))
.orElseGet(Collections::emptySet);
}
<<<<<<<
private AccountAccess getAccessByRequestedAccess(AccountAccess requestedAccess) {
Set<String> ibansFromAccess = getIbansFromAccess(requestedAccess);
List<SpiAccountDetails> accountDetailsList = accountSpi.readAccountDetailsByIbans(
ibansFromAccess,
new AspspConsentData("zzzzzzzzzzzzzz".getBytes())).getPayload();
List<AccountReference> aspspReferences = accountMapper.mapToAccountReferencesFromDetails(accountDetailsList); // TODO https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/191 Put a real data here
List<AccountReference> balances = getFilteredReferencesByAccessReferences(requestedAccess.getBalances(), aspspReferences);
List<AccountReference> transaction = getRequestedReferences(requestedAccess.getTransactions(), aspspReferences);
List<AccountReference> accounts = getRequestedReferences(requestedAccess.getAccounts(), aspspReferences);
return new AccountAccess(getAccountsForAccess(balances, transaction, accounts), balances, transaction, null, null);
}
private List<AccountReference> getFilteredReferencesByAccessReferences(List<AccountReference> requestedReferences, List<AccountReference> refs) {
return Optional.ofNullable(requestedReferences)
.map(reqRefs -> getRequestedReferences(reqRefs, refs))
.orElseGet(Collections::emptyList);
}
private List<AccountReference> getAccountsForAccess(List<AccountReference> balances, List<AccountReference> transactions, List<AccountReference> accounts) {
accounts.removeAll(balances);
accounts.addAll(balances);
accounts.removeAll(transactions);
accounts.addAll(transactions);
return accounts;
}
private List<AccountReference> getRequestedReferences(List<AccountReference> requestedRefs, List<AccountReference> refs) {
return Optional.ofNullable(requestedRefs).map(rr -> rr.stream()
.filter(r -> isContainedRefInRefsList(r, refs))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
}
private boolean isContainedRefInRefsList(AccountReference referenceMatched, List<AccountReference> references) {
return references.stream()
.anyMatch(r -> r.matches(referenceMatched));
}
private AccountAccess getAccessByPsuId(boolean isAllPSD2, String psuId) {
List<AccountReference> refs = accountMapper.mapToAccountReferencesFromDetails(accountSpi.readAccountsByPsuId(psuId, new AspspConsentData("zzzzzzzzzzzzzz".getBytes())).getPayload()); // TODO https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/191 Put a real data here
if (CollectionUtils.isNotEmpty(refs)) {
return isAllPSD2
? new AccountAccess(refs, refs, refs, null, AccountAccessType.ALL_ACCOUNTS)
: new AccountAccess(refs, Collections.emptyList(), Collections.emptyList(), AccountAccessType.ALL_ACCOUNTS, null);
} else {
return new AccountAccess(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null, null);
}
}
private boolean isAllAccountsRequest(CreateConsentReq request) {
return Optional.ofNullable(request.getAccess())
.filter(a -> AccountAccessType.ALL_ACCOUNTS == a.getAllPsd2()
|| AccountAccessType.ALL_ACCOUNTS == a.getAvailableAccounts()).isPresent();
}
private Set<String> getIbansFromAccess(AccountAccess access) {
return Stream.of(
getIbansFromAccountReference(access.getAccounts()),
getIbansFromAccountReference(access.getBalances()),
getIbansFromAccountReference(access.getTransactions())
)
.flatMap(Collection::stream)
.collect(Collectors.toSet());
}
=======
>>>>>>>
private AccountAccess getAccessByRequestedAccess(AccountAccess requestedAccess) {
Set<String> ibansFromAccess = getIbansFromAccess(requestedAccess);
List<SpiAccountDetails> accountDetailsList = accountSpi.readAccountDetailsByIbans(
ibansFromAccess,
new AspspConsentData("zzzzzzzzzzzzzz".getBytes())).getPayload();
List<AccountReference> aspspReferences = accountMapper.mapToAccountReferencesFromDetails(accountDetailsList); // TODO https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/191 Put a real data here
List<AccountReference> balances = getFilteredReferencesByAccessReferences(requestedAccess.getBalances(), aspspReferences);
List<AccountReference> transaction = getRequestedReferences(requestedAccess.getTransactions(), aspspReferences);
List<AccountReference> accounts = getRequestedReferences(requestedAccess.getAccounts(), aspspReferences);
return new AccountAccess(getAccountsForAccess(balances, transaction, accounts), balances, transaction, null, null);
}
private List<AccountReference> getFilteredReferencesByAccessReferences(List<AccountReference> requestedReferences, List<AccountReference> refs) {
return Optional.ofNullable(requestedReferences)
.map(reqRefs -> getRequestedReferences(reqRefs, refs))
.orElseGet(Collections::emptyList);
}
private List<AccountReference> getAccountsForAccess(List<AccountReference> balances, List<AccountReference> transactions, List<AccountReference> accounts) {
accounts.removeAll(balances);
accounts.addAll(balances);
accounts.removeAll(transactions);
accounts.addAll(transactions);
return accounts;
}
private List<AccountReference> getRequestedReferences(List<AccountReference> requestedRefs, List<AccountReference> refs) {
return Optional.ofNullable(requestedRefs).map(rr -> rr.stream()
.filter(r -> isContainedRefInRefsList(r, refs))
.collect(Collectors.toList()))
.orElseGet(Collections::emptyList);
}
private boolean isContainedRefInRefsList(AccountReference referenceMatched, List<AccountReference> references) {
return references.stream()
.anyMatch(r -> r.matches(referenceMatched));
}
private AccountAccess getAccessByPsuId(boolean isAllPSD2, String psuId) {
List<AccountReference> refs = accountMapper.mapToAccountReferencesFromDetails(accountSpi.readAccountsByPsuId(psuId, new AspspConsentData("zzzzzzzzzzzzzz".getBytes())).getPayload()); // TODO https://git.adorsys.de/adorsys/xs2a/aspsp-xs2a/issues/191 Put a real data here
if (CollectionUtils.isNotEmpty(refs)) {
return isAllPSD2
? new AccountAccess(refs, refs, refs, null, AccountAccessType.ALL_ACCOUNTS)
: new AccountAccess(refs, Collections.emptyList(), Collections.emptyList(), AccountAccessType.ALL_ACCOUNTS, null);
} else {
return new AccountAccess(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null, null);
}
}
private boolean isAllAccountsRequest(CreateConsentReq request) {
return Optional.ofNullable(request.getAccess())
.filter(a -> AccountAccessType.ALL_ACCOUNTS == a.getAllPsd2()
|| AccountAccessType.ALL_ACCOUNTS == a.getAvailableAccounts()).isPresent();
}
private Set<String> getIbansFromAccess(AccountAccess access) {
return Stream.of(
getIbansFromAccountReference(access.getAccounts()),
getIbansFromAccountReference(access.getBalances()),
getIbansFromAccountReference(access.getTransactions())
)
.flatMap(Collection::stream)
.collect(Collectors.toSet());
} |
<<<<<<<
/**
* AllPsd2Support status, that shows if ASPSP supports Global consents
*/
private boolean allPsd2Support;
=======
/**
* The limit of a maximum lifetime of consent
*/
private int consentLifetime;
/**
* The limit of a maximum lifetime of transaction set in days
*/
private int transactionLifetime;
>>>>>>>
/**
* The limit of a maximum lifetime of consent
*/
private int consentLifetime;
/**
* The limit of a maximum lifetime of transaction set in days
*/
private int transactionLifetime;
/**
* AllPsd2Support status, that shows if ASPSP supports Global consents
*/
private boolean allPsd2Support; |
<<<<<<<
private ResponseObject<UpdateConsentPsuDataResponse> getUpdateConsentPsuDataResponse(UpdateConsentPsuDataReq updatePsuData, AccountConsentAuthorization consentAuthorization) {
UpdateConsentPsuDataResponse response = aisAuthorizationService.updateConsentPsuData(updatePsuData, consentAuthorization);
return Optional.ofNullable(response)
.map(s -> ResponseObject.<UpdateConsentPsuDataResponse>builder().body(response).build())
.orElseGet(() -> ResponseObject.<UpdateConsentPsuDataResponse>builder()
.fail(new MessageError(MessageErrorCode.FORMAT_ERROR))
.build());
}
private SpiAccountConsent getValidatedSpiAccountConsent(String consentId) {
return Optional.ofNullable(aisConsentService.getAccountConsentById(consentId))
.filter(consent -> getTppId().equals(consent.getTppId()))
.orElse(null);
}
private String getTppId() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.map(authentication -> (HashMap<String, String>) authentication.getCredentials())
.map(credentials -> credentials.get("authorityId"))
.orElse("This is a test TppId");
}
=======
>>>>>>>
private SpiAccountConsent getValidatedSpiAccountConsent(String consentId) {
return Optional.ofNullable(aisConsentService.getAccountConsentById(consentId))
.filter(consent -> getTppId().equals(consent.getTppId()))
.orElse(null);
}
private String getTppId() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.map(authentication -> (HashMap<String, String>) authentication.getCredentials())
.map(credentials -> credentials.get("authorityId"))
.orElse("This is a test TppId");
} |
<<<<<<<
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
=======
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
>>>>>>>
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse.VoidResponse;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponseStatus;
<<<<<<<
default SpiResponse<VoidResponse> executePaymentWithoutSca(SpiBulkPayment payment, AspspConsentData aspspConsentData) {
=======
@NotNull
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPsuData psuData, @NotNull SpiBulkPayment payment, @NotNull AspspConsentData aspspConsentData) {
>>>>>>>
default SpiResponse<VoidResponse> executePaymentWithoutSca(SpiBulkPayment payment, AspspConsentData aspspConsentData) {
@NotNull
default SpiResponse<VoidResponse> executePaymentWithoutSca(@NotNull SpiPsuData psuData, @NotNull SpiBulkPayment payment, @NotNull AspspConsentData aspspConsentData) {
<<<<<<<
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(String psuId, SpiScaMethod scaMethod, SpiBulkPayment businessObject, AspspConsentData aspspConsentData) {
return SpiResponse.<SpiAuthorizationCodeResult>builder().fail(SpiResponseStatus.NOT_SUPPORTED);
=======
@NotNull
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull SpiPsuData psuData, SpiScaMethod scaMethod, SpiBulkPayment businessObject, AspspConsentData aspspConsentData) {
return SpiResponse.<SpiAuthorizationCodeResult>builder().fail(SpiResponseStatus.NOT_SUPPORTED);
>>>>>>>
@NotNull
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(@NotNull SpiPsuData psuData, SpiScaMethod scaMethod, SpiBulkPayment businessObject, AspspConsentData aspspConsentData) {
return SpiResponse.<SpiAuthorizationCodeResult>builder().fail(SpiResponseStatus.NOT_SUPPORTED);
default SpiResponse<SpiAuthorizationCodeResult> requestAuthorisationCode(String psuId, SpiScaMethod scaMethod, SpiBulkPayment businessObject, AspspConsentData aspspConsentData) {
return SpiResponse.<SpiAuthorizationCodeResult>builder().fail(SpiResponseStatus.NOT_SUPPORTED); |
<<<<<<<
private static final int TRANSACTION_LIFETIME = 0;
=======
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
>>>>>>>
private static final int TRANSACTION_LIFETIME = 0;
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
<<<<<<<
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
=======
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
>>>>>>>
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
<<<<<<<
@Test
public void getTransactionLifetime() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Integer> actualResponse = aspspProfileController.getTransactionLifetime();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(TRANSACTION_LIFETIME);
}
=======
@Test
public void getBankOfferedConsentSupport() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getBankOfferedConsentSupport();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
}
>>>>>>>
@Test
public void getTransactionLifetime() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Integer> actualResponse = aspspProfileController.getTransactionLifetime();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(TRANSACTION_LIFETIME);
}
@Test
public void getBankOfferedConsentSupport() {
//Given:
HttpStatus expectedStatusCode = HttpStatus.OK;
//When:
ResponseEntity<Boolean> actualResponse = aspspProfileController.getBankOfferedConsentSupport();
//Then:
assertThat(actualResponse.getStatusCode()).isEqualTo(expectedStatusCode);
assertThat(actualResponse.getBody()).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
} |
<<<<<<<
import de.adorsys.aspsp.xs2a.web.AccountController;
=======
>>>>>>>
import de.adorsys.aspsp.xs2a.web.AccountController;
<<<<<<<
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
=======
import static java.util.Optional.ofNullable;
>>>>>>>
import static java.util.Optional.ofNullable;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; |
<<<<<<<
import de.adorsys.psd2.consent.server.service.security.EncryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService;
=======
import de.adorsys.psd2.consent.server.service.mapper.PsuDataMapper;
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
>>>>>>>
import de.adorsys.psd2.consent.server.service.mapper.PsuDataMapper;
import de.adorsys.psd2.xs2a.core.psu.PsuIdData;
import de.adorsys.psd2.consent.server.service.security.EncryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService;
<<<<<<<
@Mock
SecurityDataService securityDataService;
=======
@Mock
private PsuDataMapper psuDataMapper;
@Mock
private PsuData psuData;
>>>>>>>
@Mock
private PsuDataMapper psuDataMapper;
@Mock
private PsuData psuData;
@Mock
SecurityDataService securityDataService; |
<<<<<<<
@PutMapping(path = "/all-psd2-support")
@ApiOperation(value = "Updates AllPsd2Support status. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = Boolean.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateAllPsd2Support(@RequestBody Boolean allPsd2Support) {
aspspProfileService.updateAllPsd2Support(allPsd2Support);
return new ResponseEntity<>(HttpStatus.OK);
}
=======
@PutMapping(path = "/consent-lifetime")
@ApiOperation(value = "Updates the value of a maximum lifetime of consent. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = String.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateConsentLifetime(@RequestBody int consentLifetime) {
aspspProfileService.updateConsentLifetime(consentLifetime);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping(path = "/transaction-lifetime")
@ApiOperation(value = "Updates the value of a maximum lifetime of transaction. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = String.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateTransactionLifetime(@RequestBody int transactionLifetime) {
aspspProfileService.updateTransactionLifetime(transactionLifetime);
return new ResponseEntity<>(HttpStatus.OK);
}
>>>>>>>
@PutMapping(path = "/consent-lifetime")
@ApiOperation(value = "Updates the value of a maximum lifetime of consent. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = String.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateConsentLifetime(@RequestBody int consentLifetime) {
aspspProfileService.updateConsentLifetime(consentLifetime);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping(path = "/transaction-lifetime")
@ApiOperation(value = "Updates the value of a maximum lifetime of transaction. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = String.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateTransactionLifetime(@RequestBody int transactionLifetime) {
aspspProfileService.updateTransactionLifetime(transactionLifetime);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping(path = "/all-psd2-support")
@ApiOperation(value = "Updates AllPsd2Support status. Only for DEBUG!")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Ok", response = Boolean.class),
@ApiResponse(code = 400, message = "Bad request")})
public ResponseEntity<Void> updateAllPsd2Support(@RequestBody Boolean allPsd2Support) {
aspspProfileService.updateAllPsd2Support(allPsd2Support);
return new ResponseEntity<>(HttpStatus.OK);
} |
<<<<<<<
private static final int TRANSACTION_LIFETIME = 0;
=======
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
>>>>>>>
private static final int TRANSACTION_LIFETIME = 0;
private static final boolean BANK_OFFERED_CONSENT_SUPPORT = false;
<<<<<<<
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
=======
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
>>>>>>>
when(profileConfiguration.getTransactionLifetime())
.thenReturn(TRANSACTION_LIFETIME);
when(profileConfiguration.isBankOfferedConsentSupport())
.thenReturn(BANK_OFFERED_CONSENT_SUPPORT);
<<<<<<<
@Test
public void getTransactionLifetime() {
//When:
int actualResponse = aspspProfileService.getTransactionLifetime();
//Then:
assertThat(actualResponse).isEqualTo(TRANSACTION_LIFETIME);
}
=======
@Test
public void isBankOfferedConsentSupport() {
//When
boolean actualResponse = aspspProfileService.isBankOfferedConsentSupport();
//Then
assertThat(actualResponse).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
}
>>>>>>>
@Test
public void getTransactionLifetime() {
//When:
int actualResponse = aspspProfileService.getTransactionLifetime();
//Then:
assertThat(actualResponse).isEqualTo(TRANSACTION_LIFETIME);
}
@Test
public void isBankOfferedConsentSupport() {
//When
boolean actualResponse = aspspProfileService.isBankOfferedConsentSupport();
//Then
assertThat(actualResponse).isEqualTo(BANK_OFFERED_CONSENT_SUPPORT);
} |
<<<<<<<
import de.adorsys.psd2.consent.server.service.security.DecryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService;
=======
import de.adorsys.psd2.xs2a.core.consent.ConsentStatus;
>>>>>>>
import de.adorsys.psd2.xs2a.core.consent.ConsentStatus;
import de.adorsys.psd2.consent.server.service.security.DecryptedData;
import de.adorsys.psd2.consent.server.service.security.SecurityDataService;
<<<<<<<
public Optional<CmsConsentStatus> getConsentStatusById(String encryptedConsentId) {
return getPisConsentById(encryptedConsentId)
=======
public Optional<ConsentStatus> getConsentStatusById(String consentId) {
return getPisConsentById(consentId)
>>>>>>>
public Optional<ConsentStatus> getConsentStatusById(String encryptedConsentId) {
return getPisConsentById(encryptedConsentId)
<<<<<<<
public Optional<Boolean> updateConsentStatusById(String encryptedConsentId, CmsConsentStatus status) {
return getActualPisConsent(encryptedConsentId)
=======
public Optional<Boolean> updateConsentStatusById(String consentId, ConsentStatus status) {
return getActualPisConsent(consentId)
>>>>>>>
public Optional<Boolean> updateConsentStatusById(String encryptedConsentId, ConsentStatus status) {
return getActualPisConsent(encryptedConsentId) |
<<<<<<<
import de.adorsys.aspsp.xs2a.domain.*;
import de.adorsys.aspsp.xs2a.domain.Xs2aAmount;
import de.adorsys.aspsp.xs2a.domain.Xs2aBalance;
=======
import de.adorsys.aspsp.xs2a.domain.Amount;
import de.adorsys.aspsp.xs2a.domain.Balance;
>>>>>>>
import de.adorsys.aspsp.xs2a.domain.*;
import de.adorsys.aspsp.xs2a.domain.Xs2aAmount;
import de.adorsys.aspsp.xs2a.domain.Xs2aBalance;
<<<<<<<
accountDetailsList.add(new Xs2aAccountDetails("1", "2", "3", "4", "5", "6", Currency.getInstance("EUR"), "8", "9", CashAccountType.CURRENT_ACCOUNT, "11", new ArrayList<Xs2aBalance>()));
accountDetailsList.add(new Xs2aAccountDetails("x1", "x2", "x3", "x4", "x5", "x6", Currency.getInstance("EUR"), "x8", "x9", CashAccountType.CURRENT_ACCOUNT, "x11", Arrays.asList(inputBalance)));
Xs2aAccountDetails accountDetails = new Xs2aAccountDetails("y1", "y2", "y3", "y4", "y5", "y6", Currency.getInstance("EUR"), "y8", "y9", CashAccountType.CURRENT_ACCOUNT, "y11", new ArrayList<Xs2aBalance>());
=======
accountDetailsList.add(new AccountDetails("1", "2", "3", "4", "5", "6", Currency.getInstance("EUR"), "8", "9", CashAccountType.CURRENT_ACCOUNT, "11", null, null, new ArrayList<Balance>()));
accountDetailsList.add(new AccountDetails("x1", "x2", "x3", "x4", "x5", "x6", Currency.getInstance("EUR"), "x8", "x9", CashAccountType.CURRENT_ACCOUNT, "x11", null, null, Arrays.asList(inputBalance)));
AccountDetails accountDetails = new AccountDetails("y1", "y2", "y3", "y4", "y5", "y6", Currency.getInstance("EUR"), "y8", "y9", CashAccountType.CURRENT_ACCOUNT, "y11", null, null, new ArrayList<Balance>());
>>>>>>>
accountDetailsList.add(new Xs2aAccountDetails("1", "2", "3", "4", "5", "6", Currency.getInstance("EUR"), "8", "9", CashAccountType.CURRENT_ACCOUNT, "11", null, null, new ArrayList<Balance>()));
accountDetailsList.add(new Xs2aAccountDetails("x1", "x2", "x3", "x4", "x5", "x6", Currency.getInstance("EUR"), "x8", "x9", CashAccountType.CURRENT_ACCOUNT, "x11", null, null, Arrays.asList(inputBalance)));
AccountDetails accountDetails = new Xs2aAccountDetails("y1", "y2", "y3", "y4", "y5", "y6", Currency.getInstance("EUR"), "y8", "y9", CashAccountType.CURRENT_ACCOUNT, "y11", null, null, new ArrayList<Balance>()); |
<<<<<<<
import org.apache.commons.collections4.CollectionUtils;
=======
import lombok.RequiredArgsConstructor;
>>>>>>>
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
<<<<<<<
public PisConsent mapToPisConsent(PisConsentRequest request) {
PisConsent consent = new PisConsent();
consent.setPayments(mapToPisPaymentDataList(request.getPayments(), consent));
consent.setPisTppInfo(mapToPisTppInfo(request.getTppInfo()));
consent.setPisPaymentType(request.getPaymentType());
consent.setPisPaymentProduct(request.getPaymentProduct());
consent.setConsentType(ConsentType.PIS);
consent.setConsentStatus(CmsConsentStatus.RECEIVED);
return consent;
=======
public Optional<PisConsent> mapToPisConsent(PisConsentRequest request) {
return Optional.ofNullable(request.getPayments())
.map(pmt -> {
PisConsent consent = new PisConsent();
consent.setExternalId(UUID.randomUUID().toString());
consent.addPaymentsData(mapToPisPaymentDataList(pmt));
consent.setTppInfo(consentMapper.mapToTppInfo(request.getTppInfo()));
consent.setPisPaymentType(request.getPaymentType());
consent.setPisPaymentProduct(request.getPaymentProduct());
consent.setConsentType(ConsentType.PIS);
consent.setConsentStatus(CmsConsentStatus.RECEIVED);
consent.setAspspConsentData(request.getAspspConsentData());
return consent;
});
>>>>>>>
public PisConsent mapToPisConsent(PisConsentRequest request) {
PisConsent consent = new PisConsent();
consent.setPayments(mapToPisPaymentDataList(request.getPayments(), consent));
consent.setTppInfo(consentMapper.mapToTppInfo(request.getTppInfo()));
consent.setPisPaymentType(request.getPaymentType());
consent.setPisPaymentProduct(request.getPaymentProduct());
consent.setConsentType(ConsentType.PIS);
consent.setConsentStatus(CmsConsentStatus.RECEIVED);
return consent; |
<<<<<<<
links.setScaRedirect(aspspProfileService.getPisRedirectUrlToAspsp() + body.getPisConsentId() + "/" + encodedPaymentId);
links.setSelf(linkTo(controller, paymentProduct).slash(body.getPaymentId()).toString());
links.setUpdatePsuIdentification(linkTo(controller, paymentProduct).slash(body.getPaymentId()).toString());
links.setUpdatePsuAuthentication(linkTo(controller, paymentProduct).slash(body.getPaymentId()).toString());
links.setStatus(linkTo(controller, paymentProduct).slash("status").toString());
=======
links.setScaRedirect(aspspProfileService.getPisRedirectUrlToAspsp() + body.getIban() + "/" + body.getPisConsentId() + "/" + encodedPaymentId);
links.setSelf(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setUpdatePsuIdentification(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setUpdatePsuAuthentication(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setStatus(linkTo(controller, paymentProduct).slash(encodedPaymentId).slash("status").toString());
>>>>>>>
links.setScaRedirect(aspspProfileService.getPisRedirectUrlToAspsp() + body.getPisConsentId() + "/" + encodedPaymentId);
links.setSelf(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setUpdatePsuIdentification(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setUpdatePsuAuthentication(linkTo(controller, paymentProduct).slash(encodedPaymentId).toString());
links.setStatus(linkTo(controller, paymentProduct).slash(encodedPaymentId).slash("status").toString()); |
<<<<<<<
references, references, references, SpiAccountAccessType.ALL_ACCOUNTS, SpiAccountAccessType.ALL_ACCOUNTS),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, true, false)
=======
references, Collections.emptyList(), Collections.emptyList(), SpiAccountAccessType.ALL_ACCOUNTS, SpiAccountAccessType.ALL_ACCOUNTS),
false, new Date(), 100, new Date(), SpiTransactionStatus.ACCP, SpiConsentStatus.VALID, false, false)
>>>>>>>
references, Collections.emptyList(), Collections.emptyList(), SpiAccountAccessType.ALL_ACCOUNTS, SpiAccountAccessType.ALL_ACCOUNTS),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, true, false)
<<<<<<<
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), null, null),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, false, false)
=======
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.emptyList(), Collections.emptyList(), null, null),
false, new Date(), 100, new Date(), SpiTransactionStatus.ACCP, SpiConsentStatus.VALID, false, false)
);
consentRepository.save(
new SpiAccountConsent("Acc2WB",
new SpiAccountAccess(
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), null, null),
false, new Date(), 100, new Date(), SpiTransactionStatus.ACCP, SpiConsentStatus.VALID, true, false)
);
consentRepository.save(
new SpiAccountConsent("Acc2WOB",
new SpiAccountAccess(
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.emptyList(), Collections.emptyList(), null, null),
false, new Date(), 100, new Date(), SpiTransactionStatus.ACCP, SpiConsentStatus.VALID, false, false)
>>>>>>>
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), null, null),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, false, false)
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(0))), Collections.emptyList(), Collections.emptyList(), null, null),
false, new Date(), 100, new Date(), SpiTransactionStatus.ACCP, SpiConsentStatus.VALID, false, false)
);
consentRepository.save(
new SpiAccountConsent("Acc2WB",
new SpiAccountAccess(
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), null, null),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, true, false)
);
consentRepository.save(
new SpiAccountConsent("Acc2WOB",
new SpiAccountAccess(
Collections.singletonList(mapToReferenceFromDetails(accountDetails.get(1))), Collections.emptyList(), Collections.emptyList(), null, null),
false, new Date(), 100, new Date(), SpiConsentStatus.VALID, false, false) |
<<<<<<<
=======
//todo 更改为真实计算
long rewardOfDay = 0;
if (hashAgent) {
//2018
rewardOfDay = PocConsensusConstant.BLOCK_REWARD.getValue() * PocConsensusConstant.BLOCK_COUNT_OF_DAY;
}
>>>>>>>
<<<<<<<
public ConsensusStatusInfo getConsensusStatus(String agentHash) {
Consensus<Agent> ca = this.consensusCacheManager.getCachedAgentByHash(agentHash);
if (null == ca) {
return null;
}
Account account = this.accountService.getAccount(ca.getAddress());
ConsensusStatusInfo info = new ConsensusStatusInfo();
info.setSeed(false);
info.setStatus(ca.getExtend().getStatus());
info.setAccount(account);
return info;
}
@Override
public Page<Map<String, Object>> getAgentList(String keyword, String depositAddress, String agentAddress, String sortType, Integer pageNumber, Integer pageSize) {
=======
public Page<Map<String, Object>> getAgentList(String keyword, String depositAddress, String agentAddress, String sortType, Integer pageNumber, Integer pageSize) {
>>>>>>>
public ConsensusStatusInfo getConsensusStatus(String agentHash) {
Consensus<Agent> ca = this.consensusCacheManager.getCachedAgentByHash(agentHash);
if (null == ca) {
return null;
}
Account account = this.accountService.getAccount(ca.getAddress());
ConsensusStatusInfo info = new ConsensusStatusInfo();
info.setSeed(false);
info.setStatus(ca.getExtend().getStatus());
info.setAccount(account);
return info;
}
@Override
public Page<Map<String, Object>> getAgentList(String keyword, String depositAddress, String agentAddress, String sortType, Integer pageNumber, Integer pageSize) {
<<<<<<<
if (StringUtils.validAddress(depositAddress)) {
=======
if (Address.validAddress(depositAddress)) {
>>>>>>>
if (Address.validAddress(depositAddress)) { |
<<<<<<<
import de.adorsys.psd2.xs2a.core.pis.TransactionStatus;
=======
import de.adorsys.aspsp.xs2a.service.consent.PisConsentDataService;
>>>>>>>
import de.adorsys.psd2.xs2a.core.pis.TransactionStatus;
import de.adorsys.aspsp.xs2a.service.consent.PisConsentDataService; |
<<<<<<<
import de.adorsys.aspsp.xs2a.consent.api.ActionStatus;
=======
import de.adorsys.aspsp.xs2a.config.rest.consent.AisConsentRemoteUrls;
>>>>>>>
import de.adorsys.aspsp.xs2a.consent.api.ActionStatus;
import de.adorsys.aspsp.xs2a.config.rest.consent.AisConsentRemoteUrls; |
<<<<<<<
import de.adorsys.aspsp.xs2a.spi.domain.ais.consents.AccountInformationConsentRequestBody;
=======
import de.adorsys.aspsp.xs2a.spi.domain.ais.consents.CreateConsentReq;
>>>>>>>
import de.adorsys.aspsp.xs2a.spi.domain.ais.consents.CreateConsentReq;
<<<<<<<
import de.adorsys.aspsp.xs2a.spi.utils.FileUtil;
import org.junit.Test;
=======
import org.junit.Test;
>>>>>>>
import org.junit.Test;
<<<<<<<
private final String AIC_AVAILABLE_ACCOUNTS_REQUEST_PATH = "json/AicAvailableAccountsRequestTest.json";
private final String AIC_NO_DEDICATE_REQUEST_PATH = "json/AicNoDedicateAccountTest.json";
=======
>>>>>>>
private final String AIC_AVAILABLE_ACCOUNTS_REQUEST_PATH = "json/AicAvailableAccountsRequestTest.json";
private final String AIC_NO_DEDICATE_REQUEST_PATH = "json/AicNoDedicateAccountTest.json";
<<<<<<<
@Test
public void aicAvailableAccountsRequest_jsonTest() throws IOException {
//Given:
String aicRequestJson = getJsonString(AIC_AVAILABLE_ACCOUNTS_REQUEST_PATH);
AccountInformationConsentRequestBody expectedAICRequest = getAicAvailableAccountsRequest();
//When:
AccountInformationConsentRequestBody actualAICRequest = new Gson().fromJson(aicRequestJson, AccountInformationConsentRequestBody.class);
//Then:
assertThat(actualAICRequest).isEqualTo(expectedAICRequest);
}
@Test
public void aicAicNoDedicateAccountRequest_jsonTest() throws IOException {
//Given:
String aicRequestJson = getJsonString(AIC_NO_DEDICATE_REQUEST_PATH);
AccountInformationConsentRequestBody expectedAICRequest = getAicNoDedicatedAccountRequest();
//When:
AccountInformationConsentRequestBody actualAICRequest = new Gson().fromJson(aicRequestJson, AccountInformationConsentRequestBody.class);
//Then:
assertThat(actualAICRequest).isEqualTo(expectedAICRequest);
}
private AccountInformationConsentRequestBody getAicNoDedicatedAccountRequest() {
AccountAccess accountAccess = new AccountAccess();
accountAccess.setBalances(new AccountReference[0]);
accountAccess.setTransactions(new AccountReference[0]);
AccountInformationConsentRequestBody aicRequestObj = new AccountInformationConsentRequestBody();
aicRequestObj.setAccess(accountAccess);
aicRequestObj.setRecurringIndicator(true);
aicRequestObj.setValidUntil(DateUtil.getDateFromDateStringNoTimeZone("2017-11-01"));
aicRequestObj.setFrequencyPerDay(4);
return aicRequestObj;
}
private AccountInformationConsentRequestBody getAicAvailableAccountsRequest() {
AccountAccess accountAccess = new AccountAccess();
accountAccess.setAvailableAccounts("all-accounts");
AccountInformationConsentRequestBody aicRequestObj = new AccountInformationConsentRequestBody();
aicRequestObj.setAccess(accountAccess);
aicRequestObj.setRecurringIndicator(false);
aicRequestObj.setValidUntil(DateUtil.getDateFromDateStringNoTimeZone("2017-08-06"));
aicRequestObj.setFrequencyPerDay(1);
return aicRequestObj;
}
private AccountInformationConsentRequestBody getAICRequestTest() {
=======
private CreateConsentReq getAICRequestTest() {
>>>>>>>
@Test
public void aicAvailableAccountsRequest_jsonTest() throws IOException {
//Given:
String aicRequestJson = getJsonString(AIC_AVAILABLE_ACCOUNTS_REQUEST_PATH);
AccountInformationConsentRequestBody expectedAICRequest = getAicAvailableAccountsRequest();
//When:
AccountInformationConsentRequestBody actualAICRequest = new Gson().fromJson(aicRequestJson, AccountInformationConsentRequestBody.class);
//Then:
assertThat(actualAICRequest).isEqualTo(expectedAICRequest);
}
@Test
public void aicAicNoDedicateAccountRequest_jsonTest() throws IOException {
//Given:
String aicRequestJson = getJsonString(AIC_NO_DEDICATE_REQUEST_PATH);
AccountInformationConsentRequestBody expectedAICRequest = getAicNoDedicatedAccountRequest();
//When:
AccountInformationConsentRequestBody actualAICRequest = new Gson().fromJson(aicRequestJson, AccountInformationConsentRequestBody.class);
//Then:
assertThat(actualAICRequest).isEqualTo(expectedAICRequest);
}
private AccountInformationConsentRequestBody getAicNoDedicatedAccountRequest() {
AccountAccess accountAccess = new AccountAccess();
accountAccess.setBalances(new AccountReference[0]);
accountAccess.setTransactions(new AccountReference[0]);
AccountInformationConsentRequestBody aicRequestObj = new AccountInformationConsentRequestBody();
aicRequestObj.setAccess(accountAccess);
aicRequestObj.setRecurringIndicator(true);
aicRequestObj.setValidUntil(DateUtil.getDateFromDateStringNoTimeZone("2017-11-01"));
aicRequestObj.setFrequencyPerDay(4);
return aicRequestObj;
}
private AccountInformationConsentRequestBody getAicAvailableAccountsRequest() {
AccountAccess accountAccess = new AccountAccess();
accountAccess.setAvailableAccounts("all-accounts");
AccountInformationConsentRequestBody aicRequestObj = new AccountInformationConsentRequestBody();
aicRequestObj.setAccess(accountAccess);
aicRequestObj.setRecurringIndicator(false);
aicRequestObj.setValidUntil(DateUtil.getDateFromDateStringNoTimeZone("2017-08-06"));
aicRequestObj.setFrequencyPerDay(1);
return aicRequestObj;
}
private AccountInformationConsentRequestBody getAICRequestTest() { |
<<<<<<<
private SpiAccountConsent getValidatedSpiAccountConsent(String consentId) {
return Optional.ofNullable(consentSpi.getAccountConsentById(consentId))
.filter(consent -> getTppId().equals(consent.getTppId()))
.orElse(null);
}
private String getTppId() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.map(authentication -> (HashMap<String, String>) authentication.getCredentials())
.map(credentials -> credentials.get("authorityId"))
.orElse("This is a test TppId");
}
=======
public ResponseObject<Xsa2CreatePisConsentAuthorizationResponse> createPisConsentAuthorization(String paymentId, PaymentType paymentType) {
return pisAuthorizationService.createConsentAuthorization(paymentId, paymentType)
.map(resp -> ResponseObject.<Xsa2CreatePisConsentAuthorizationResponse>builder()
.body(resp)
.build())
.orElseGet(() -> ResponseObject.<Xsa2CreatePisConsentAuthorizationResponse>builder()
.fail(new MessageError(MessageErrorCode.PAYMENT_FAILED))
.build());
}
>>>>>>>
public ResponseObject<Xsa2CreatePisConsentAuthorizationResponse> createPisConsentAuthorization(String paymentId, PaymentType paymentType) {
return pisAuthorizationService.createConsentAuthorization(paymentId, paymentType)
.map(resp -> ResponseObject.<Xsa2CreatePisConsentAuthorizationResponse>builder()
.body(resp)
.build())
.orElseGet(() -> ResponseObject.<Xsa2CreatePisConsentAuthorizationResponse>builder()
.fail(new MessageError(MessageErrorCode.PAYMENT_FAILED))
.build());
}
private SpiAccountConsent getValidatedSpiAccountConsent(String consentId) {
return Optional.ofNullable(consentSpi.getAccountConsentById(consentId))
.filter(consent -> getTppId().equals(consent.getTppId()))
.orElse(null);
}
private String getTppId() {
return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
.map(authentication -> (HashMap<String, String>) authentication.getCredentials())
.map(credentials -> credentials.get("authorityId"))
.orElse("This is a test TppId");
} |
<<<<<<<
import de.adorsys.aspsp.xs2a.service.mapper.consent.SpiCmsPisMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.Xs2aToSpiBulkPaymentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.Xs2aToSpiPeriodicPaymentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.Xs2aToSpiPsuDataMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.Xs2aToSpiSinglePaymentMapper;
=======
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.*;
>>>>>>>
import de.adorsys.aspsp.xs2a.service.mapper.consent.Xs2aPisConsentMapper;
import de.adorsys.aspsp.xs2a.service.mapper.spi_xs2a_mappers.*;
<<<<<<<
protected final Xs2aToSpiPsuDataMapper xs2aToSpiPsuDataMapper;
=======
protected final SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper;
protected final Xs2aPisConsentMapper xs2aPisConsentMapper;
protected final SpiErrorMapper spiErrorMapper;
>>>>>>>
protected final SpiToXs2aAuthenticationObjectMapper spiToXs2aAuthenticationObjectMapper;
protected final Xs2aPisConsentMapper xs2aPisConsentMapper;
protected final SpiErrorMapper spiErrorMapper;
protected final Xs2aToSpiPsuDataMapper xs2aToSpiPsuDataMapper; |
<<<<<<<
import java.util.List;
=======
import wagner.stephanie.lizzie.analysis.GameInfo;
>>>>>>>
import java.util.List;
import wagner.stephanie.lizzie.analysis.GameInfo;
<<<<<<<
* @return nexts for display
*/
public List<BoardHistoryNode> getNexts() {
return head.getNexts();
}
/**
=======
* Does not change the pointer position
*
* @return the data stored at the previous index. null if not present
*/
public BoardData getPrevious() {
if (head.previous() == null)
return null;
else
return head.previous().getData();
}
/**
>>>>>>>
* @return nexts for display
*/
public List<BoardHistoryNode> getNexts() {
return head.getNexts();
}
/**
* Does not change the pointer position
*
* @return the data stored at the previous index. null if not present
*/
public BoardData getPrevious() {
if (head.previous() == null)
return null;
else
return head.previous().getData();
}
/** |
<<<<<<<
/**
* Truncate text that is too long for the given width
*
* @param line
* @param fm
* @param fitWidth
* @return fitted
*/
public static String truncateStringByWidth(String line, FontMetrics fm, int fitWidth) {
if (line == null || line.length() == 0) {
return "";
}
int width = fm.stringWidth(line);
if (width > fitWidth) {
int guess = line.length() * fitWidth / width;
String before = line.substring(0, guess).trim();
width = fm.stringWidth(before);
if (width > fitWidth) {
int diff = width - fitWidth;
int i = 0;
for (; (diff > 0 && i < 5); i++) {
diff = diff - fm.stringWidth(line.substring(guess - i - 1, guess - i));
}
return line.substring(0, guess - i).trim();
} else {
return before;
}
} else {
return line;
}
}
=======
}
>>>>>>>
}
/**
* Truncate text that is too long for the given width
*
* @param line
* @param fm
* @param fitWidth
* @return fitted
*/
public static String truncateStringByWidth(String line, FontMetrics fm, int fitWidth) {
if (line == null || line.length() == 0) {
return "";
}
int width = fm.stringWidth(line);
if (width > fitWidth) {
int guess = line.length() * fitWidth / width;
String before = line.substring(0, guess).trim();
width = fm.stringWidth(before);
if (width > fitWidth) {
int diff = width - fitWidth;
int i = 0;
for (; (diff > 0 && i < 5); i++) {
diff = diff - fm.stringWidth(line.substring(guess - i - 1, guess - i));
}
return line.substring(0, guess - i).trim();
} else {
return before;
}
} else {
return line;
}
} |
<<<<<<<
// draw edge of panel
int strokeRadius = 2;
if (!calc) {
// Draw background
area.setBounds(posx, posy, width, height);
g.setColor(new Color(0, 0, 0, 60));
g.fillRect(posx, posy, width, height);
// draw edge of panel
g.setStroke(new BasicStroke(2 * strokeRadius));
g.drawLine(
posx + strokeRadius,
posy + strokeRadius,
posx + strokeRadius,
posy - strokeRadius + height);
g.setStroke(new BasicStroke(1));
}
=======
int strokeRadius = Lizzie.config.showBorder ? 2 : 0;
// Draw background
g.setColor(new Color(0, 0, 0, 60));
g.fillRect(posx, posy, width, height);
if (Lizzie.config.showBorder) {
// draw edge of panel
g.setStroke(new BasicStroke(2 * strokeRadius));
g.drawLine(
posx + strokeRadius,
posy + strokeRadius,
posx + strokeRadius,
posy - strokeRadius + height);
g.setStroke(new BasicStroke(1));
}
>>>>>>>
int strokeRadius = Lizzie.config.showBorder ? 2 : 0;
if (!calc) {
// Draw background
area.setBounds(posx, posy, width, height);
g.setColor(new Color(0, 0, 0, 60));
g.fillRect(posx, posy, width, height);
if (Lizzie.config.showBorder) {
// draw edge of panel
g.setStroke(new BasicStroke(2 * strokeRadius));
g.drawLine(
posx + strokeRadius,
posy + strokeRadius,
posx + strokeRadius,
posy - strokeRadius + height);
g.setStroke(new BasicStroke(1));
}
} |
<<<<<<<
import java.util.Map;
=======
import java.util.Queue;
import javax.swing.*;
>>>>>>>
import java.util.Map;
import java.util.Queue;
import javax.swing.*;
<<<<<<<
public static int BOARD_SIZE = Lizzie.config.config.getJSONObject("ui").optInt("board-size", 19);
private final static String alphabet = "ABCDEFGHJKLMNOPQRST";
=======
public static final int BOARD_SIZE =
Lizzie.config.config.getJSONObject("ui").optInt("board-size", 19);
private static final String alphabet = "ABCDEFGHJKLMNOPQRST";
>>>>>>>
public static int BOARD_SIZE = Lizzie.config.config.getJSONObject("ui").optInt("board-size", 19);
private static final String alphabet = "ABCDEFGHJKLMNOPQRST";
<<<<<<<
// Force refresh board
private boolean forceRefresh = false;
=======
// Save the node for restore move when in the branch
private BoardHistoryNode saveNode = null;
>>>>>>>
// Save the node for restore move when in the branch
private BoardHistoryNode saveNode = null;
// Force refresh board
private boolean forceRefresh = false;
<<<<<<<
/**
* overloaded method for pass(), chooses color in an alternating pattern
*/
public void pass() {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
}
/**
* Places a stone onto the board representation. Thread safe
*
* @param x x coordinate
* @param y y coordinate
* @param color the type of stone to place
*/
public void place(int x, int y, Stone color) {
place(x, y, color, false);
}
/**
* Places a stone onto the board representation. Thread safe
*
* @param x x coordinate
* @param y y coordinate
* @param color the type of stone to place
* @param newBranch add a new branch
*/
public void place(int x, int y, Stone color, boolean newBranch) {
synchronized (this) {
if (scoreMode) {
// Mark clicked stone as dead
Stone[] stones = history.getStones();
toggleLiveStatus(capturedStones, x, y);
return;
}
if (!isValid(x, y) || (history.getStones()[getIndex(x, y)] != Stone.EMPTY && !newBranch))
return;
// Update winrate
Leelaz.WinrateStats stats = Lizzie.leelaz.getWinrateStats();
if (stats.maxWinrate >= 0 && stats.totalPlayouts > history.getData().playouts)
{
history.getData().winrate = stats.maxWinrate;
history.getData().playouts = stats.totalPlayouts;
}
double nextWinrate = -100;
if (history.getData().winrate >= 0) nextWinrate = 100 - history.getData().winrate;
// check to see if this coordinate is being replayed in history
BoardData next = history.getNext();
if (next != null && next.lastMove != null && next.lastMove[0] == x && next.lastMove[1] == y) {
// this is the next coordinate in history. Just increment history so that we don't erase the redo's
history.next();
// should be opposite from the bottom case
if (Lizzie.frame.isPlayingAgainstLeelaz && Lizzie.frame.playerIsBlack != getData().blackToPlay) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
Lizzie.leelaz.genmove((Lizzie.board.getData().blackToPlay ? "W" : "B"));
} else if (!Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
}
return;
}
// load a copy of the data at the current node of history
Stone[] stones = history.getStones().clone();
Zobrist zobrist = history.getZobrist();
int[] lastMove = new int[]{x, y}; // keep track of the last played stone
int moveNumber = history.getMoveNumber() + 1;
int[] moveNumberList = history.getMoveNumberList().clone();
moveNumberList[Board.getIndex(x, y)] = moveNumber;
// set the stone at (x, y) to color
stones[getIndex(x, y)] = color;
zobrist.toggleStone(x, y, color);
// remove enemy stones
int capturedStones = 0;
capturedStones += removeDeadChain(x + 1, y, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x, y + 1, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x - 1, y, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x, y - 1, color.opposite(), stones, zobrist);
// check to see if the player made a suicidal coordinate
int isSuicidal = removeDeadChain(x, y, color, stones, zobrist);
for (int i = 0; i < BOARD_SIZE * BOARD_SIZE; i++) {
if (stones[i].equals(Stone.EMPTY)) {
moveNumberList[i] = 0;
}
}
int bc = history.getData().blackCaptures;
int wc = history.getData().whiteCaptures;
if (color.isBlack())
bc += capturedStones;
else
wc += capturedStones;
BoardData newState = new BoardData(stones, lastMove, color, color.equals(Stone.WHITE),
zobrist, moveNumber, moveNumberList, bc, wc, nextWinrate, 0);
// don't make this coordinate if it is suicidal or violates superko
if (isSuicidal > 0|| history.violatesSuperko(newState))
return;
// update leelaz with board position
if (Lizzie.frame.isPlayingAgainstLeelaz && Lizzie.frame.playerIsBlack == getData().blackToPlay) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
Lizzie.leelaz.genmove((Lizzie.board.getData().blackToPlay ? "W" : "B"));
} else if (!Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
}
// update history with this coordinate
history.addOrGoto(newState, newBranch);
Lizzie.frame.repaint();
}
=======
}
/**
* overloaded method for place(), chooses color in an alternating pattern
*
* @param x x coordinate
* @param y y coordinate
*/
public void place(int x, int y) {
place(x, y, history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
}
/**
* overloaded method for place. To be used by the LeelaZ engine. Color is then assumed to be
* alternating
*
* @param namedCoordinate the coordinate to place a stone,
*/
public void place(String namedCoordinate) {
if (namedCoordinate.contains("pass")) {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
return;
} else if (namedCoordinate.contains("resign")) {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
return;
>>>>>>>
}
/** overloaded method for pass(), chooses color in an alternating pattern */
public void pass() {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
}
/**
* Places a stone onto the board representation. Thread safe
*
* @param x x coordinate
* @param y y coordinate
* @param color the type of stone to place
*/
public void place(int x, int y, Stone color) {
place(x, y, color, false);
}
/**
* Places a stone onto the board representation. Thread safe
*
* @param x x coordinate
* @param y y coordinate
* @param color the type of stone to place
* @param newBranch add a new branch
*/
public void place(int x, int y, Stone color, boolean newBranch) {
synchronized (this) {
if (scoreMode) {
// Mark clicked stone as dead
Stone[] stones = history.getStones();
toggleLiveStatus(capturedStones, x, y);
return;
}
if (!isValid(x, y) || (history.getStones()[getIndex(x, y)] != Stone.EMPTY && !newBranch))
return;
// Update winrate
Leelaz.WinrateStats stats = Lizzie.leelaz.getWinrateStats();
if (stats.maxWinrate >= 0 && stats.totalPlayouts > history.getData().playouts) {
history.getData().winrate = stats.maxWinrate;
history.getData().playouts = stats.totalPlayouts;
}
double nextWinrate = -100;
if (history.getData().winrate >= 0) nextWinrate = 100 - history.getData().winrate;
// check to see if this coordinate is being replayed in history
BoardData next = history.getNext();
if (next != null && next.lastMove != null && next.lastMove[0] == x && next.lastMove[1] == y) {
// this is the next coordinate in history. Just increment history so that we don't erase the
// redo's
history.next();
// should be opposite from the bottom case
if (Lizzie.frame.isPlayingAgainstLeelaz
&& Lizzie.frame.playerIsBlack != getData().blackToPlay) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
Lizzie.leelaz.genmove((Lizzie.board.getData().blackToPlay ? "W" : "B"));
} else if (!Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
}
return;
}
// load a copy of the data at the current node of history
Stone[] stones = history.getStones().clone();
Zobrist zobrist = history.getZobrist();
int[] lastMove = new int[] {x, y}; // keep track of the last played stone
int moveNumber = history.getMoveNumber() + 1;
int[] moveNumberList = history.getMoveNumberList().clone();
moveNumberList[Board.getIndex(x, y)] = moveNumber;
// set the stone at (x, y) to color
stones[getIndex(x, y)] = color;
zobrist.toggleStone(x, y, color);
// remove enemy stones
int capturedStones = 0;
capturedStones += removeDeadChain(x + 1, y, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x, y + 1, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x - 1, y, color.opposite(), stones, zobrist);
capturedStones += removeDeadChain(x, y - 1, color.opposite(), stones, zobrist);
// check to see if the player made a suicidal coordinate
int isSuicidal = removeDeadChain(x, y, color, stones, zobrist);
for (int i = 0; i < BOARD_SIZE * BOARD_SIZE; i++) {
if (stones[i].equals(Stone.EMPTY)) {
moveNumberList[i] = 0;
}
}
int bc = history.getData().blackCaptures;
int wc = history.getData().whiteCaptures;
if (color.isBlack()) bc += capturedStones;
else wc += capturedStones;
BoardData newState =
new BoardData(
stones,
lastMove,
color,
color.equals(Stone.WHITE),
zobrist,
moveNumber,
moveNumberList,
bc,
wc,
nextWinrate,
0);
// don't make this coordinate if it is suicidal or violates superko
if (isSuicidal > 0 || history.violatesSuperko(newState)) return;
// update leelaz with board position
if (Lizzie.frame.isPlayingAgainstLeelaz
&& Lizzie.frame.playerIsBlack == getData().blackToPlay) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
Lizzie.leelaz.genmove((Lizzie.board.getData().blackToPlay ? "W" : "B"));
} else if (!Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.leelaz.playMove(color, convertCoordinatesToName(x, y));
}
// update history with this coordinate
history.addOrGoto(newState, newBranch);
Lizzie.frame.repaint();
}
}
/**
* overloaded method for place(), chooses color in an alternating pattern
*
* @param x x coordinate
* @param y y coordinate
*/
public void place(int x, int y) {
place(x, y, history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
}
/**
* overloaded method for place. To be used by the LeelaZ engine. Color is then assumed to be
* alternating
*
* @param namedCoordinate the coordinate to place a stone,
*/
public void place(String namedCoordinate) {
if (namedCoordinate.contains("pass")) {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
return;
} else if (namedCoordinate.contains("resign")) {
pass(history.isBlacksTurn() ? Stone.BLACK : Stone.WHITE);
return; |
<<<<<<<
import java.awt.image.ImageObserver;
import java.util.HashMap;
=======
import java.io.IOException;
import java.util.HashMap;
>>>>>>>
import java.util.HashMap;
<<<<<<<
import featurecat.lizzie.theme.Theme;
=======
import javax.imageio.ImageIO;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
>>>>>>>
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
<<<<<<<
public Theme theme;
public List<String> variation;
=======
// special values of displayedBranchLength
public static final int SHOW_RAW_BOARD = -1;
public static final int SHOW_NORMAL_BOARD = -2;
>>>>>>>
// special values of displayedBranchLength
public static final int SHOW_RAW_BOARD = -1;
public static final int SHOW_NORMAL_BOARD = -2;
<<<<<<<
private int maxAlpha = 240;
public BoardRenderer(boolean isMainBoard) {
uiConfig = Lizzie.config.config.getJSONObject("ui");
// The theme to allow use external image and config file
theme = new Theme(uiConfig.optString("theme"));
uiPersist = Lizzie.config.persisted.getJSONObject("ui-persist");
try {
maxAlpha = uiPersist.getInt("max-alpha");
} catch (JSONException e) {}
this.isMainBoard = isMainBoard;
=======
public BoardRenderer(boolean isMainBoard) {
uiConfig = Lizzie.config.config.getJSONObject("ui");
uiPersist = Lizzie.config.persisted.getJSONObject("ui-persist");
try {
maxAlpha = uiPersist.getInt("max-alpha");
} catch (JSONException e) {
>>>>>>>
public BoardRenderer(boolean isMainBoard) {
uiConfig = Lizzie.config.config.getJSONObject("ui");
// The theme to allow use external image and config file
theme = new Theme(uiConfig.optString("theme"));
uiPersist = Lizzie.config.persisted.getJSONObject("ui-persist");
try {
maxAlpha = uiPersist.getInt("max-alpha");
} catch (JSONException e) {
<<<<<<<
/**
* Draw move numbers and/or mark the last played move
*/
private void drawMoveNumbers(Graphics2D g) {
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
int[] lastMove = branch == null ? Lizzie.board.getLastMove() : branch.data.lastMove;
if (!Lizzie.config.showMoveNumber && branch == null) {
if (lastMove != null) {
// mark the last coordinate
int lastMoveMarkerRadius = stoneRadius / 2;
int stoneX = x + scaledMargin + squareLength * lastMove[0];
int stoneY = y + scaledMargin + squareLength * lastMove[1];
// set color to the opposite color of whatever is on the board
g.setColor(Lizzie.board.getStones()[Board.getIndex(lastMove[0], lastMove[1])].isWhite() ?
Color.BLACK : Color.WHITE);
if (theme.solidStoneIndicator()) {
// Use a solid circle instead of
fillCircle(g, stoneX, stoneY, (int)(lastMoveMarkerRadius * 0.65));
} else {
drawCircle(g, stoneX, stoneY, lastMoveMarkerRadius);
}
} else if (lastMove == null && Lizzie.board.getData().moveNumber != 0 && !Lizzie.board.inScoreMode()) {
g.setColor(Lizzie.board.getData().blackToPlay ? new Color(255, 255, 255, 150) : new Color(0, 0, 0, 150));
g.fillOval(x + boardLength / 2 - 4 * stoneRadius, y + boardLength / 2 - 4 * stoneRadius, stoneRadius * 8, stoneRadius * 8);
g.setColor(Lizzie.board.getData().blackToPlay ? new Color(0, 0, 0, 255) : new Color(255, 255, 255, 255));
drawString(g, x + boardLength / 2, y + boardLength / 2, LizzieFrame.OpenSansRegularBase, "pass", stoneRadius * 4, stoneRadius * 6);
}
=======
int[] moveNumberList = branch == null ? board.getMoveNumberList() : branch.data.moveNumberList;
>>>>>>>
int[] moveNumberList = branch == null ? board.getMoveNumberList() : branch.data.moveNumberList;
<<<<<<<
} else {
// simple version
JSONArray boardColor = uiConfig.getJSONArray("board-color");
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
g.setColor(new Color(boardColor.getInt(0), boardColor.getInt(1), boardColor.getInt(2)));
g.fillRect(x, y, boardLength, boardLength);
}
}
/**
* Calculates the lengths and pixel margins from a given boardLength.
*
* @param boardLength go board's length in pixels; must be boardLength >= BOARD_SIZE - 1
* @return an array containing the three outputs: new boardLength, scaledMargin, availableLength
*/
private int[] calculatePixelMargins(int boardLength) {
//boardLength -= boardLength*MARGIN/3; // account for the shadows we will draw around the edge of the board
// if (boardLength < Board.BOARD_SIZE - 1)
// throw new IllegalArgumentException("boardLength may not be less than " + (Board.BOARD_SIZE - 1) + ", but was " + boardLength);
int scaledMargin;
int availableLength;
// decrease boardLength until the availableLength will result in square board intersections
double margin = showCoordinates() ? MARGIN_WITH_COORDINATES : MARGIN;
boardLength++;
do {
boardLength--;
scaledMargin = (int) (margin * boardLength);
availableLength = boardLength - 2 * scaledMargin;
}
while (!((availableLength - 1) % (Board.BOARD_SIZE - 1) == 0));
// this will be true if BOARD_SIZE - 1 square intersections, plus one line, will fit
return new int[]{boardLength, scaledMargin, availableLength};
}
private void drawShadow(Graphics2D g, int centerX, int centerY, boolean isGhost) {
drawShadow(g, centerX, centerY, isGhost, 1);
}
private void drawShadow(Graphics2D g, int centerX, int centerY, boolean isGhost, float shadowStrength) {
if (!uiConfig.getBoolean("shadows-enabled"))
return;
final int shadowSize = (int) (stoneRadius * 0.3 * uiConfig.getInt("shadow-size") / 100);
final int fartherShadowSize = (int) (stoneRadius * 0.17 * uiConfig.getInt("shadow-size") / 100);
final Paint TOP_GRADIENT_PAINT;
final Paint LOWER_RIGHT_GRADIENT_PAINT;
if (isGhost) {
TOP_GRADIENT_PAINT = new RadialGradientPaint(new Point2D.Float(centerX, centerY),
stoneRadius + shadowSize, new float[]{((float) stoneRadius / (stoneRadius + shadowSize)) - 0.0001f, ((float) stoneRadius / (stoneRadius + shadowSize)), 1.0f}, new Color[]{
new Color(0, 0, 0, 0), new Color(50, 50, 50, (int) (120 * shadowStrength)), new Color(0, 0, 0, 0)
});
LOWER_RIGHT_GRADIENT_PAINT = new RadialGradientPaint(new Point2D.Float(centerX + shadowSize * 2 / 3, centerY + shadowSize * 2 / 3),
stoneRadius + fartherShadowSize, new float[]{0.6f, 1.0f}, new Color[]{
new Color(0, 0, 0, 180), new Color(0, 0, 0, 0)
});
} else {
TOP_GRADIENT_PAINT = new RadialGradientPaint(new Point2D.Float(centerX, centerY),
stoneRadius + shadowSize, new float[]{0.3f, 1.0f}, new Color[]{
new Color(50, 50, 50, 150), new Color(0, 0, 0, 0)
});
LOWER_RIGHT_GRADIENT_PAINT = new RadialGradientPaint(new Point2D.Float(centerX + shadowSize, centerY + shadowSize),
stoneRadius + fartherShadowSize, new float[]{0.6f, 1.0f}, new Color[]{
new Color(0, 0, 0, 140), new Color(0, 0, 0, 0)
});
}
final Paint originalPaint = g.getPaint();
g.setPaint(TOP_GRADIENT_PAINT);
fillCircle(g, centerX, centerY, stoneRadius + shadowSize);
if (!isGhost) {
g.setPaint(LOWER_RIGHT_GRADIENT_PAINT);
fillCircle(g, centerX + shadowSize, centerY + shadowSize, stoneRadius + fartherShadowSize);
}
g.setPaint(originalPaint);
}
/**
* Draws a stone centered at (centerX, centerY)
*/
private void drawStone(Graphics2D g, Graphics2D gShadow, int centerX, int centerY, Stone color, int x, int y) {
// g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
// RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// if no shadow graphics is supplied, just draw onto the same graphics
if (gShadow == null)
gShadow = g;
if (color.isBlack() || color.isWhite()) {
boolean isBlack = color.isBlack();
boolean isGhost = (color == Stone.BLACK_GHOST || color == Stone.WHITE_GHOST);
if (uiConfig.getBoolean("fancy-stones")) {
drawShadow(gShadow, centerX, centerY, isGhost);
int size = stoneRadius * 2 + 1;
g.drawImage(getScaleStone(isBlack, size), centerX - stoneRadius, centerY - stoneRadius, size, size, null);
} else {
drawShadow(gShadow, centerX, centerY, true);
g.setColor(isBlack ? (isGhost ? new Color(0, 0, 0) : Color.BLACK) : (isGhost ? new Color(255, 255, 255) : Color.WHITE));
fillCircle(g, centerX, centerY, stoneRadius);
if (!isBlack) {
g.setColor(isGhost ? new Color(0, 0, 0) : Color.BLACK);
drawCircle(g, centerX, centerY, stoneRadius);
}
=======
}
if (branch == null
&& (hasMaxWinrate
|| percentPlayouts >= uiConfig.getDouble("min-playout-ratio-for-stats"))
|| isMouseOver) {
double roundedWinrate = round(move.winrate * 10) / 10.0;
if (uiConfig.getBoolean("win-rate-always-black")
&& !Lizzie.board.getData().blackToPlay) {
roundedWinrate = 100.0 - roundedWinrate;
>>>>>>>
}
if (branch == null
&& (hasMaxWinrate
|| percentPlayouts >= uiConfig.getDouble("min-playout-ratio-for-stats"))
|| isMouseOver) {
double roundedWinrate = round(move.winrate * 10) / 10.0;
if (uiConfig.getBoolean("win-rate-always-black")
&& !Lizzie.board.getData().blackToPlay) {
roundedWinrate = 100.0 - roundedWinrate;
<<<<<<<
/**
* Get scaled stone, if cached then return cached
*/
public BufferedImage getScaleStone(boolean isBlack, int size) {
BufferedImage stone = isBlack ? cachedBlackStoneImage : cachedWhiteStoneImage;
if (stone == null || stone.getWidth() != size || stone.getHeight() != size) {
stone = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = stone.createGraphics();
Image img = isBlack ? theme.getBlackStone(new int[]{x, y}) : theme.getWhiteStone(new int[]{x, y});
g2.drawImage(img.getScaledInstance(size, size, java.awt.Image.SCALE_SMOOTH), 0, 0, null);
g2.dispose();
if (isBlack) {
cachedBlackStoneImage = stone;
=======
String text;
if (Lizzie.config.handicapInsteadOfWinrate) {
text = String.format("%.2f", Lizzie.leelaz.winrateToHandicap(move.winrate));
>>>>>>>
String text;
if (Lizzie.config.handicapInsteadOfWinrate) {
text = String.format("%.2f", Lizzie.leelaz.winrateToHandicap(move.winrate));
<<<<<<<
public BufferedImage getWallpaper() {
if (cachedWallpaperImage == null) {
cachedWallpaperImage = theme.getBackground();
=======
drawString(
g,
suggestionX,
suggestionY,
LizzieFrame.OpenSansSemiboldBase,
Font.PLAIN,
text,
stoneRadius,
stoneRadius * 1.5,
1);
drawString(
g,
suggestionX,
suggestionY + stoneRadius * 2 / 5,
LizzieFrame.OpenSansRegularBase,
getPlayoutsString(move.playouts),
(float) (stoneRadius * 0.8),
stoneRadius * 1.4);
}
}
>>>>>>>
drawString(
g,
suggestionX,
suggestionY,
LizzieFrame.OpenSansSemiboldBase,
Font.PLAIN,
text,
stoneRadius,
stoneRadius * 1.5,
1);
drawString(
g,
suggestionX,
suggestionY + stoneRadius * 2 / 5,
LizzieFrame.OpenSansRegularBase,
getPlayoutsString(move.playouts),
(float) (stoneRadius * 0.8),
stoneRadius * 1.4);
}
} |
<<<<<<<
String pondKey = "LizzieFrame.display." + (Lizzie.leelaz.isPondering() ? "on" : "off");
String pondText =
resourceBundle.getString("LizzieFrame.display.pondering")
+ resourceBundle.getString(pondKey);
String switchText = resourceBundle.getString("LizzieFrame.prompt.switching");
String weightText = Lizzie.leelaz.currentWeight();
String text = pondText + " " + weightText + (Lizzie.leelaz.switching() ? switchText : "");
=======
String statusKey = "LizzieFrame.display." + (Lizzie.leelaz.isPondering() ? "on" : "off");
String statusText = resourceBundle.getString(statusKey);
String ponderingText = resourceBundle.getString("LizzieFrame.display.pondering");
String switching = resourceBundle.getString("LizzieFrame.prompt.switching");
String switchingText = Lizzie.leelaz.switching() ? switching : "";
String weightText = Lizzie.leelaz.currentWeight();
String text = ponderingText + " " + statusText + " " + weightText + " " + switchingText;
>>>>>>>
String statusKey = "LizzieFrame.display." + (Lizzie.leelaz.isPondering() ? "on" : "off");
String statusText = resourceBundle.getString(statusKey);
String ponderingText = resourceBundle.getString("LizzieFrame.display.pondering");
String switching = resourceBundle.getString("LizzieFrame.prompt.switching");
String switchingText = Lizzie.leelaz.switching() ? switching : "";
String weightText = Lizzie.leelaz.currentWeight();
String text = ponderingText + " " + statusText + " " + weightText + " " + switchingText;
<<<<<<<
int fontSize = (int) (Math.max(getWidth(), getHeight()) * size);
Font font = new Font(Lizzie.config.fontName, Font.PLAIN, fontSize);
=======
int fontSize = (int) (max(getWidth(), getHeight()) * size);
Font font = new Font(systemDefaultFontName, Font.PLAIN, fontSize);
>>>>>>>
int fontSize = (int) (max(getWidth(), getHeight()) * size);
Font font = new Font(Lizzie.config.fontName, Font.PLAIN, fontSize);
<<<<<<<
int maxSize = Math.min(getWidth(), getHeight());
Font font = new Font(Lizzie.config.fontName, Font.PLAIN, (int) (maxSize * 0.034));
=======
int maxSize = min(getWidth(), getHeight());
Font font = new Font(systemDefaultFontName, Font.PLAIN, (int) (maxSize * 0.034));
>>>>>>>
int maxSize = min(getWidth(), getHeight());
Font font = new Font(Lizzie.config.fontName, Font.PLAIN, (int) (maxSize * 0.034)); |
<<<<<<<
import java.awt.image.ImageObserver;
import java.util.Arrays;
=======
import java.io.IOException;
>>>>>>>
import java.io.IOException;
import java.util.Arrays;
<<<<<<<
if (Lizzie.config.showNextMoves) {
drawNextMoves(g);
}
drawStoneMarkup(g);
}
=======
private int displayedBranchLength = SHOW_NORMAL_BOARD;
private int cachedDisplayedBranchLength = SHOW_RAW_BOARD;
private boolean showingBranch = false;
private boolean isMainBoard = false;
>>>>>>>
private int displayedBranchLength = SHOW_NORMAL_BOARD;
private int cachedDisplayedBranchLength = SHOW_RAW_BOARD;
private boolean showingBranch = false;
private boolean isMainBoard = false;
<<<<<<<
/**
* Draw the green background and go board with lines. We cache the image for a performance boost.
*/
private void drawBackground(Graphics2D g0) {
// draw the cached background image if frame size changes
if (cachedBackgroundImage == null || cachedBackgroundImage.getWidth() != Lizzie.frame.getWidth() ||
cachedBackgroundImage.getHeight() != Lizzie.frame.getHeight() ||
cachedX != x || cachedY != y ||
cachedBackgroundImageHasCoordinatesEnabled != showCoordinates() ||
Lizzie.board.isForceRefresh()) {
Lizzie.board.setForceRefresh(false);
cachedBackgroundImage = new BufferedImage(Lizzie.frame.getWidth(), Lizzie.frame.getHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = cachedBackgroundImage.createGraphics();
// draw the wooden background
drawWoodenBoard(g);
// draw the lines
g.setColor(Color.BLACK);
for (int i = 0; i < Board.BOARD_SIZE; i++) {
g.drawLine(x + scaledMargin, y + scaledMargin + squareLength * i,
x + scaledMargin + availableLength - 1, y + scaledMargin + squareLength * i);
}
for (int i = 0; i < Board.BOARD_SIZE; i++) {
g.drawLine(x + scaledMargin + squareLength * i, y + scaledMargin,
x + scaledMargin + squareLength * i, y + scaledMargin + availableLength - 1);
}
// draw the star points
drawStarPoints(g);
// draw coordinates if enabled
if (showCoordinates()) {
g.setColor(Color.BLACK);
String alphabet = "ABCDEFGHJKLMNOPQRST";
for (int i = 0; i < Board.BOARD_SIZE; i++) {
drawString(g, x + scaledMargin + squareLength * i, y + scaledMargin / 2, LizzieFrame.OpenSansRegularBase, "" + alphabet.charAt(i), stoneRadius * 4 / 5, stoneRadius);
drawString(g, x + scaledMargin + squareLength * i, y - scaledMargin / 2 + boardLength, LizzieFrame.OpenSansRegularBase, "" + alphabet.charAt(i), stoneRadius * 4 / 5, stoneRadius);
}
for (int i = 0; i < Board.BOARD_SIZE; i++) {
drawString(g, x + scaledMargin / 2, y + scaledMargin + squareLength * i, LizzieFrame.OpenSansRegularBase, "" + (Board.BOARD_SIZE - i), stoneRadius * 4 / 5, stoneRadius);
drawString(g, x - scaledMargin / 2 + +boardLength, y + scaledMargin + squareLength * i, LizzieFrame.OpenSansRegularBase, "" + (Board.BOARD_SIZE - i), stoneRadius * 4 / 5, stoneRadius);
}
}
cachedBackgroundImageHasCoordinatesEnabled = showCoordinates();
g.dispose();
}
=======
if (!isShowingRawBoard()) {
drawMoveNumbers(g);
// timer.lap("movenumbers");
if (!Lizzie.frame.isPlayingAgainstLeelaz && Lizzie.config.showBestMoves)
drawLeelazSuggestions(g);
>>>>>>>
if (!isShowingRawBoard()) {
drawMoveNumbers(g);
// timer.lap("movenumbers");
if (!Lizzie.frame.isPlayingAgainstLeelaz && Lizzie.config.showBestMoves)
drawLeelazSuggestions(g);
<<<<<<<
}
return stone;
}
/**
* Draw scale smooth image, enhanced display quality (Not use, for future)
* This function use the traditional Image.getScaledInstance() method
* to provide the nice quality, but the performance is poor.
* Recommended for use in a few drawings
*/
// public void drawScaleSmoothImage(Graphics2D g, BufferedImage img, int x, int y, int width, int height, ImageObserver observer) {
// BufferedImage newstone = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
// Graphics2D g2 = newstone.createGraphics();
// g2.drawImage(img.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH), 0, 0, observer);
// g2.dispose();
// g.drawImage(newstone, x, y, width, height, observer);
// }
/**
* Draw scale smooth image, enhanced display quality (Not use, for future)
* This functions use a multi-step approach to prevent the information loss
* and produces a much higher quality that is close to the Image.getScaledInstance()
* and faster than Image.getScaledInstance() method.
*/
// public void drawScaleImage(Graphics2D g, BufferedImage img, int x, int y, int width, int height, ImageObserver observer) {
// BufferedImage newstone = (BufferedImage)img;
// int w = img.getWidth();
// int h = img.getHeight();
// do {
// if (w > width) {
// w /= 2;
// if (w < width) {
// w = width;
// }
// }
// if (h > height) {
// h /= 2;
// if (h < height) {
// h = height;
// }
// }
// BufferedImage tmp = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
// Graphics2D g2 = tmp.createGraphics();
// g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
// g2.drawImage(newstone, 0, 0, w, h, null);
// g2.dispose();
// newstone = tmp;
// }
// while (w != width || h != height);
// g.drawImage(newstone, x, y, width, height, observer);
// }
/**
* Draw texture image
*/
public void drawTextureImage(Graphics2D g, BufferedImage img, int x, int y, int width, int height) {
TexturePaint paint = new TexturePaint(img, new Rectangle(0, 0, img.getWidth(), img.getHeight()));
g.setPaint(paint);
g.fill(new Rectangle(x, y, width, height));
}
/**
* Draw stone Markups
*
* @param g
*/
private void drawStoneMarkup(Graphics2D g) {
BoardData data = Lizzie.board.getHistory().getData();
data.getProperties().forEach((key, value) -> {
if (SGFParser.isListProperty(key)) {
String[] labels = value.split(",");
for (String label : labels) {
String[] moves = label.split(":");
int[] move = SGFParser.convertSgfPosToCoord(moves[0]);
if (move != null) {
int[] lastMove = branch == null ? Lizzie.board.getLastMove() : branch.data.lastMove;
if (!Arrays.equals(move, lastMove)) {
int moveX = x + scaledMargin + squareLength * move[0];
int moveY = y + scaledMargin + squareLength * move[1];
g.setColor(Lizzie.board.getStones()[Board.getIndex(move[0], move[1])].isBlack() ? Color.WHITE : Color.BLACK);
g.setStroke(new BasicStroke(2));
if ("LB".equals(key) && moves.length > 1) {
// Label
drawString(g, moveX, moveY, LizzieFrame.OpenSansRegularBase, moves[1], (float) (stoneRadius * 1.4), (int) (stoneRadius * 1.4));
} else if ("TR".equals(key)) {
// Triangle
drawTriangle(g, moveX, moveY, (stoneRadius + 1)*2/3);
} else if ("SQ".equals(key)) {
// Square
drawSquare(g, moveX, moveY, (stoneRadius + 1)/2);
} else if ("CR".equals(key)) {
// Circle
drawCircle(g, moveX, moveY, stoneRadius*2/3);
} else if ("MA".equals(key)) {
// Mark (X)
drawMarkX(g, moveX, moveY, (stoneRadius + 1)/2);
}
}
}
}
}
});
}
/**
* Draws the triangle of a circle centered at (centerX, centerY) with radius $radius$
*/
private void drawTriangle(Graphics2D g, int centerX, int centerY, int radius) {
int offset = (int)(3.0/2.0*radius/Math.sqrt(3.0));
int x[] = {centerX, centerX - offset, centerX + offset};
int y[] = {centerY - radius, centerY + radius/2, centerY + radius/2};
g.drawPolygon(x, y, 3);
}
/**
* Draws the square of a circle centered at (centerX, centerY) with radius $radius$
*/
private void drawSquare(Graphics2D g, int centerX, int centerY, int radius) {
g.drawRect(centerX - radius, centerY - radius, radius * 2, radius * 2);
}
/**
* Draws the mark(X) of a circle centered at (centerX, centerY) with radius $radius$
*/
private void drawMarkX(Graphics2D g, int centerX, int centerY, int radius) {
g.drawLine(centerX - radius, centerY - radius, centerX + radius, centerY + radius);
g.drawLine(centerX - radius, centerY + radius, centerX + radius, centerY - radius);
}
/**
* Fills in a circle centered at (centerX, centerY) with radius $radius$
*/
private void fillCircle(Graphics2D g, int centerX, int centerY, int radius) {
g.fillOval(centerX - radius, centerY - radius, 2 * radius + 1, 2 * radius + 1);
}
/**
* Draws the outline of a circle centered at (centerX, centerY) with radius $radius$
*/
private void drawCircle(Graphics2D g, int centerX, int centerY, int radius) {
g.drawOval(centerX - radius, centerY - radius, 2 * radius + 1, 2 * radius + 1);
}
=======
>>>>>>> |
<<<<<<<
=======
import java.io.IOException;
import java.util.Arrays;
>>>>>>>
import java.io.IOException;
import java.util.Arrays;
<<<<<<<
LizzieFrame.uiFont,
"" + (Board.BOARD_SIZE - i),
=======
LizzieFrame.OpenSansRegularBase,
"" + (Board.boardSize - i),
>>>>>>>
LizzieFrame.uiFont,
"" + (Board.BOARD_SIZE - i),
<<<<<<<
LizzieFrame.uiFont,
"" + (Board.BOARD_SIZE - i),
=======
LizzieFrame.OpenSansRegularBase,
"" + (Board.boardSize - i),
>>>>>>>
LizzieFrame.uiFont,
"" + (Board.BOARD_SIZE - i), |
<<<<<<<
import org.json.JSONArray;
import org.json.JSONException;
=======
>>>>>>>
<<<<<<<
public static LizzieFrame frame;
public static Leelaz leelaz;
public static Board board;
public static Config config;
public static String lizzieVersion = "0.5";
/**
* Launches the game window, and runs the game.
*/
public static void main(String[] args) throws IOException, JSONException, ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, InterruptedException {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
config = new Config();
// Check that user has installed leela zero
JSONObject leelazconfig = Lizzie.config.config.getJSONObject("leelaz");
ResourceBundle resourceBundle = ResourceBundle.getBundle("l10n.DisplayStrings");
String startfolder = leelazconfig.optString("engine-start-location", ".");
// Check if engine is present
File lef = new File(startfolder + '/' + "leelaz");
if (!lef.exists()) {
File leexe = new File(startfolder + '/' + "leelaz.exe");
if (!leexe.exists()) {
JOptionPane.showMessageDialog(null, resourceBundle.getString("LizzieFrame.display.leelaz-missing"), "Lizzie - Error!", JOptionPane.ERROR_MESSAGE);
return;
}
}
PluginManager.loadPlugins();
board = new Board();
frame = new LizzieFrame();
new Thread( () -> {
try {
leelaz = new Leelaz();
if(config.handicapInsteadOfWinrate) {
leelaz.estimatePassWinrate();
}
if (args.length == 1) {
frame.loadFile(new File(args[0]));
} else if (config.config.getJSONObject("ui").getBoolean("resume-previous-game")) {
board.resumePreviousGame();
}
leelaz.togglePonder();
} catch (IOException e) {
e.printStackTrace();
}
}).start();
=======
public static LizzieFrame frame;
public static Leelaz leelaz;
public static Board board;
public static Config config;
public static String lizzieVersion = "0.5";
private static String[] args;
/** Launches the game window, and runs the game. */
public static void main(String[] args) throws IOException {
setLookAndFeel();
args = args;
config = new Config();
board = new Board();
frame = new LizzieFrame();
new Thread(Lizzie::run).start();
}
public static void run() {
try {
leelaz = new Leelaz();
if (config.handicapInsteadOfWinrate) {
leelaz.estimatePassWinrate();
}
if (args.length == 1) {
frame.loadFile(new File(args[0]));
} else if (config.config.getJSONObject("ui").getBoolean("resume-previous-game")) {
board.resumePreviousGame();
}
leelaz.togglePonder();
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
public static void setLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
}
public static void shutdown() {
if (board != null && config.config.getJSONObject("ui").getBoolean("confirm-exit")) {
int ret =
JOptionPane.showConfirmDialog(
null, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
LizzieFrame.saveFile();
}
}
if (board != null) {
board.autosaveToMemory();
>>>>>>>
public static LizzieFrame frame;
public static Leelaz leelaz;
public static Board board;
public static Config config;
public static String lizzieVersion = "0.5";
private static String[] args;
/** Launches the game window, and runs the game. */
public static void main(String[] args) throws IOException {
setLookAndFeel();
args = args;
config = new Config();
board = new Board();
frame = new LizzieFrame();
new Thread(Lizzie::run).start();
}
public static void run() {
try {
leelaz = new Leelaz();
if (config.handicapInsteadOfWinrate) {
leelaz.estimatePassWinrate();
}
if (args.length == 1) {
frame.loadFile(new File(args[0]));
} else if (config.config.getJSONObject("ui").getBoolean("resume-previous-game")) {
board.resumePreviousGame();
}
leelaz.togglePonder();
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
public static void setLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
}
public static void shutdown() {
if (board != null && config.config.getJSONObject("ui").getBoolean("confirm-exit")) {
int ret =
JOptionPane.showConfirmDialog(
null, "Do you want to save this SGF?", "Save SGF?", JOptionPane.OK_CANCEL_OPTION);
if (ret == JOptionPane.OK_OPTION) {
LizzieFrame.saveFile();
}
}
if (board != null) {
board.autosaveToMemory();
<<<<<<<
/**
* Switch the Engine by index number
* @param index engine index
*/
public static void switchEngine(int index) {
String commandLine = null;
if (index == 0) {
commandLine = Lizzie.config.leelazConfig.getString("engine-command");
commandLine = commandLine.replaceAll("%network-file", Lizzie.config.leelazConfig.getString("network-file"));
} else {
JSONArray commandList = Lizzie.config.leelazConfig.getJSONArray("engine-command-list");
if (commandList != null && commandList.length() >= index) {
commandLine = commandList.getString(index - 1);
} else {
index = -1;
}
}
if (index < 0 || commandLine == null || commandLine.trim().isEmpty() || index == Lizzie.leelaz.currentEngineN()) {
return;
}
// Workaround for leelaz cannot exit when restarting
if (leelaz.isThinking) {
if (Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.frame.isPlayingAgainstLeelaz = false;
Lizzie.leelaz.togglePonder(); // we must toggle twice for it to restart pondering
Lizzie.leelaz.isThinking = false;
}
Lizzie.leelaz.togglePonder();
}
board.saveMoveNumber();
try {
leelaz.restartEngine(commandLine, index);
board.restoreMoveNumber();
} catch (IOException e) {
e.printStackTrace();
}
}
=======
if (leelaz != null) leelaz.shutdown();
System.exit(0);
}
>>>>>>>
if (leelaz != null) leelaz.shutdown();
System.exit(0);
}
/**
* Switch the Engine by index number
*
* @param index engine index
*/
public static void switchEngine(int index) {
String commandLine = null;
if (index == 0) {
commandLine = Lizzie.config.leelazConfig.getString("engine-command");
commandLine =
commandLine.replaceAll(
"%network-file", Lizzie.config.leelazConfig.getString("network-file"));
} else {
JSONArray commandList = Lizzie.config.leelazConfig.getJSONArray("engine-command-list");
if (commandList != null && commandList.length() >= index) {
commandLine = commandList.getString(index - 1);
} else {
index = -1;
}
}
if (index < 0
|| commandLine == null
|| commandLine.trim().isEmpty()
|| index == Lizzie.leelaz.currentEngineN()) {
return;
}
// Workaround for leelaz cannot exit when restarting
if (leelaz.isThinking) {
if (Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.frame.isPlayingAgainstLeelaz = false;
Lizzie.leelaz.togglePonder(); // we must toggle twice for it to restart pondering
Lizzie.leelaz.isThinking = false;
}
Lizzie.leelaz.togglePonder();
}
board.saveMoveNumber();
try {
leelaz.restartEngine(commandLine, index);
board.restoreMoveNumber();
} catch (IOException e) {
e.printStackTrace();
}
} |
<<<<<<<
colorByWinrateInsteadOfVisits = uiConfig.optBoolean("color-by-winrate-instead-of-visits");
=======
boardPositionProportion = uiConfig.optInt("board-postion-proportion", 4);
>>>>>>>
colorByWinrateInsteadOfVisits = uiConfig.optBoolean("color-by-winrate-instead-of-visits");
boardPositionProportion = uiConfig.optInt("board-postion-proportion", 4); |
<<<<<<<
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
=======
import javax.swing.*;
import org.json.JSONException;
import org.json.JSONObject;
>>>>>>>
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.*;
import org.json.JSONException;
import org.json.JSONObject;
<<<<<<<
// start a thread to continuously read Leelaz output
//new Thread(this::read).start();
//can stop engine for switching weights
executor = Executors.newSingleThreadScheduledExecutor();
executor.execute(this::read);
}
public void restartEngine(String engineCommand, int index) throws IOException {
if (engineCommand == null || engineCommand.trim().isEmpty()) {
return;
}
switching = true;
this.engineCommand = engineCommand;
// stop the ponder
if (Lizzie.leelaz.isPondering()) {
Lizzie.leelaz.togglePonder();
}
normalQuit();
startEngine(engineCommand);
currentEngineN = index;
togglePonder();
}
public void normalQuit() {
sendCommand("quit");
executor.shutdown();
try {
while (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
if (executor.awaitTermination(1, TimeUnit.SECONDS)) {
shutdown();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
=======
if (config.getBoolean("automatically-download-latest-network")) {
updateToLatestNetwork();
>>>>>>>
if (config.getBoolean("automatically-download-latest-network")) {
updateToLatestNetwork();
}
// command string for starting the engine
engineCommand = config.getString("engine-command");
// substitute in the weights file
engineCommand = engineCommand.replaceAll("%network-file", config.getString("network-file"));
// Initialize current engine number and start engine
currentEngineN = 0;
startEngine(engineCommand);
Lizzie.frame.refreshBackground();
}
public void startEngine(String engineCommand) throws IOException {
// Check engine command
if (engineCommand == null || engineCommand.trim().isEmpty()) {
return;
<<<<<<<
/**
* Parse a line of Leelaz output
*
* @param line output line
*/
private void parseLine(String line) {
synchronized (this) {
if (line.startsWith("komi="))
{
try {
dynamicKomi = Float.parseFloat(line.substring("komi=".length()).trim());
}
catch (NumberFormatException nfe) {
dynamicKomi = Float.NaN;
}
}
else if (line.startsWith("opp_komi="))
{
try {
dynamicOppKomi = Float.parseFloat(line.substring("opp_komi=".length()).trim());
}
catch (NumberFormatException nfe) {
dynamicOppKomi = Float.NaN;
}
}
else if (line.equals("\n")) {
// End of response
} else if (line.startsWith("info")) {
isLoaded = true;
// Clear switching prompt
switching = false;
// Display engine command in the title
if (Lizzie.frame != null) Lizzie.frame.updateTitle();
if (isResponseUpToDate()) {
// This should not be stale data when the command number match
parseInfo(line.substring(5));
notifyBestMoveListeners();
if (Lizzie.frame != null) Lizzie.frame.repaint();
// don't follow the maxAnalyzeTime rule if we are in analysis mode
if (System.currentTimeMillis() - startPonderTime > maxAnalyzeTimeMillis && !Lizzie.board.inAnalysisMode()) {
togglePonder();
}
}
} else if (line.startsWith("play")) {
// In lz-genmove_analyze
if (Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.board.place(line.substring(5).trim());
}
isThinking = false;
} else if (Lizzie.frame != null && (line.startsWith("=") || line.startsWith("?"))) {
if (printCommunication) {
System.out.print(line);
}
String[] params = line.trim().split(" ");
currentCmdNum = Integer.parseInt(params[0].substring(1).trim());
trySendCommandFromQueue();
if (line.startsWith("?") || params.length == 1) return;
if (isSettingHandicap) {
for (int i = 1; i < params.length; i++) {
int[] coordinates = Lizzie.board.convertNameToCoordinates(params[i]);
Lizzie.board.getHistory().setStone(coordinates, Stone.BLACK);
}
isSettingHandicap = false;
} else if (isThinking && !isPondering) {
if (Lizzie.frame.isPlayingAgainstLeelaz) {
Lizzie.board.place(params[1]);
isThinking = false;
}
} else if (isCheckingVersion) {
String[] ver = params[1].split("\\.");
int minor = Integer.parseInt(ver[1]);
// Gtp support added in version 15
if (minor < 15) {
JOptionPane.showMessageDialog(Lizzie.frame, "Lizzie requires version 0.15 or later of Leela Zero for analysis (found " + params[1] + ")");
}
isCheckingVersion = false;
}
}
}
=======
return !currentNetworkHash.equals(bestNetworkHash);
>>>>>>>
return !currentNetworkHash.equals(bestNetworkHash);
<<<<<<<
int c;
StringBuilder line = new StringBuilder();
while ((c = inputStream.read()) != -1) {
line.append((char) c);
if ((c == '\n')) {
parseLine(line.toString());
line = new StringBuilder();
}
}
// this line will be reached when Leelaz shuts down
System.out.println("Leelaz process ended.");
shutdown();
// Do no exit for switching weights
//System.exit(-1);
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
=======
dynamicKomi = Float.parseFloat(line.substring("komi=".length()).trim());
} catch (NumberFormatException nfe) {
dynamicKomi = Float.NaN;
>>>>>>>
dynamicKomi = Float.parseFloat(line.substring("komi=".length()).trim());
} catch (NumberFormatException nfe) {
dynamicKomi = Float.NaN;
<<<<<<<
public boolean isLoaded() {
return isLoaded;
}
public String currentWeight() {
return currentWeight;
}
public boolean switching() {
return switching;
}
public int currentEngineN() {
return currentEngineN;
}
public String engineCommand() {
return this.engineCommand;
}
=======
public boolean isLoaded() {
return isLoaded;
}
>>>>>>>
public boolean isLoaded() {
return isLoaded;
}
public String currentWeight() {
return currentWeight;
}
public boolean switching() {
return switching;
}
public int currentEngineN() {
return currentEngineN;
}
public String engineCommand() {
return this.engineCommand;
} |
<<<<<<<
public boolean showCommentNodeColor = true;
public Color commentNodeColor = null;
public Optional<List<Double>> blunderWinrateThresholds;
public Optional<Map<Double, Color>> blunderNodeColors;
public int nodeColorMode = 0;
=======
public boolean appendWinrateToComment = false;
>>>>>>>
public boolean showCommentNodeColor = true;
public Color commentNodeColor = null;
public Optional<List<Double>> blunderWinrateThresholds;
public Optional<Map<Double, Color>> blunderNodeColors;
public int nodeColorMode = 0;
public boolean appendWinrateToComment = false; |
<<<<<<<
isQuittingNormally = true;
=======
final int MAX_TRIALS = 5;
>>>>>>>
final int MAX_TRIALS = 5;
isQuittingNormally = true; |
<<<<<<<
private void listProposals() {
Optional<ProposalList> result = client.getProposalsList();
if (result.isPresent()) {
ProposalList proposalList = result.get();
logger.info(Utils.printProposalsList(proposalList));
} else {
logger.info("List witnesses " + " failed !!");
}
}
private void getProposal(String[] parameters) {
if (parameters == null || parameters.length != 1) {
System.out.println("getProposal needs 1 parameter like following: ");
System.out.println("getProposal id ");
return;
}
String id = parameters[0];
Optional<Proposal> result = WalletClient.getProposal(id);
if (result.isPresent()) {
Proposal proposal = result.get();
logger.info(Utils.printProposal(proposal));
} else {
logger.info("getProposal " + " failed !!");
}
}
=======
private void deleteProposal(String[] parameters)
throws IOException, CipherException, CancelException {
if (parameters == null || parameters.length != 1) {
System.out.println("Use deleteProposal command with below syntax: ");
System.out.println("deleteProposal proposalId");
return;
}
long id = Long.valueOf(parameters[0]);
boolean result = client.deleteProposal(id);
if (result) {
logger.info("deleteProposal " + " successful !!");
} else {
logger.info("deleteProposal " + " failed !!");
}
}
>>>>>>>
private void deleteProposal(String[] parameters)
throws IOException, CipherException, CancelException {
if (parameters == null || parameters.length != 1) {
System.out.println("Use deleteProposal command with below syntax: ");
System.out.println("deleteProposal proposalId");
return;
}
long id = Long.valueOf(parameters[0]);
boolean result = client.deleteProposal(id);
if (result) {
logger.info("deleteProposal " + " successful !!");
} else {
logger.info("deleteProposal " + " failed !!");
}
}
private void listProposals() {
Optional<ProposalList> result = client.getProposalsList();
if (result.isPresent()) {
ProposalList proposalList = result.get();
logger.info(Utils.printProposalsList(proposalList));
} else {
logger.info("List witnesses " + " failed !!");
}
}
private void getProposal(String[] parameters) {
if (parameters == null || parameters.length != 1) {
System.out.println("getProposal needs 1 parameter like following: ");
System.out.println("getProposal id ");
return;
}
String id = parameters[0];
Optional<Proposal> result = WalletClient.getProposal(id);
if (result.isPresent()) {
Proposal proposal = result.get();
logger.info(Utils.printProposal(proposal));
} else {
logger.info("getProposal " + " failed !!");
}
}
<<<<<<<
case "listProposals": {
listProposals();
break;
}
case "getProposals": {
getProposal(parameters);
break;
}
=======
case "approveproposal": {
approveProposal(parameters);
break;
}
case "deleteproposal": {
deleteProposal(parameters);
break;
}
>>>>>>>
case "listProposals": {
listProposals();
break;
}
case "getProposals": {
getProposal(parameters);
break;
}
case "approveproposal": {
approveProposal(parameters);
break;
}
case "deleteproposal": {
deleteProposal(parameters);
break;
} |
<<<<<<<
public TransactionExtention updateBrokerage(Contract.UpdateBrokerageContract request) {
return blockingStubFull.updateBrokerage(request);
}
public NumberMessage getReward(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
if (blockingStubSolidity != null) {
return blockingStubSolidity.getRewardInfo(bytesMessage);
} else {
return blockingStubFull.getRewardInfo(bytesMessage);
}
}
public NumberMessage getBrokerage(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
if (blockingStubSolidity != null) {
return blockingStubSolidity.getBrokerageInfo(bytesMessage);
} else {
return blockingStubFull.getBrokerageInfo(bytesMessage);
}
}
=======
public TransactionExtention createShieldedTransaction(PrivateParameters privateParameters) {
return blockingStubFull.createShieldedTransaction(privateParameters);
}
public IncrementalMerkleVoucherInfo GetMerkleTreeVoucherInfo(OutputPointInfo info) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.getMerkleTreeVoucherInfo(info);
} else {
return blockingStubFull.getMerkleTreeVoucherInfo(info);
}
}
public DecryptNotes scanNoteByIvk(IvkDecryptParameters ivkDecryptParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanNoteByIvk(ivkDecryptParameters);
} else {
return blockingStubFull.scanNoteByIvk(ivkDecryptParameters);
}
}
public DecryptNotes scanNoteByOvk(OvkDecryptParameters ovkDecryptParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanNoteByOvk(ovkDecryptParameters);
} else {
return blockingStubFull.scanNoteByOvk(ovkDecryptParameters);
}
}
public BytesMessage getSpendingKey() {
return blockingStubFull.getSpendingKey(EmptyMessage.newBuilder().build());
}
public ExpandedSpendingKeyMessage getExpandedSpendingKey(BytesMessage spendingKey) {
return blockingStubFull.getExpandedSpendingKey(spendingKey);
}
public BytesMessage getAkFromAsk(BytesMessage ask) {
return blockingStubFull.getAkFromAsk(ask);
}
public BytesMessage getNkFromNsk(BytesMessage nsk) {
return blockingStubFull.getNkFromNsk(nsk);
}
public IncomingViewingKeyMessage getIncomingViewingKey(ViewingKeyMessage viewingKeyMessage) {
return blockingStubFull.getIncomingViewingKey(viewingKeyMessage);
}
public DiversifierMessage getDiversifier() {
return blockingStubFull.getDiversifier(EmptyMessage.newBuilder().build());
}
public BytesMessage getRcm() {
return blockingStubFull.getRcm(EmptyMessage.newBuilder().build());
}
public SpendResult isNoteSpend(NoteParameters noteParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.isSpend(noteParameters);
} else {
return blockingStubFull.isSpend(noteParameters);
}
}
public TransactionExtention createShieldedTransactionWithoutSpendAuthSig(
PrivateParametersWithoutAsk privateParameters) {
return blockingStubFull.createShieldedTransactionWithoutSpendAuthSig(privateParameters);
}
public BytesMessage getShieldedTransactionHash(Transaction transaction) {
return blockingStubFull.getShieldTransactionHash(transaction);
}
public BytesMessage createSpendAuthSig(SpendAuthSigParameters parameters) {
return blockingStubFull.createSpendAuthSig(parameters);
}
public BytesMessage createShieldedNullifier(NfParameters parameters) {
return blockingStubFull.createShieldNullifier(parameters);
}
public PaymentAddressMessage getZenPaymentAddress(IncomingViewingKeyDiversifierMessage msg) {
return blockingStubFull.getZenPaymentAddress(msg);
}
public DecryptNotesMarked scanAndMarkNoteByIvk(IvkDecryptAndMarkParameters parameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanAndMarkNoteByIvk(parameters);
} else {
return blockingStubFull.scanAndMarkNoteByIvk(parameters);
}
}
public TransactionExtention updateBrokerage(Contract.UpdateBrokerageContract request) {
return blockingStubFull.updateBrokerage(request);
}
public NumberMessage getReward(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
return blockingStubFull.getRewardInfo(bytesMessage);
}
public NumberMessage getBrokerage(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
return blockingStubFull.getBrokerageInfo(bytesMessage);
}
>>>>>>>
public TransactionExtention createShieldedTransaction(PrivateParameters privateParameters) {
return blockingStubFull.createShieldedTransaction(privateParameters);
}
public IncrementalMerkleVoucherInfo GetMerkleTreeVoucherInfo(OutputPointInfo info) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.getMerkleTreeVoucherInfo(info);
} else {
return blockingStubFull.getMerkleTreeVoucherInfo(info);
}
}
public DecryptNotes scanNoteByIvk(IvkDecryptParameters ivkDecryptParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanNoteByIvk(ivkDecryptParameters);
} else {
return blockingStubFull.scanNoteByIvk(ivkDecryptParameters);
}
}
public DecryptNotes scanNoteByOvk(OvkDecryptParameters ovkDecryptParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanNoteByOvk(ovkDecryptParameters);
} else {
return blockingStubFull.scanNoteByOvk(ovkDecryptParameters);
}
}
public BytesMessage getSpendingKey() {
return blockingStubFull.getSpendingKey(EmptyMessage.newBuilder().build());
}
public ExpandedSpendingKeyMessage getExpandedSpendingKey(BytesMessage spendingKey) {
return blockingStubFull.getExpandedSpendingKey(spendingKey);
}
public BytesMessage getAkFromAsk(BytesMessage ask) {
return blockingStubFull.getAkFromAsk(ask);
}
public BytesMessage getNkFromNsk(BytesMessage nsk) {
return blockingStubFull.getNkFromNsk(nsk);
}
public IncomingViewingKeyMessage getIncomingViewingKey(ViewingKeyMessage viewingKeyMessage) {
return blockingStubFull.getIncomingViewingKey(viewingKeyMessage);
}
public DiversifierMessage getDiversifier() {
return blockingStubFull.getDiversifier(EmptyMessage.newBuilder().build());
}
public BytesMessage getRcm() {
return blockingStubFull.getRcm(EmptyMessage.newBuilder().build());
}
public SpendResult isNoteSpend(NoteParameters noteParameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.isSpend(noteParameters);
} else {
return blockingStubFull.isSpend(noteParameters);
}
}
public TransactionExtention createShieldedTransactionWithoutSpendAuthSig(
PrivateParametersWithoutAsk privateParameters) {
return blockingStubFull.createShieldedTransactionWithoutSpendAuthSig(privateParameters);
}
public BytesMessage getShieldedTransactionHash(Transaction transaction) {
return blockingStubFull.getShieldTransactionHash(transaction);
}
public BytesMessage createSpendAuthSig(SpendAuthSigParameters parameters) {
return blockingStubFull.createSpendAuthSig(parameters);
}
public BytesMessage createShieldedNullifier(NfParameters parameters) {
return blockingStubFull.createShieldNullifier(parameters);
}
public PaymentAddressMessage getZenPaymentAddress(IncomingViewingKeyDiversifierMessage msg) {
return blockingStubFull.getZenPaymentAddress(msg);
}
public DecryptNotesMarked scanAndMarkNoteByIvk(IvkDecryptAndMarkParameters parameters) {
if (blockingStubSolidity != null) {
return blockingStubSolidity.scanAndMarkNoteByIvk(parameters);
} else {
return blockingStubFull.scanAndMarkNoteByIvk(parameters);
}
}
public TransactionExtention updateBrokerage(Contract.UpdateBrokerageContract request) {
return blockingStubFull.updateBrokerage(request);
}
public NumberMessage getReward(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
if (blockingStubSolidity != null) {
return blockingStubSolidity.getRewardInfo(bytesMessage);
} else {
return blockingStubFull.getRewardInfo(bytesMessage);
}
}
public NumberMessage getBrokerage(byte[] address) {
BytesMessage bytesMessage = BytesMessage.newBuilder().setValue(ByteString.copyFrom(address))
.build();
if (blockingStubSolidity != null) {
return blockingStubSolidity.getBrokerageInfo(bytesMessage);
} else {
return blockingStubFull.getBrokerageInfo(bytesMessage);
}
} |
<<<<<<<
"MarketCancelOrder",
"MarketSellAsset",
=======
// "LoadShieldedWallet",
"LoadShieldedTRC20Wallet",
>>>>>>>
"LoadShieldedTRC20Wallet",
// "LoadShieldedWallet",
"MarketCancelOrder",
"MarketSellAsset",
<<<<<<<
"GetNkFromNsk",
"GetProposal",
"GetReward",
"GetShieldedNullifier",
=======
// "GetShieldedNullifier",
"GetShieldedPaymentAddress",
>>>>>>>
"GetNkFromNsk",
"GetProposal",
"GetReward",
// "GetShieldedNullifier",
"GetShieldedPaymentAddress",
<<<<<<<
"MarketCancelOrder",
"MarketSellAsset",
=======
// "LoadShieldedWallet",
"LoadShieldedTRC20Wallet",
>>>>>>>
"LoadShieldedTRC20Wallet",
// "LoadShieldedWallet",
"MarketCancelOrder",
"MarketSellAsset",
"ParticipateAssetIssue",
"RegisterWallet",
// "ResetShieldedNote",
"ResetShieldedTRC20Note",
// "ScanAndMarkNotebyAddress",
// "ScanNotebyIvk",
// "ScanNotebyOvk",
"ScanShieldedTRC20NoteByIvk",
"ScanShieldedTRC20NoteByOvk",
"SendCoin",
// "SendShieldedCoin",
// "SendShieldedCoinWithoutAsk",
"SendShieldedTRC20Coin",
"SendShieldedTRC20CoinWithoutAsk",
"SetAccountId",
"SetShieldedTRC20ContractAddress",
// "ShowShieldedAddressInfo",
"ShowShieldedTRC20AddressInfo",
"TransferAsset",
"TriggerConstantContract contractAddress method args isHex",
"TriggerContract contractAddress method args isHex fee_limit value",
"UnfreezeAsset",
"UnfreezeBalance",
"UpdateAccount",
"UpdateAccountPermission",
"UpdateAsset",
"UpdateBrokerage",
"UpdateEnergyLimit contract_address energy_limit",
"UpdateSetting contract_address consume_user_resource_percent",
"UpdateWitness",
"VoteWitness",
"WithdrawBalance",
};
// note: this is sorted by alpha
private static String[] commandList = {
"AddTransactionSign",
"ApproveProposal",
"AssetIssue",
// "BackupShieldedWallet",
"BackupShieldedTRC20Wallet",
"BackupWallet",
"BackupWallet2Base64",
"BroadcastTransaction",
"ChangePassword",
"ClearContractABI",
"Create2",
"CreateAccount",
"CreateProposal",
"CreateWitness",
"DeleteProposal",
"DeployContract",
"ExchangeCreate",
"ExchangeInject",
"ExchangeTransaction",
"ExchangeWithdraw",
"FreezeBalance",
"GenerateAddress",
// "GenerateShieldedAddress",
"GenerateShieldedTRC20Address",
"GetAccount",
"GetAccountNet",
"GetAccountResource",
"GetAddress",
"GetAkFromAsk",
"GetAssetIssueByAccount",
"GetAssetIssueById",
"GetAssetIssueByName",
"GetAssetIssueListByName",
"GetBalance",
"GetBlock",
"GetBlockById",
"GetBlockByLatestNum",
"GetBlockByLimitNext",
"GetBrokerage",
"GetChainParameters",
"GetContract",
"GetDelegatedResource",
"GetDelegatedResourceAccountIndex",
"GetDiversifier",
"GetExchange",
"GetExpandedSpendingKey",
"GetIncomingViewingKey",
"GetMarketOrderByAccount",
"GetMarketOrderById",
"GetMarketOrderListByPair",
"GetMarketPairList",
"GetMarketPriceByPair",
"GetNextMaintenanceTime",
"GetNkFromNsk",
"GetProposal",
"GetReward",
// "GetShieldedNullifier",
"GetShieldedPaymentAddress",
"GetSpendingKey",
"GetTotalTransaction",
"GetTransactionApprovedList",
"GetTransactionById",
"GetTransactionCountByBlockNum",
"GetTransactionInfoByBlockNum",
"GetTransactionInfoById",
"GetTransactionSignWeight",
"GetTransactionsFromThis",
"GetTransactionsToThis",
"Help",
"ImportShieldedTRC20Wallet",
// "ImportShieldedWallet",
"ImportWallet",
"ImportWalletByBase64",
"ListAssetIssue",
"ListAssetIssuePaginated",
"ListExchanges",
"ListExchangesPaginated",
"ListNodes",
// "ListShieldedAddress",
// "ListShieldedNote",
"ListShieldedTRC20Address",
"ListShieldedTRC20Note",
"ListProposals",
"ListProposalsPaginated",
"ListShieldedAddress",
"ListShieldedNote",
"ListWitnesses",
"Login",
"Logout",
"LoadShieldedTRC20Wallet",
// "LoadShieldedWallet",
"MarketCancelOrder",
"MarketSellAsset",
<<<<<<<
case "marketsellasset": {
marketSellAsset(parameters);
break;
}
case "marketcancelorder": {
marketCancelOrder(parameters);
break;
}
case "getmarketorderbyaccount": {
getMarketOrderByAccount(parameters);
break;
}
case "getmarketpricebypair": {
getMarketPriceByPair(parameters);
break;
}
case "getmarketorderlistbypair": {
getMarketOrderListByPair(parameters);
break;
}
case "getmarketpairlist": {
getMarketPairList(parameters);
break;
}
case "getmarketorderbyid": {
getMarketOrderById(parameters);
break;
}
=======
case "setshieldedtrc20contractaddress": {
setShieldedTRC20ContractAddress(parameters);
break;
}
case "backupshieldedtrc20wallet": {
backupShieldedTRC20Wallet();
break;
}
case "generateshieldedtrc20address": {
generateShieldedTRC20Address(parameters);
break;
}
case "importshieldedtrc20wallet": {
importShieldedTRC20Wallet();
break;
}
case "listshieldedtrc20address": {
listShieldedTRC20Address();
break;
}
case "listshieldedtrc20note": {
listShieldedTRC20Note(parameters);
break;
}
case "loadshieldedtrc20wallet": {
loadShieldedTRC20Wallet();
break;
}
case "resetshieldedtrc20note": {
resetShieldedTRC20Note();
break;
}
case "scanshieldedtrc20notebyivk": {
scanShieldedTRC20NoteByIvk(parameters);
break;
}
case "scanshieldedtrc20notebyovk": {
scanShieldedTRC20NoteByOvk(parameters);
break;
}
case "sendshieldedtrc20coin": {
sendShieldedTRC20Coin(parameters);
break;
}
case "sendshieldedtrc20coinwithoutask": {
sendShieldedTRC20CoinWithoutAsk(parameters);
break;
}
case "showshieldedtrc20addressinfo": {
showShieldedTRC20AddressInfo(parameters);
break;
}
case "gettransactioninfobyblocknum": {
getTransactionInfoByBlockNum(parameters);
break;
}
>>>>>>>
case "setshieldedtrc20contractaddress": {
setShieldedTRC20ContractAddress(parameters);
break;
}
case "backupshieldedtrc20wallet": {
backupShieldedTRC20Wallet();
break;
}
case "generateshieldedtrc20address": {
generateShieldedTRC20Address(parameters);
break;
}
case "importshieldedtrc20wallet": {
importShieldedTRC20Wallet();
break;
}
case "listshieldedtrc20address": {
listShieldedTRC20Address();
break;
}
case "listshieldedtrc20note": {
listShieldedTRC20Note(parameters);
break;
}
case "loadshieldedtrc20wallet": {
loadShieldedTRC20Wallet();
break;
}
case "resetshieldedtrc20note": {
resetShieldedTRC20Note();
break;
}
case "scanshieldedtrc20notebyivk": {
scanShieldedTRC20NoteByIvk(parameters);
break;
}
case "scanshieldedtrc20notebyovk": {
scanShieldedTRC20NoteByOvk(parameters);
break;
}
case "sendshieldedtrc20coin": {
sendShieldedTRC20Coin(parameters);
break;
}
case "sendshieldedtrc20coinwithoutask": {
sendShieldedTRC20CoinWithoutAsk(parameters);
break;
}
case "showshieldedtrc20addressinfo": {
showShieldedTRC20AddressInfo(parameters);
break;
}
case "gettransactioninfobyblocknum": {
getTransactionInfoByBlockNum(parameters);
}
case "marketsellasset": {
marketSellAsset(parameters);
break;
}
case "marketcancelorder": {
marketCancelOrder(parameters);
break;
}
case "getmarketorderbyaccount": {
getMarketOrderByAccount(parameters);
break;
}
case "getmarketpricebypair": {
getMarketPriceByPair(parameters);
break;
}
case "getmarketorderlistbypair": {
getMarketOrderListByPair(parameters);
break;
}
case "getmarketpairlist": {
getMarketPairList(parameters);
break;
}
case "getmarketorderbyid": {
getMarketOrderById(parameters);
break;
} |
<<<<<<<
frozen_duration,resourceCode);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
}
transaction = signTransaction(transaction);
return rpcCli.broadcastTransaction(transaction);
}
public boolean buyStorage(long quantity)
throws CipherException, IOException, CancelException {
Contract.BuyStorageContract contract = createBuyStorageContract(quantity);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
}
transaction = signTransaction(transaction);
return rpcCli.broadcastTransaction(transaction);
}
public boolean sellStorage(long storageBytes)
throws CipherException, IOException, CancelException {
Contract.SellStorageContract contract = createSellStorageContract(storageBytes);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
=======
frozen_duration);
if (rpcVersion == 2) {
TransactionExtention transactionExtention = rpcCli.createTransaction2(contract);
return processTransactionExtention(transactionExtention);
} else {
Transaction transaction = rpcCli.createTransaction(contract);
return processTransaction(transaction);
>>>>>>>
frozen_duration,resourceCode);
if (rpcVersion == 2) {
TransactionExtention transactionExtention = rpcCli.createTransaction2(contract);
return processTransactionExtention(transactionExtention);
} else {
Transaction transaction = rpcCli.createTransaction(contract);
return processTransaction(transaction);
}
}
public boolean buyStorage(long quantity)
throws CipherException, IOException, CancelException {
Contract.BuyStorageContract contract = createBuyStorageContract(quantity);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
}
transaction = signTransaction(transaction);
return rpcCli.broadcastTransaction(transaction);
}
public boolean sellStorage(long storageBytes)
throws CipherException, IOException, CancelException {
Contract.SellStorageContract contract = createSellStorageContract(storageBytes);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
<<<<<<<
Contract.UnfreezeBalanceContract contract = createUnfreezeBalanceContract(resourceCode);
Transaction transaction = rpcCli.createTransaction(contract);
if (transaction == null || transaction.getRawData().getContractCount() == 0) {
return false;
=======
Contract.UnfreezeBalanceContract contract = createUnfreezeBalanceContract();
if (rpcVersion == 2) {
TransactionExtention transactionExtention = rpcCli.createTransaction2(contract);
return processTransactionExtention(transactionExtention);
} else {
Transaction transaction = rpcCli.createTransaction(contract);
return processTransaction(transaction);
>>>>>>>
Contract.UnfreezeBalanceContract contract = createUnfreezeBalanceContract(resourceCode);
if (rpcVersion == 2) {
TransactionExtention transactionExtention = rpcCli.createTransaction2(contract);
return processTransactionExtention(transactionExtention);
} else {
Transaction transaction = rpcCli.createTransaction(contract);
return processTransaction(transaction); |
<<<<<<<
public Transaction createTransaction(Contract.BuyStorageContract contract) {
return blockingStubFull.buyStorage(contract);
}
public Transaction createTransaction(Contract.SellStorageContract contract) {
return blockingStubFull.sellStorage(contract);
}
=======
public TransactionExtention createTransaction2(Contract.FreezeBalanceContract contract) {
return blockingStubFull.freezeBalance2(contract);
}
>>>>>>>
public Transaction createTransaction(Contract.BuyStorageContract contract) {
return blockingStubFull.buyStorage(contract);
}
public Transaction createTransaction(Contract.SellStorageContract contract) {
return blockingStubFull.sellStorage(contract);
}
public TransactionExtention createTransaction2(Contract.FreezeBalanceContract contract) {
return blockingStubFull.freezeBalance2(contract);
} |
<<<<<<<
public TransactionExtention createTransaction2(Contract.AccountUpdateContract contract) {
return blockingStubFull.updateAccount2(contract);
}
=======
public Transaction createTransaction(Contract.SetAccountIdContract contract) {
return blockingStubFull.setAccountId(contract);
}
>>>>>>>
public TransactionExtention createTransaction2(Contract.AccountUpdateContract contract) {
return blockingStubFull.updateAccount2(contract);
}
public Transaction createTransaction(Contract.SetAccountIdContract contract) {
return blockingStubFull.setAccountId(contract);
} |
<<<<<<<
=======
public static boolean isHexString(String str) {
boolean bRet = false;
try {
ByteArray.fromHexString(str);
bRet = true;
} catch (Exception e) {
}
return bRet;
}
>>>>>>>
public static boolean isHexString(String str) {
boolean bRet = false;
try {
ByteArray.fromHexString(str);
bRet = true;
} catch (Exception e) {
}
return bRet;
} |
<<<<<<<
String ABI, String code, long value, long consumeUserResourcePercent, long tokenValue, String tokenId,
String libraryAddressPair) {
=======
String ABI, String code, long value, long consumeUserResourcePercent,
long originEnergyLimit, String libraryAddressPair) {
>>>>>>>
String ABI, String code, long value, long consumeUserResourcePercent, long originEnergyLimit, long tokenValue, String tokenId,
String libraryAddressPair) {
<<<<<<<
long feeLimit, long value, long consumeUserResourcePercent, long tokenValue, String tokenId, String libraryAddressPair)
=======
long feeLimit, long value, long consumeUserResourcePercent, long originEnergyLimit,
String libraryAddressPair)
>>>>>>>
long feeLimit, long value, long consumeUserResourcePercent, long originEnergyLimit, long tokenValue, String tokenId, String libraryAddressPair)
<<<<<<<
ABI, code, value, consumeUserResourcePercent, tokenValue, tokenId, libraryAddressPair);
=======
ABI, code, value, consumeUserResourcePercent, originEnergyLimit, libraryAddressPair);
>>>>>>>
ABI, code, value, consumeUserResourcePercent, originEnergyLimit, tokenValue, tokenId, libraryAddressPair); |
<<<<<<<
import java.util.Map;
import java.util.Scanner;
=======
import org.bouncycastle.util.encoders.Hex;
>>>>>>>
import java.util.Map;
import java.util.Scanner;
import org.bouncycastle.util.encoders.Hex;
<<<<<<<
import org.tron.protos.Protocol.ChainParameters;
import org.tron.protos.Protocol.Proposal;
import org.tron.protos.Protocol.TransactionInfo;
import org.tron.protos.Protocol.Vote;
=======
>>>>>>>
import org.tron.protos.Protocol.ChainParameters;
import org.tron.protos.Protocol.Proposal;
import org.tron.protos.Protocol.TransactionInfo;
import org.tron.protos.Protocol.Vote;
<<<<<<<
result += transactionInfo.getBlockTimeStamp();
=======
result += transactionInfo.getBlockTimeStamp();
result += "\n";
result += "contractResult: ";
result += "\n";
result += ByteArray.toHexString(transactionInfo.getContractResult(0).toByteArray());
result += "\n";
result += "contractAddress: ";
result += "\n";
result += WalletClient.encode58Check(transactionInfo.getContractAddress().toByteArray());
>>>>>>>
result += transactionInfo.getBlockTimeStamp();
result += transactionInfo.getBlockTimeStamp();
result += "\n";
result += "contractResult: ";
result += "\n";
result += ByteArray.toHexString(transactionInfo.getContractResult(0).toByteArray());
result += "\n";
result += "contractAddress: ";
result += "\n";
result += WalletClient.encode58Check(transactionInfo.getContractAddress().toByteArray()); |
<<<<<<<
/**
* @param beaconParsers
*/
public void startAndroidOBackgroundScan(Set<BeaconParser> beaconParsers) {
ScanSettings settings = (new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_POWER)).build();
List<ScanFilter> filters = new ScanFilterUtils().createScanFiltersForBeaconParsers(
new ArrayList(beaconParsers));
try {
int result = getBluetoothAdapter().getBluetoothLeScanner().startScan(filters, settings, getScanCallbackIntent());
if (result != 0) {
LogManager.e(TAG, "Failed to start background scan on Android O. Code: "+result);
}
else {
LogManager.d(TAG, "Started passive beacon scan");
}
}
catch (SecurityException e) {
LogManager.e(TAG, "SecurityException making Android O background scanner");
}
}
// Low power scan results in the background will be delivered via Intent
private PendingIntent getScanCallbackIntent() {
Intent intent = new Intent(mContext, StartupBroadcastReceiver.class);
intent.putExtra("o-scan", true);
return PendingIntent.getBroadcast(mContext,0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
=======
>>>>>>> |
<<<<<<<
// Determine if we need to restart scanning. Restarting scanning is only
// needed on devices incapable of detecting multiple distinct BLE advertising
// packets in a single cycle, typically older Android devices (e.g. Nexus 4)
// On such devices, it is necessary to stop scanning and restart to detect
// multiple beacon packets in the same scan, allowing collection of multiple
// rssi measurements. Restarting however, causes brief detection dropouts
// so it is best avoided. If we know the device has detected to distinct
// packets in the same cycle, we will not restart scanning and just keep it
// going.
if (!getDistinctPacketsDetectedPerScan()) {
long now = System.currentTimeMillis();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
mBetweenScanPeriod+mScanPeriod < ANDROID_N_MIN_SCAN_CYCLE_MILLIS &&
now-mLastScanStopTime < ANDROID_N_MIN_SCAN_CYCLE_MILLIS) {
// As of Android N, only 5 scans may be started in a 30 second period (6
// seconds per cycle) otherwise they are blocked. So we check here to see
// if the scan period is 6 seconds or less, and if we last stopped scanning
// fewer than 6 seconds ag and if so, we simply do not stop scanning
LogManager.d(TAG, "Not stopping scan because this is Android N and we" +
" keep scanning for a minimum of 6 seconds at a time. "+
"We will stop in "+(ANDROID_N_MIN_SCAN_CYCLE_MILLIS-(now-mLastScanStopTime))+" millisconds.");
}
else {
try {
LogManager.d(TAG, "stopping bluetooth le scan");
finishScan();
mLastScanStopTime = now;
} catch (Exception e) {
LogManager.w(e, TAG, "Internal Android exception scanning for beacons");
}
}
=======
long now = SystemClock.elapsedRealtime();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
mBetweenScanPeriod+mScanPeriod < ANDROID_N_MIN_SCAN_CYCLE_MILLIS &&
now-mLastScanCycleStartTime < ANDROID_N_MIN_SCAN_CYCLE_MILLIS) {
// As of Android N, only 5 scans may be started in a 30 second period (6
// seconds per cycle) otherwise they are blocked. So we check here to see
// if the scan period is 6 seconds or less, and if we last stopped scanning
// fewer than 6 seconds ag and if so, we simply do not stop scanning
LogManager.d(TAG, "Not stopping scan because this is Android N and we" +
" keep scanning for a minimum of 6 seconds at a time. "+
"We will stop in "+(ANDROID_N_MIN_SCAN_CYCLE_MILLIS-(now-mLastScanCycleStartTime))+" millisconds.");
>>>>>>>
// Determine if we need to restart scanning. Restarting scanning is only
// needed on devices incapable of detecting multiple distinct BLE advertising
// packets in a single cycle, typically older Android devices (e.g. Nexus 4)
// On such devices, it is necessary to stop scanning and restart to detect
// multiple beacon packets in the same scan, allowing collection of multiple
// rssi measurements. Restarting however, causes brief detection dropouts
// so it is best avoided. If we know the device has detected to distinct
// packets in the same cycle, we will not restart scanning and just keep it
// going.
if (!getDistinctPacketsDetectedPerScan()) {
long now = SystemClock.elapsedRealtime();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
mBetweenScanPeriod+mScanPeriod < ANDROID_N_MIN_SCAN_CYCLE_MILLIS &&
now-mLastScanCycleStartTime < ANDROID_N_MIN_SCAN_CYCLE_MILLIS) {
// As of Android N, only 5 scans may be started in a 30 second period (6
// seconds per cycle) otherwise they are blocked. So we check here to see
// if the scan period is 6 seconds or less, and if we last stopped scanning
// fewer than 6 seconds ag and if so, we simply do not stop scanning
LogManager.d(TAG, "Not stopping scan because this is Android N and we" +
" keep scanning for a minimum of 6 seconds at a time. "+
"We will stop in "+(ANDROID_N_MIN_SCAN_CYCLE_MILLIS-(now-mLastScanCycleStartTime))+" millisconds.");
}
else {
try {
LogManager.d(TAG, "stopping bluetooth le scan");
finishScan();
} catch (Exception e) {
LogManager.w(e, TAG, "Internal Android exception scanning for beacons");
}
}
<<<<<<<
LogManager.d(TAG, "Not stopping scanning. Device capable of multiple indistinct detections per scan.");
=======
try {
LogManager.d(TAG, "stopping bluetooth le scan");
finishScan();
} catch (Exception e) {
LogManager.w(e, TAG, "Internal Android exception scanning for beacons");
}
>>>>>>>
LogManager.d(TAG, "Not stopping scanning. Device capable of multiple indistinct detections per scan."); |
<<<<<<<
protected static BeaconManager sInstance = null;
=======
protected static volatile BeaconManager client = null;
>>>>>>>
protected static volatile BeaconManager sInstance = null; |
<<<<<<<
public void testBeaconDoesntMatchRegionWithLongerIdentifierList() {
Beacon beacon = new Beacon.Builder().setId1("1").setId2("2").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("1:2:3:4:5:6").build();
Region region = new Region("myRegion", Identifier.parse("1"), Identifier.parse("2"), Identifier.parse("3"));
assertFalse("Beacon should not match region with more identifers than the beacon", region.matchesBeacon(beacon));
}
@Test
=======
public void testBeaconMatchesRegionWithSameBluetoothMac() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
Region region = new Region("myRegion", "01:02:03:04:05:06");
assertTrue("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test
public void testBeaconDoesNotMatchRegionWithDiffrentBluetoothMac() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
Region region = new Region("myRegion", "01:02:03:04:05:99");
assertFalse("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test
public void testBeaconMatchesRegionWithSameBluetoothMacAndIdentifiers() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
ArrayList identifiers = new ArrayList<Identifier>();
identifiers.add(Identifier.parse("1"));
identifiers.add(Identifier.parse("2"));
identifiers.add(Identifier.parse("3"));
Region region = new Region("myRegion", identifiers , "01:02:03:04:05:06");
assertTrue("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test
>>>>>>>
public void testBeaconDoesntMatchRegionWithLongerIdentifierList() {
Beacon beacon = new Beacon.Builder().setId1("1").setId2("2").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("1:2:3:4:5:6").build();
Region region = new Region("myRegion", Identifier.parse("1"), Identifier.parse("2"), Identifier.parse("3"));
assertFalse("Beacon should not match region with more identifers than the beacon", region.matchesBeacon(beacon));
}
@Test
public void testBeaconMatchesRegionWithSameBluetoothMac() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
Region region = new Region("myRegion", "01:02:03:04:05:06");
assertTrue("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test
public void testBeaconDoesNotMatchRegionWithDiffrentBluetoothMac() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
Region region = new Region("myRegion", "01:02:03:04:05:99");
assertFalse("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test
public void testBeaconMatchesRegionWithSameBluetoothMacAndIdentifiers() {
Beacon beacon = new AltBeacon.Builder().setId1("1").setId2("2").setId3("3").setRssi(4)
.setBeaconTypeCode(5).setTxPower(6).setBluetoothAddress("01:02:03:04:05:06").build();
ArrayList identifiers = new ArrayList<Identifier>();
identifiers.add(Identifier.parse("1"));
identifiers.add(Identifier.parse("2"));
identifiers.add(Identifier.parse("3"));
Region region = new Region("myRegion", identifiers , "01:02:03:04:05:06");
assertTrue("Beacon should match region with mac the same", region.matchesBeacon(beacon));
}
@Test |
<<<<<<<
import java.util.Objects;
=======
import java.util.Date;
>>>>>>>
import java.util.Date;
import java.util.Objects; |
<<<<<<<
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
=======
import org.onebusaway.exceptions.NoSuchTripServiceException;
import org.onebusaway.exceptions.OutOfServiceAreaServiceException;
>>>>>>>
<<<<<<<
blockUntilBundleIsReady();
return _transitDataService.getStops(query);
=======
checkBounds(query.getBounds());
return _stopsBeanService.getStops(query);
>>>>>>>
blockUntilBundleIsReady();
checkBounds(query.getBounds());
return _transitDataService.getStops(query);
<<<<<<<
blockUntilBundleIsReady();
return _transitDataService.getTripsForBounds(query);
=======
checkBounds(query.getBounds());
return _tripDetailsBeanService.getTripsForBounds(query);
>>>>>>>
blockUntilBundleIsReady();
checkBounds(query.getBounds());
return _transitDataService.getTripsForBounds(query);
<<<<<<<
blockUntilBundleIsReady();
return _transitDataService.getRoutes(query);
=======
checkBounds(query.getBounds());
return _routesBeanService.getRoutesForQuery(query);
>>>>>>>
blockUntilBundleIsReady();
checkBounds(query.getBounds());
return _transitDataService.getRoutes(query);
<<<<<<<
=======
private Set<AgencyAndId> convertAgencyAndIds(Iterable<String> ids) {
Set<AgencyAndId> converted = new HashSet<AgencyAndId>();
for (String id : ids)
converted.add(convertAgencyAndId(id));
return converted;
}
private ArrivalAndDepartureQuery createArrivalAndDepartureQuery(
ArrivalAndDepartureForStopQueryBean query) {
ArrivalAndDepartureQuery adQuery = new ArrivalAndDepartureQuery();
AgencyAndId stopId = AgencyAndIdLibrary.convertFromString(query.getStopId());
StopEntry stop = _transitGraphDao.getStopEntryForId(stopId, true);
AgencyAndId tripId = AgencyAndIdLibrary.convertFromString(query.getTripId());
TripEntry trip = _transitGraphDao.getTripEntryForId(tripId);
if (trip == null)
throw new NoSuchTripServiceException(query.getTripId());
adQuery.setStop(stop);
adQuery.setStopSequence(query.getStopSequence());
adQuery.setTrip(trip);
adQuery.setServiceDate(query.getServiceDate());
adQuery.setVehicleId(AgencyAndIdLibrary.convertFromString(query.getVehicleId()));
adQuery.setTime(query.getTime());
return adQuery;
}
private void checkBounds(CoordinateBounds cb) {
if (cb == null) {
return;
}
Collection<CoordinateBounds> allAgencyBounds = _agencyService.getAgencyIdsAndCoverageAreas().values();
for (CoordinateBounds agencyBounds : allAgencyBounds) {
if (agencyBounds.intersects(cb)) {
return;
}
}
throw new OutOfServiceAreaServiceException();
}
>>>>>>> |
<<<<<<<
=======
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
>>>>>>>
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
<<<<<<<
=======
@Autowired
public void setStopTransferService(StopTransferService stopTransferService) {
_stopTransferService = stopTransferService;
}
public void setRemoveFuturePredictionsWithoutRealtime(boolean remove) {
this.removeFuturePredictionsWithoutRealtime = remove;
}
>>>>>>>
public void setRemoveFuturePredictionsWithoutRealtime(boolean remove) {
this.removeFuturePredictionsWithoutRealtime = remove;
}
<<<<<<<
=======
private boolean isArrivalAndDeparturePairInRange(
ArrivalAndDepartureInstance instanceFrom,
ArrivalAndDepartureInstance instanceTo, Date timeFrom, Date timeTo,
boolean findDepartures) {
ArrivalAndDepartureInstance instance = findDepartures ? instanceFrom
: instanceTo;
if (timeFrom != null) {
boolean schedInRange = instance.getScheduledDepartureTime() >= timeFrom.getTime();
boolean realTimeInRange = true;
if (instance.isPredictedDepartureTimeSet())
realTimeInRange = instance.getPredictedDepartureTime() >= timeFrom.getTime();
if (!(schedInRange || realTimeInRange))
return false;
}
if (timeTo != null) {
boolean schedInRange = instance.getScheduledArrivalTime() <= timeTo.getTime();
boolean realTimeInRange = true;
if (instance.isPredictedArrivalTimeSet())
realTimeInRange = instance.getPredictedArrivalTime() <= timeTo.getTime();
if (!(schedInRange || realTimeInRange))
return false;
}
return true;
}
private ArrivalAndDepartureInstance createArrivalAndDepartureForStopTimeInstanceWithTime(
StopTimeInstance sti, long time) {
ArrivalAndDepartureTime scheduledTime = new ArrivalAndDepartureTime(time, time);
ArrivalAndDepartureInstance instance = new ArrivalAndDepartureInstance(sti, scheduledTime);
instance.setBlockSequence(sti.getBlockSequence());
return instance;
}
>>>>>>>
private ArrivalAndDepartureInstance createArrivalAndDepartureForStopTimeInstanceWithTime(
StopTimeInstance sti, long time) {
ArrivalAndDepartureTime scheduledTime = new ArrivalAndDepartureTime(time, time);
ArrivalAndDepartureInstance instance = new ArrivalAndDepartureInstance(sti, scheduledTime);
instance.setBlockSequence(sti.getBlockSequence());
return instance;
} |
<<<<<<<
proxy.provideAndRegisterDocumentSetB(processedEnvelope);
if (isMdn) {
DirectEventLogger.getInstance().log(DirectEventType.END_INBOUND_MDN, message);
} else {
DirectEventLogger.getInstance().log(DirectEventType.END_INBOUND_DIRECT, message);
}
=======
proxy.provideAndRegisterDocumentSetB(processedMessage.getMessage());
}
>>>>>>>
proxy.provideAndRegisterDocumentSetB(processedMessage.getMessage());
if (isMdn) {
DirectEventLogger.getInstance().log(DirectEventType.END_INBOUND_MDN, message);
} else {
DirectEventLogger.getInstance().log(DirectEventType.END_INBOUND_DIRECT, message);
} |
<<<<<<<
=======
public static final int GATEWAY_DASHBOARD_TAB = 0;
public static final int GATEWAY_REMOTELIST_TAB = 1;
// LOAD-TEST-DATA
public static final String LOAD_TEST_DATA_PAGE = "loadTestData";
public static final String LOAD_TEST_DATA_XHTML = "/loadTestData.xhtml";
public static final int LOAD_TEST_DATA_PATIENT_TAB = 0;
>>>>>>>
// LOAD-TEST-DATA
public static final String LOAD_TEST_DATA_PAGE = "loadTestData";
public static final String LOAD_TEST_DATA_XHTML = "/loadTestData.xhtml";
public static final int LOAD_TEST_DATA_PATIENT_TAB = 0; |
<<<<<<<
@Override
public RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB(
ProvideAndRegisterDocumentSetRequestType body) {
return new NhinDocSubmissionImpl_g1().documentRepositoryProvideAndRegisterDocumentSetB(body, context);
=======
public oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB(
ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType body) {
return new NhinDocSubmissionImpl_g1(orchImpl).documentRepositoryProvideAndRegisterDocumentSetB(body, context);
>>>>>>>
public RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB(
ProvideAndRegisterDocumentSetRequestType body) {
return new NhinDocSubmissionImpl_g1(orchImpl).documentRepositoryProvideAndRegisterDocumentSetB(body, context); |
<<<<<<<
import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.entitypatientdiscoverysecured.EntityPatientDiscoverySecuredPortType;
import gov.hhs.fha.nhinc.messaging.server.BaseService;
=======
import gov.hhs.fha.nhinc.aspect.OutboundMessageEvent;
import gov.hhs.fha.nhinc.patientdiscovery.aspect.PRPAIN201305UV02ArgTransformer;
import gov.hhs.fha.nhinc.patientdiscovery.aspect.RespondingGatewayPRPAIN201306UV02Builder;
>>>>>>>
import gov.hhs.fha.nhinc.aspect.OutboundMessageEvent;
import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
import gov.hhs.fha.nhinc.entitypatientdiscoverysecured.EntityPatientDiscoverySecuredPortType;
import gov.hhs.fha.nhinc.messaging.server.BaseService;
<<<<<<<
import gov.hhs.fha.nhinc.patientdiscovery.outbound.OutboundPatientDiscovery;
=======
import gov.hhs.fha.nhinc.entitypatientdiscoverysecured.EntityPatientDiscoverySecuredPortType;
>>>>>>>
import gov.hhs.fha.nhinc.patientdiscovery.aspect.PRPAIN201305UV02ArgTransformer;
import gov.hhs.fha.nhinc.patientdiscovery.aspect.RespondingGatewayPRPAIN201306UV02Builder;
import gov.hhs.fha.nhinc.patientdiscovery.outbound.OutboundPatientDiscovery;
<<<<<<<
public class EntityPatientDiscoverySecured extends BaseService implements EntityPatientDiscoverySecuredPortType {
private OutboundPatientDiscovery outboundPatientDiscovery;
=======
public class EntityPatientDiscoverySecured extends PatientDiscoveryBase implements
EntityPatientDiscoverySecuredPortType {
private static final Log log = LogFactory.getLog(EntityPatientDiscoverySecured.class);
>>>>>>>
public class EntityPatientDiscoverySecured extends BaseService implements EntityPatientDiscoverySecuredPortType {
private OutboundPatientDiscovery outboundPatientDiscovery;
<<<<<<<
=======
public EntityPatientDiscoverySecured(PatientDiscoveryServiceFactory serviceFactory) {
super(serviceFactory);
}
@OutboundMessageEvent(beforeBuilder = PRPAIN201305UV02ArgTransformer.class,
afterReturningBuilder = RespondingGatewayPRPAIN201306UV02Builder.class, serviceType = "Patient Discovery",
version = "1.0")
>>>>>>>
@OutboundMessageEvent(beforeBuilder = PRPAIN201305UV02ArgTransformer.class,
afterReturningBuilder = RespondingGatewayPRPAIN201306UV02Builder.class, serviceType = "Patient Discovery",
version = "1.0") |
<<<<<<<
LOG.error("Exception in getTransactionId() occured due to :" + e.getMessage(), e);
=======
log.error("Exception in getPerfrepository() occured due to :" + e.getMessage(), e);
>>>>>>>
log.error("Exception in getTransactionId() occured due to :" + e.getMessage(), e); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.