Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baa-pay-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
贺超
baa-pay-server
Commits
639cd9c8
Commit
639cd9c8
authored
Sep 01, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
7188ae0e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
19 deletions
+59
-19
AcquirerProperties.java
...in/java/cn/quant/baa/pay/acquirer/AcquirerProperties.java
+28
-0
MerchantAcquirer.java
...main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
+7
-16
PayAccountEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/PayAccountEntity.java
+24
-3
No files found.
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/AcquirerProperties.java
View file @
639cd9c8
...
...
@@ -4,6 +4,7 @@ import cn.quant.baa.pay.dict.AccessCode;
import
cn.quant.baa.pay.dict.AccessType
;
import
cn.quant.baa.pay.dict.PayChanType
;
import
javax.persistence.Column
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
...
...
@@ -37,6 +38,10 @@ public class AcquirerProperties implements Serializable{
private
String
payPublicKey
;
private
String
payCertNo
;
private
String
payCertKey
;
//feature
private
AccessCode
accessCode
;
...
...
@@ -154,6 +159,22 @@ public class AcquirerProperties implements Serializable{
this
.
payPublicKey
=
payPublicKey
;
}
public
String
getPayCertNo
()
{
return
payCertNo
;
}
public
void
setPayCertNo
(
String
payCertNo
)
{
this
.
payCertNo
=
payCertNo
;
}
public
String
getPayCertKey
()
{
return
payCertKey
;
}
public
void
setPayCertKey
(
String
payCertKey
)
{
this
.
payCertKey
=
payCertKey
;
}
public
AccessCode
getAccessCode
()
{
return
accessCode
;
}
...
...
@@ -291,15 +312,22 @@ public class AcquirerProperties implements Serializable{
sb
.
append
(
", payChanType="
).
append
(
payChanType
);
sb
.
append
(
", domain='"
).
append
(
domain
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", secretType='"
).
append
(
secretType
).
append
(
'\''
);
sb
.
append
(
", signType='"
).
append
(
signType
).
append
(
'\''
);
sb
.
append
(
", payCertNo='"
).
append
(
payCertNo
).
append
(
'\''
);
sb
.
append
(
", accessCode="
).
append
(
accessCode
);
sb
.
append
(
", accessType="
).
append
(
accessType
);
sb
.
append
(
", accessMethod='"
).
append
(
accessMethod
).
append
(
'\''
);
sb
.
append
(
", version='"
).
append
(
version
).
append
(
'\''
);
sb
.
append
(
", payAccess='"
).
append
(
payAccess
).
append
(
'\''
);
sb
.
append
(
", refundAccess='"
).
append
(
refundAccess
).
append
(
'\''
);
sb
.
append
(
", checkAccess='"
).
append
(
checkAccess
).
append
(
'\''
);
sb
.
append
(
", descText='"
).
append
(
descText
).
append
(
'\''
);
sb
.
append
(
", institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
sb
.
append
(
", payAppId='"
).
append
(
payAppId
).
append
(
'\''
);
sb
.
append
(
", payAppName='"
).
append
(
payAppName
).
append
(
'\''
);
sb
.
append
(
", securityKey='"
).
append
(
securityKey
).
append
(
'\''
);
sb
.
append
(
", startDate="
).
append
(
startDate
);
sb
.
append
(
", endDate="
).
append
(
endDate
);
sb
.
append
(
", activatedFlag="
).
append
(
activatedFlag
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
View file @
639cd9c8
...
...
@@ -8,38 +8,29 @@ import javax.crypto.NoSuchPaddingException;
import
javax.crypto.spec.SecretKeySpec
;
import
java.security.InvalidKeyException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Base64
;
/**
* Created by Administrator on 2021/8/31 0031.
*/
public
abstract
class
MerchantAcquirer
{
protected
CharacterCipher
characterCipher
;
protected
Cipher
cipher
;
protected
SecretKeySpec
secretKey
;
p
ublic
MerchantAcquirer
init
(
AcquirerProperties
properties
)
throws
NoSuchPaddingException
,
NoSuchAlgorithmException
,
InvalidKeyException
{
p
rotected
CharacterCipher
secretCipher
;
characterCipher
=
new
Base64Cipher
();
public
MerchantAcquirer
init
(
AcquirerProperties
properties
)
throws
NoSuchPaddingException
,
NoSuchAlgorithmException
,
InvalidKeyException
{
this
.
secretCipher
=
new
Base64Cipher
();
String
secretType
=
properties
.
getSecretType
();
if
(
secretType
.
startsWith
(
"AES"
))
{
secretKey
=
new
SecretKeySpec
(
properties
.
getSecretKey
().
getBytes
(),
"AES"
);
this
.
secretKey
=
new
SecretKeySpec
(
properties
.
getSecretKey
().
getBytes
(),
"AES"
);
}
cipher
=
Cipher
.
getInstance
(
secretType
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
);
Base64
.
getEncoder
().
encodeToString
(
"aaa"
.
getBytes
());
this
.
cipher
=
Cipher
.
getInstance
(
secretType
);
this
.
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
this
.
secretKey
);
// byte[] raw = sKey.getBytes("utf-8");
// SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
// cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
// byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
// return new BASE64Encoder().encode(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
//
return
this
;
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayAccountEntity.java
View file @
639cd9c8
...
...
@@ -44,6 +44,13 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
@Column
(
name
=
"PAY_PUBLIC_KEY"
,
nullable
=
false
,
length
=
255
)
private
String
payPublicKey
;
@Column
(
name
=
"PAY_CERT_NO"
,
nullable
=
true
,
length
=
64
)
private
String
payCertNo
;
@Column
(
name
=
"PAY_CERT_KEY"
,
nullable
=
true
,
length
=
2000
)
private
String
payCertKey
;
public
PayAccountIds
getIds
()
{
return
ids
;
}
...
...
@@ -116,6 +123,22 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
this
.
payPublicKey
=
payPublicKey
;
}
public
String
getPayCertNo
()
{
return
payCertNo
;
}
public
void
setPayCertNo
(
String
payCertNo
)
{
this
.
payCertNo
=
payCertNo
;
}
public
String
getPayCertKey
()
{
return
payCertKey
;
}
public
void
setPayCertKey
(
String
payCertKey
)
{
this
.
payCertKey
=
payCertKey
;
}
@Override
public
String
persistenceKey
()
{
return
ids
.
persistenceKey
();
...
...
@@ -136,11 +159,9 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
sb
.
append
(
", payChanType="
).
append
(
payChanType
);
sb
.
append
(
", domain='"
).
append
(
domain
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", secretKey='"
).
append
(
secretKey
).
append
(
'\''
);
sb
.
append
(
", secretType='"
).
append
(
secretType
).
append
(
'\''
);
sb
.
append
(
", signType='"
).
append
(
signType
).
append
(
'\''
);
sb
.
append
(
", privateKey='"
).
append
(
privateKey
).
append
(
'\''
);
sb
.
append
(
", payPublicKey='"
).
append
(
payPublicKey
).
append
(
'\''
);
sb
.
append
(
", payCertNo='"
).
append
(
payCertNo
).
append
(
'\''
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
return
sb
.
toString
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment