|
|
|
@ -118,7 +118,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
.andExpect(status().isNotFound());
|
|
|
|
.andExpect(status().isNotFound());
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString(
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString(
|
|
|
|
"步骤三尚未完成确认报文返回")));
|
|
|
|
"步骤三尚未完成确认报文返回")));
|
|
|
|
@ -130,12 +130,12 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85[ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85[ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"999.00|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"999.00|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
|
|
|
|
|
|
|
|
@ -155,7 +155,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
String originalText = "1589.85|ORG_3A4B5C6D7E8F|20260730153330";
|
|
|
|
String originalText = "1589.85|ORG_3A4B5C6D7E8F|20260730153330";
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + originalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + originalText + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.digest")
|
|
|
|
.andExpect(jsonPath("$.data.digest")
|
|
|
|
.value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
.value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
@ -209,7 +209,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
@ -230,7 +230,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
+ transactionMapper.selectList(null).get(0).getTransactionIdentifier();
|
|
|
|
+ transactionMapper.selectList(null).get(0).getTransactionIdentifier();
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + quotaOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + quotaOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(
|
|
|
|
org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
@ -243,7 +243,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
String bankPrivateKey = keyService.commercialBankKey(subject, "module-four-tester").getPrivateKey();
|
|
|
|
String bankPrivateKey = keyService.commercialBankKey(subject, "module-four-tester").getPrivateKey();
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(
|
|
|
|
org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
@ -252,21 +252,23 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
.andExpect(jsonPath("$.data.quotaSigningKeyId").doesNotExist())
|
|
|
|
.andExpect(jsonPath("$.data.quotaSigningKeyId").doesNotExist())
|
|
|
|
.andExpect(jsonPath("$.data.quotaSignature").doesNotExist());
|
|
|
|
.andExpect(jsonPath("$.data.quotaSignature").doesNotExist());
|
|
|
|
long stepFiveRecordId = transactionMapper.selectList(null).get(0).getId();
|
|
|
|
long stepFiveRecordId = transactionMapper.selectList(null).get(0).getId();
|
|
|
|
|
|
|
|
String signedQuota = transactionMapper.selectList(null).get(0).getQuotaSignature();
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + quotaOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + quotaOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")));
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")));
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getId()).isEqualTo(stepFiveRecordId);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getId()).isEqualTo(stepFiveRecordId);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignature()).isNull();
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignature()).isEqualTo(signedQuota);
|
|
|
|
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getStatus()).isEqualTo("QUOTA_SIGNED");
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/sign").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")));
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")));
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
@ -335,7 +337,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.h1").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
.andExpect(jsonPath("$.data.h1").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]{64}")))
|
|
|
|
.andExpect(jsonPath("$.data.h2").doesNotExist());
|
|
|
|
.andExpect(jsonPath("$.data.h2").doesNotExist());
|
|
|
|
@ -354,11 +356,12 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getId()).isEqualTo(stepSixRecordId);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getId()).isEqualTo(stepSixRecordId);
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignatureDigest()).isNull();
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignatureDigest())
|
|
|
|
|
|
|
|
.isEqualTo(cryptography.sm3(verificationOriginalText));
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/recover-signature-digest")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/recover-signature-digest")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"publicKey\":\"" + bankPublicKey + "\"}"))
|
|
|
|
.content("{\"publicKey\":\"" + bankPublicKey + "\"}"))
|
|
|
|
@ -390,9 +393,10 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + verificationOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignatureDigest()).isNull();
|
|
|
|
assertThat(transactionMapper.selectList(null).get(0).getQuotaSignatureDigest())
|
|
|
|
|
|
|
|
.isEqualTo(cryptography.sm3(verificationOriginalText));
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/recover-signature-digest")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/recover-signature-digest")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"publicKey\":\"" + bankPublicKey + "\"}"))
|
|
|
|
.content("{\"publicKey\":\"" + bankPublicKey + "\"}"))
|
|
|
|
@ -417,7 +421,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"999.00|"
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"999.00|"
|
|
|
|
+ verified.getInstitutionIdentifier() + "|" + verified.getTransactionIdentifier()
|
|
|
|
+ verified.getInstitutionIdentifier() + "|" + verified.getTransactionIdentifier()
|
|
|
|
+ "\"}"))
|
|
|
|
+ "\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
@ -428,7 +432,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
String firstDigest = mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
String firstDigest = mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + controlOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + controlOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(cryptography.sm3(controlOriginalText)))
|
|
|
|
.andExpect(jsonPath("$.data.digest").value(cryptography.sm3(controlOriginalText)))
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1))
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1))
|
|
|
|
@ -439,7 +443,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
String repeatedDigest = mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
String repeatedDigest = mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/digest")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"" + controlOriginalText + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"" + controlOriginalText + "\"}"))
|
|
|
|
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
|
|
|
|
.andExpect(status().isOk()).andReturn().getResponse().getContentAsString();
|
|
|
|
assertThat(com.jayway.jsonpath.JsonPath.<String>read(repeatedDigest, "$.data.digest"))
|
|
|
|
assertThat(com.jayway.jsonpath.JsonPath.<String>read(repeatedDigest, "$.data.digest"))
|
|
|
|
.isEqualTo(com.jayway.jsonpath.JsonPath.<String>read(firstDigest, "$.data.digest"));
|
|
|
|
.isEqualTo(com.jayway.jsonpath.JsonPath.<String>read(firstDigest, "$.data.digest"));
|
|
|
|
@ -447,13 +451,13 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"WRONG_CENTRAL_PRIVATE_KEY\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"WRONG_CENTRAL_PRIVATE_KEY\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第3次错误")));
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第3次错误")));
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(CONTROL_SIGNATURE_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + centralPrivateKey + "\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + centralPrivateKey + "\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1));
|
|
|
|
.andExpect(jsonPath("$.data.length()").value(1));
|
|
|
|
@ -563,7 +567,8 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
.andReturn().getResponse().getContentAsString();
|
|
|
|
.andReturn().getResponse().getContentAsString();
|
|
|
|
String secondDynamicSegment = com.jayway.jsonpath.JsonPath.read(
|
|
|
|
String secondDynamicSegment = com.jayway.jsonpath.JsonPath.read(
|
|
|
|
secondDynamicSegmentResponse, "$.data.dynamicSegment");
|
|
|
|
secondDynamicSegmentResponse, "$.data.dynamicSegment");
|
|
|
|
assertThat(secondDynamicSegment).isNotEqualTo(firstDynamicSegment);
|
|
|
|
// 网络重试同一步骤应返回原动态段,避免更换已被后续签名引用的数据。
|
|
|
|
|
|
|
|
assertThat(secondDynamicSegment).isEqualTo(firstDynamicSegment);
|
|
|
|
assertThat(quotaControlBitMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(quotaControlBitMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(quotaControlBitMapper.selectList(null).get(0).getId()).isEqualTo(stepEightRecordId);
|
|
|
|
assertThat(quotaControlBitMapper.selectList(null).get(0).getId()).isEqualTo(stepEightRecordId);
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/read-central-bank-signature")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/read-central-bank-signature")
|
|
|
|
@ -581,13 +586,13 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
|
|
|
|
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM3\"}"))
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM3\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第4次错误")));
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第4次错误")));
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
+ completeControlBit + "_TAMPERED\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
+ completeControlBit + "_TAMPERED\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.allOf(
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.allOf(
|
|
|
|
@ -595,13 +600,13 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
org.hamcrest.Matchers.containsString("第5次错误"))));
|
|
|
|
org.hamcrest.Matchers.containsString("第5次错误"))));
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"WRONG_BANK_PRIVATE_KEY\",\"completeControlBit\":\""
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"WRONG_BANK_PRIVATE_KEY\",\"completeControlBit\":\""
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第6次错误")));
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("第6次错误")));
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
+ completeControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
.andExpect(jsonPath("$.data.signature").value(org.hamcrest.Matchers.matchesPattern("[0-9A-F]+")))
|
|
|
|
@ -611,6 +616,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/package").header("Authorization", authorization))
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/package").header("Authorization", authorization))
|
|
|
|
.andExpect(status().isOk()).andExpect(jsonPath("$.data.length()").value(1))
|
|
|
|
.andExpect(status().isOk()).andExpect(jsonPath("$.data.length()").value(1))
|
|
|
|
.andExpect(jsonPath("$.data.message").value(org.hamcrest.Matchers.containsString("\"quotaId\"")));
|
|
|
|
.andExpect(jsonPath("$.data.message").value(org.hamcrest.Matchers.containsString("\"quotaId\"")));
|
|
|
|
|
|
|
|
QuotaControlBitEntity beforeStaticRetry = quotaControlBitMapper.selectList(null).get(0);
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/static-segment")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/static-segment")
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
.header("Authorization", authorization))
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
.andExpect(status().isOk())
|
|
|
|
@ -618,12 +624,12 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
org.hamcrest.Matchers.matchesPattern("STATIC_[0-9A-F]{64}")));
|
|
|
|
org.hamcrest.Matchers.matchesPattern("STATIC_[0-9A-F]{64}")));
|
|
|
|
QuotaControlBitEntity resetByStatic = quotaControlBitMapper.selectList(null).get(0);
|
|
|
|
QuotaControlBitEntity resetByStatic = quotaControlBitMapper.selectList(null).get(0);
|
|
|
|
assertThat(resetByStatic.getId()).isEqualTo(stepEightRecordId);
|
|
|
|
assertThat(resetByStatic.getId()).isEqualTo(stepEightRecordId);
|
|
|
|
assertThat(resetByStatic.getStatus()).isEqualTo("STATIC_READY");
|
|
|
|
assertThat(resetByStatic.getStatus()).isEqualTo(beforeStaticRetry.getStatus());
|
|
|
|
assertThat(resetByStatic.getDynamicSegment()).isNull();
|
|
|
|
assertThat(resetByStatic.getDynamicSegment()).isEqualTo(beforeStaticRetry.getDynamicSegment());
|
|
|
|
assertThat(resetByStatic.getCentralBankSignatureSegment()).isNull();
|
|
|
|
assertThat(resetByStatic.getCentralBankSignatureSegment()).isEqualTo(beforeStaticRetry.getCentralBankSignatureSegment());
|
|
|
|
assertThat(resetByStatic.getCompleteControlBit()).isNull();
|
|
|
|
assertThat(resetByStatic.getCompleteControlBit()).isEqualTo(beforeStaticRetry.getCompleteControlBit());
|
|
|
|
assertThat(resetByStatic.getBankSignature()).isNull();
|
|
|
|
assertThat(resetByStatic.getBankSignature()).isEqualTo(beforeStaticRetry.getBankSignature());
|
|
|
|
assertThat(resetByStatic.getRequestMessage()).isNull();
|
|
|
|
assertThat(resetByStatic.getRequestMessage()).isEqualTo(beforeStaticRetry.getRequestMessage());
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/dynamic-segment")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/dynamic-segment")
|
|
|
|
.header("Authorization", authorization)).andExpect(status().isOk());
|
|
|
|
.header("Authorization", authorization)).andExpect(status().isOk());
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/read-central-bank-signature")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/read-central-bank-signature")
|
|
|
|
@ -633,7 +639,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
String regeneratedCompleteControlBit = quotaControlBitMapper.selectList(null).get(0).getCompleteControlBit();
|
|
|
|
String regeneratedCompleteControlBit = quotaControlBitMapper.selectList(null).get(0).getCompleteControlBit();
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/sign")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.header("Authorization", authorization).contentType("application/json")
|
|
|
|
.content("{\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
.content("{\"algorithm\":\"SM2\",\"privateKey\":\"" + bankPrivateKey + "\",\"completeControlBit\":\""
|
|
|
|
+ regeneratedCompleteControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
+ regeneratedCompleteControlBit + "\",\"hashAlgorithm\":\"SM2\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/package").header("Authorization", authorization))
|
|
|
|
mvc.perform(post(QUOTA_CONTROL_BASE_PATH + "/steps/package").header("Authorization", authorization))
|
|
|
|
@ -773,14 +779,14 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
|
|
|
|
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"999.00|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"999.00|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(status().isBadRequest())
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
.andExpect(jsonPath("$.message").value("数据拼接错误"));
|
|
|
|
@ -793,7 +799,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
mvc.perform(post(VERIFICATION_BASE_PATH + "/steps/hash")
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
.andExpect(status().isNotFound())
|
|
|
|
.andExpect(status().isNotFound())
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString(
|
|
|
|
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString(
|
|
|
|
@ -809,7 +815,7 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
"步骤四尚未完成交易信息标识")));
|
|
|
|
"步骤四尚未完成交易信息标识")));
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(QUOTA_BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|TXN_"
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
+ "7A8B9C0D1E2F3A4B5C6D7E8F9A0B1C2D3E4F5A6B7C8D9E0F1A2B3C4D5E6F\"}"))
|
|
|
|
.andExpect(status().isNotFound())
|
|
|
|
.andExpect(status().isNotFound())
|
|
|
|
.andExpect(jsonPath("$.code").value(404))
|
|
|
|
.andExpect(jsonPath("$.code").value(404))
|
|
|
|
@ -823,14 +829,14 @@ class TransactionInformationIdentifierControllerTest {
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
insertCompletedPrecedingData();
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730153330\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
long id = transactionMapper.selectList(null).get(0).getId();
|
|
|
|
long id = transactionMapper.selectList(null).get(0).getId();
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/assemble").header("Authorization", authorization))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
mvc.perform(post(BASE_PATH + "/steps/digest").header("Authorization", authorization)
|
|
|
|
.contentType("application/json")
|
|
|
|
.contentType("application/json")
|
|
|
|
.content("{\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730154444\"}"))
|
|
|
|
.content("{\"algorithm\":\"SM3\",\"originalText\":\"1589.85|ORG_3A4B5C6D7E8F|20260730154444\"}"))
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
.andExpect(status().isOk());
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
assertThat(transactionMapper.selectList(null)).hasSize(1);
|
|
|
|
|