|
|
|
|
@ -584,12 +584,10 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1))
|
|
|
|
|
.andExpect(jsonPath("$.data.status").doesNotExist())
|
|
|
|
|
.andExpect(jsonPath("$.data.completeControlBit").doesNotExist());
|
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
|
.andExpect(jsonPath("$.data.completeControlBit").value(org.hamcrest.Matchers.allOf(
|
|
|
|
|
org.hamcrest.Matchers.containsString("|DYN_"),
|
|
|
|
|
org.hamcrest.Matchers.containsString("|CB_CTRL_"))));
|
|
|
|
|
String completeControlBit = quotaControlBitMapper.selectList(null).get(0).getCompleteControlBit();
|
|
|
|
|
QuotaControlBitEntity beforeSign = quotaControlBitMapper.selectList(null).get(0);
|
|
|
|
|
assertThat(beforeSign.getCompleteControlBit()).isNull();
|
|
|
|
|
String completeControlBit = beforeSign.getStaticSegment() + "|" + beforeSign.getDynamicSegment() + "|"
|
|
|
|
|
+ beforeSign.getCentralBankSignatureSegment();
|
|
|
|
|
|
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
@ -603,7 +601,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
+ completeControlBit + "_TAMPERED\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.allOf(
|
|
|
|
|
org.hamcrest.Matchers.containsString("完整额度控制位与步骤八拼接结果不一致"),
|
|
|
|
|
org.hamcrest.Matchers.containsString("完整额度控制位与静态段、动态段及央行签名段拼接结果不一致"),
|
|
|
|
|
org.hamcrest.Matchers.containsString("第5次错误"))));
|
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
@ -618,6 +616,8 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1));
|
|
|
|
|
assertThat(quotaControlBitMapper.selectList(null).get(0).getCompleteControlBit())
|
|
|
|
|
.isEqualTo(completeControlBit);
|
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/package").header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isOk()).andExpect(jsonPath("$.data.status").value("PACKAGED"))
|
|
|
|
|
.andExpect(jsonPath("$.data.requestMessage").value(org.hamcrest.Matchers.containsString("\"quotaId\"")));
|
|
|
|
|
@ -684,13 +684,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
flowsUserInputThroughCompleteStepEightAndAccumulatesErrors();
|
|
|
|
|
|
|
|
|
|
mvc.perform(post(STANDARD_CURRENCY_BASE_PATH + "/steps/decompose")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
.content("{\"amount\":1590.85}"))
|
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第7次错误")));
|
|
|
|
|
mvc.perform(post(STANDARD_CURRENCY_BASE_PATH + "/steps/decompose")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
.content("{\"amount\":1589.85}"))
|
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
|
.andExpect(jsonPath("$.data.status").value("DECOMPOSED"))
|
|
|
|
|
.andExpect(jsonPath("$.data.totalCount").value(27))
|
|
|
|
|
@ -703,7 +697,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
.content("{\"prefix\":\"RMB\",\"idRule\":\"批次号+枚序号+随机校验码\"," +
|
|
|
|
|
"\"currencyStatus\":\"待生效\"}"))
|
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第8次错误")));
|
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第7次错误")));
|
|
|
|
|
mvc.perform(post(STANDARD_CURRENCY_BASE_PATH + "/steps/confirm-rule")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
.content("{\"prefix\":\"DC\",\"idRule\":\"批次号+枚序号+随机校验码\"," +
|
|
|
|
|
@ -722,6 +716,19 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
org.hamcrest.Matchers.containsString("_ORG_3A4B5C6D7E8F_100.00_")))
|
|
|
|
|
.andExpect(jsonPath("$.data.currencies[26].denomination").value(0.05))
|
|
|
|
|
.andExpect(jsonPath("$.data.currencies[26].status").value("待生效"));
|
|
|
|
|
mvc.perform(get(STANDARD_CURRENCY_BASE_PATH + "/currencies")
|
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(27))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].sequenceNumber").value(1))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].denomination").value(100.0))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].currencyId").value(
|
|
|
|
|
org.hamcrest.Matchers.matchesPattern("DC_[0-9]{8}_[0-9]{3}_001_[0-9A-Z]{6}")))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].completeCurrency").value(
|
|
|
|
|
org.hamcrest.Matchers.containsString("_ORG_3A4B5C6D7E8F_100.00_")))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].status").value(1))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].randomCheckCode").doesNotExist())
|
|
|
|
|
.andExpect(jsonPath("$.data[0].institutionIdentifier").doesNotExist());
|
|
|
|
|
|
|
|
|
|
List<StandardCurrencyEntity> currencies = standardCurrencyMapper.selectList(null);
|
|
|
|
|
assertThat(standardCurrencyBatchMapper.selectList(null)).hasSize(1);
|
|
|
|
|
@ -729,6 +736,17 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
assertThat(currencies.stream().map(StandardCurrencyEntity::getDenomination)
|
|
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)).isEqualByComparingTo("1589.85");
|
|
|
|
|
assertThat(currencies.stream().map(StandardCurrencyEntity::getCurrencyId).distinct().count()).isEqualTo(27);
|
|
|
|
|
StandardCurrencyEntity activated = currencies.get(0);
|
|
|
|
|
activated.setStatus("可用");
|
|
|
|
|
standardCurrencyMapper.updateById(activated);
|
|
|
|
|
mvc.perform(get(STANDARD_CURRENCY_BASE_PATH + "/currencies")
|
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(27))
|
|
|
|
|
.andExpect(jsonPath("$.data[0].status").value(2))
|
|
|
|
|
.andExpect(jsonPath("$.data[1].status").value(1));
|
|
|
|
|
activated.setStatus("待生效");
|
|
|
|
|
standardCurrencyMapper.updateById(activated);
|
|
|
|
|
List<Long> currencyIds = currencies.stream().map(StandardCurrencyEntity::getId)
|
|
|
|
|
.collect(java.util.stream.Collectors.toList());
|
|
|
|
|
long batchId = standardCurrencyBatchMapper.selectList(null).get(0).getId();
|
|
|
|
|
@ -746,8 +764,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
@Test
|
|
|
|
|
void rejectsStepNineUntilStepEightIsReceived() throws Exception {
|
|
|
|
|
mvc.perform(post(STANDARD_CURRENCY_BASE_PATH + "/steps/decompose")
|
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
|
.content("{\"amount\":1589.85}"))
|
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString(
|
|
|
|
|
"步骤八尚未完成央行接收")));
|
|
|
|
|
|