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
7188ae0e
Commit
7188ae0e
authored
Sep 01, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
09570a5b
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
189 additions
and
174 deletions
+189
-174
AcquirerConfiguration.java
...java/cn/quant/baa/pay/acquirer/AcquirerConfiguration.java
+15
-16
AcquirerConfigurer.java
...in/java/cn/quant/baa/pay/acquirer/AcquirerConfigurer.java
+11
-12
AcquirerProperties.java
...in/java/cn/quant/baa/pay/acquirer/AcquirerProperties.java
+13
-13
MerchantAcquirer.java
...main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
+46
-0
WeiXinMerchantAcquirer.java
...quant/baa/pay/acquirer/weixin/WeiXinMerchantAcquirer.java
+10
-0
ServerConfiguration.java
...ain/java/cn/quant/baa/pay/config/ServerConfiguration.java
+11
-10
EntityBuilder.java
.../main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
+4
-4
PayAccountEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/PayAccountEntity.java
+14
-14
PayHistoryRepository.java
...cn/quant/baa/pay/jpa/repository/PayHistoryRepository.java
+0
-2
Acquirer.java
...y-core/src/main/java/cn/quant/baa/pay/model/Acquirer.java
+0
-25
ModelBuilder.java
...re/src/main/java/cn/quant/baa/pay/model/ModelBuilder.java
+16
-10
GoodsDetail.java
...src/main/java/cn/quant/baa/pay/model/web/GoodsDetail.java
+1
-1
MerchantAcquirerProperties.java
...n/quant/baa/pay/model/web/MerchantAcquirerProperties.java
+3
-3
MerchantChannelRequestData.java
...n/quant/baa/pay/model/web/MerchantChannelRequestData.java
+1
-1
MerchantChannelResponseData.java
.../quant/baa/pay/model/web/MerchantChannelResponseData.java
+8
-8
PayRequestData.java
.../main/java/cn/quant/baa/pay/model/web/PayRequestData.java
+1
-1
MerchantService.java
...c/main/java/cn/quant/baa/pay/service/MerchantService.java
+17
-17
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+7
-7
AssertUtils.java
...core/src/main/java/cn/quant/baa/pay/util/AssertUtils.java
+1
-1
ServerApplication.java
...ver/src/main/java/cn/quant/baa/pay/ServerApplication.java
+2
-2
BusinessController.java
...c/main/java/cn/quant/baa/pay/rest/BusinessController.java
+0
-12
MerchantController.java
...c/main/java/cn/quant/baa/pay/rest/MerchantController.java
+6
-7
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+1
-7
TestApplication.java
...erver/src/test/java/cn/quant/baa/pay/TestApplication.java
+1
-1
No files found.
baa-pay-core/src/main/java/cn/quant/baa/pay/
config/MerchantAcquirerBuilder
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/
acquirer/AcquirerConfiguration
.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
config
;
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
cn.quant.spring.ExistsException
;
import
cn.quant.spring.ExistsException
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
import
com.google.common.base.Supplier
;
import
com.google.common.base.Supplier
;
...
@@ -16,18 +15,18 @@ import java.util.Map;
...
@@ -16,18 +15,18 @@ import java.util.Map;
/**
/**
* Created by Administrator on 2021/8/22 0022.
* Created by Administrator on 2021/8/22 0022.
*/
*/
public
class
MerchantAcquirerBuilder
{
public
class
AcquirerConfiguration
{
private
Table
<
String
,
String
,
Collection
<
MerchantAcquirerProfile
>>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
()
private
Table
<
String
,
String
,
Collection
<
AcquirerProperties
>>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
()
,
new
Supplier
()
{
,
new
Supplier
()
{
public
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
get
()
{
public
Map
<
String
,
Collection
<
AcquirerProperties
>>
get
()
{
return
Maps
.
newLinkedHashMap
();
return
Maps
.
newLinkedHashMap
();
}
}
});
});
private
Map
<
Long
,
MerchantAcquirerProfile
>
map
=
new
HashMap
<>();
private
Map
<
Long
,
AcquirerProperties
>
map
=
new
HashMap
<>();
void
add
(
MerchantAcquirerProfile
profile
)
{
void
add
(
AcquirerProperties
profile
)
{
if
(
map
.
containsKey
(
profile
.
getMchChanId
()))
{
if
(
map
.
containsKey
(
profile
.
getMchChanId
()))
{
throw
new
ExistsException
(
StringUtils
.
format
(
"Existing merchant acquirer {}."
,
profile
.
getMchChanId
()));
throw
new
ExistsException
(
StringUtils
.
format
(
"Existing merchant acquirer {}."
,
profile
.
getMchChanId
()));
}
}
...
@@ -35,7 +34,7 @@ public class MerchantAcquirerBuilder {
...
@@ -35,7 +34,7 @@ public class MerchantAcquirerBuilder {
String
appId
=
profile
.
getPayAppId
();
String
appId
=
profile
.
getPayAppId
();
String
chanCode
=
profile
.
getPayChanCode
();
String
chanCode
=
profile
.
getPayChanCode
();
Collection
<
MerchantAcquirerProfile
>
profiles
=
bigTable
.
get
(
appId
,
chanCode
);
Collection
<
AcquirerProperties
>
profiles
=
bigTable
.
get
(
appId
,
chanCode
);
if
(
profiles
==
null
)
{
if
(
profiles
==
null
)
{
profiles
=
new
LinkedList
<>();
profiles
=
new
LinkedList
<>();
bigTable
.
put
(
appId
,
chanCode
,
profiles
);
bigTable
.
put
(
appId
,
chanCode
,
profiles
);
...
@@ -43,19 +42,19 @@ public class MerchantAcquirerBuilder {
...
@@ -43,19 +42,19 @@ public class MerchantAcquirerBuilder {
profiles
.
add
(
profile
);
profiles
.
add
(
profile
);
}
}
public
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
get
(
String
mchId
,
String
channel
)
{
public
Map
<
String
,
Collection
<
AcquirerProperties
>>
get
(
String
mchId
,
String
channel
)
{
Collection
<
MerchantAcquirerProfile
>
profiles
=
bigTable
.
get
(
mchId
,
channel
);
Collection
<
AcquirerProperties
>
profiles
=
bigTable
.
get
(
mchId
,
channel
);
return
toMap
(
profiles
);
return
toMap
(
profiles
);
}
}
public
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
get
(
String
mchId
)
{
public
Map
<
String
,
Collection
<
AcquirerProperties
>>
get
(
String
mchId
)
{
return
bigTable
.
row
(
mchId
);
return
bigTable
.
row
(
mchId
);
}
}
public
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
toMap
(
Collection
<
MerchantAcquirerProfile
>
profiles
)
{
public
Map
<
String
,
Collection
<
AcquirerProperties
>>
toMap
(
Collection
<
AcquirerProperties
>
profiles
)
{
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
map
=
new
HashMap
<>();
Map
<
String
,
Collection
<
AcquirerProperties
>>
map
=
new
HashMap
<>();
for
(
MerchantAcquirerProfile
profile
:
profiles
)
{
for
(
AcquirerProperties
profile
:
profiles
)
{
Collection
<
MerchantAcquirerProfile
>
collection
=
map
.
get
(
profile
.
getPayChanCode
());
Collection
<
AcquirerProperties
>
collection
=
map
.
get
(
profile
.
getPayChanCode
());
if
(
collection
==
null
)
{
if
(
collection
==
null
)
{
collection
=
new
LinkedList
<>();
collection
=
new
LinkedList
<>();
map
.
put
(
profile
.
getPayChanCode
(),
collection
);
map
.
put
(
profile
.
getPayChanCode
(),
collection
);
...
@@ -65,7 +64,7 @@ public class MerchantAcquirerBuilder {
...
@@ -65,7 +64,7 @@ public class MerchantAcquirerBuilder {
return
map
;
return
map
;
}
}
public
MerchantAcquirerProfile
get
(
Long
channelId
)
{
public
AcquirerProperties
get
(
Long
channelId
)
{
return
map
.
get
(
channelId
);
return
map
.
get
(
channelId
);
}
}
};
};
\ No newline at end of file
baa-pay-core/src/main/java/cn/quant/baa/pay/
config/AcquirerBuild
er.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/
acquirer/AcquirerConfigur
er.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
config
;
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
com.google.common.base.Supplier
;
import
com.google.common.base.Supplier
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Table
;
import
com.google.common.collect.Table
;
...
@@ -14,7 +13,7 @@ import java.util.Map;
...
@@ -14,7 +13,7 @@ import java.util.Map;
/**
/**
* Created by Administrator on 2021/8/22 0022.
* Created by Administrator on 2021/8/22 0022.
*/
*/
public
class
Acquirer
Build
er
{
public
class
Acquirer
Configur
er
{
private
Table
<
Class
,
Object
,
Object
>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
(),
new
Supplier
()
{
private
Table
<
Class
,
Object
,
Object
>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
(),
new
Supplier
()
{
public
Map
<
Object
,
Object
>
get
()
{
public
Map
<
Object
,
Object
>
get
()
{
...
@@ -23,22 +22,22 @@ public class AcquirerBuilder {
...
@@ -23,22 +22,22 @@ public class AcquirerBuilder {
});
});
public
MerchantAcquirerBuilder
build
(
Collection
<
MchChannelEntity
>
entities
){
public
AcquirerConfiguration
configure
(
Collection
<
MchChannelEntity
>
entities
){
MerchantAcquirerBuilder
builder
=
new
MerchantAcquirerBuilder
();
AcquirerConfiguration
configuration
=
new
AcquirerConfiguration
();
for
(
MchChannelEntity
entity
:
entities
)
{
for
(
MchChannelEntity
entity
:
entities
)
{
MerchantAcquirerProfile
profile
=
build
(
entity
);
AcquirerProperties
profile
=
configure
(
entity
);
builder
.
add
(
profile
);
configuration
.
add
(
profile
);
}
}
return
builder
;
return
configuration
;
}
}
public
void
release
(){
public
void
release
(){
bigTable
.
clear
();
bigTable
.
clear
();
}
}
public
MerchantAcquirerProfile
build
(
MchChannelEntity
entity
)
{
public
AcquirerProperties
configure
(
MchChannelEntity
entity
)
{
MerchantAcquirerProfile
profile
=
new
MerchantAcquirerProfile
();
AcquirerProperties
profile
=
new
AcquirerProperties
();
profile
.
setMchChanId
(
entity
.
getId
());
profile
.
setMchChanId
(
entity
.
getId
());
profile
.
setPayChanCode
(
entity
.
getPayChanCode
());
profile
.
setPayChanCode
(
entity
.
getPayChanCode
());
profile
.
setPayAcctId
(
entity
.
getPayAcctId
());
profile
.
setPayAcctId
(
entity
.
getPayAcctId
());
...
@@ -81,11 +80,11 @@ public class AcquirerBuilder {
...
@@ -81,11 +80,11 @@ public class AcquirerBuilder {
}
}
public
class
PayApp
{
public
class
PayApp
{
public
Acquirer
Build
er
apps
(
Collection
<
PayAppEntity
>
entities
)
{
public
Acquirer
Configur
er
apps
(
Collection
<
PayAppEntity
>
entities
)
{
for
(
PayAppEntity
entity
:
entities
)
{
for
(
PayAppEntity
entity
:
entities
)
{
bigTable
.
put
(
entity
.
getClass
(),
entity
.
getPayAppId
(),
entity
);
bigTable
.
put
(
entity
.
getClass
(),
entity
.
getPayAppId
(),
entity
);
}
}
return
Acquirer
Build
er
.
this
;
return
Acquirer
Configur
er
.
this
;
}
}
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/
model/MerchantAcquirerProfile
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/
acquirer/AcquirerProperties
.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
import
cn.quant.baa.pay.dict.AccessCode
;
import
cn.quant.baa.pay.dict.AccessCode
;
import
cn.quant.baa.pay.dict.AccessType
;
import
cn.quant.baa.pay.dict.AccessType
;
...
@@ -10,7 +10,7 @@ import java.time.LocalDate;
...
@@ -10,7 +10,7 @@ import java.time.LocalDate;
/**
/**
* Created by Administrator on 2021/8/22 0022.
* Created by Administrator on 2021/8/22 0022.
*/
*/
public
class
MerchantAcquirerProfile
implements
Serializable
{
public
class
AcquirerProperties
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
9197591972747983682L
;
private
static
final
long
serialVersionUID
=
-
9197591972747983682L
;
...
@@ -27,9 +27,9 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -27,9 +27,9 @@ public class MerchantAcquirerProfile implements Serializable{
private
String
name
;
private
String
name
;
private
String
encryp
tKey
;
private
String
secre
tKey
;
private
String
encryp
tType
;
private
String
secre
tType
;
private
String
signType
;
private
String
signType
;
...
@@ -114,20 +114,20 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -114,20 +114,20 @@ public class MerchantAcquirerProfile implements Serializable{
this
.
name
=
name
;
this
.
name
=
name
;
}
}
public
String
get
Encryp
tKey
()
{
public
String
get
Secre
tKey
()
{
return
encryp
tKey
;
return
secre
tKey
;
}
}
public
void
set
EncryptKey
(
String
encryp
tKey
)
{
public
void
set
SecretKey
(
String
secre
tKey
)
{
this
.
encryptKey
=
encryp
tKey
;
this
.
secretKey
=
secre
tKey
;
}
}
public
String
get
Encryp
tType
()
{
public
String
get
Secre
tType
()
{
return
encryp
tType
;
return
secre
tType
;
}
}
public
void
set
EncryptType
(
String
encryp
tType
)
{
public
void
set
SecretType
(
String
secre
tType
)
{
this
.
encryptType
=
encryp
tType
;
this
.
secretType
=
secre
tType
;
}
}
public
String
getSignType
()
{
public
String
getSignType
()
{
...
@@ -284,7 +284,7 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -284,7 +284,7 @@ public class MerchantAcquirerProfile implements Serializable{
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"
MerchantAcquirerProfile
{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"
AcquirerProperties
{"
);
sb
.
append
(
"mchChanId="
).
append
(
mchChanId
);
sb
.
append
(
"mchChanId="
).
append
(
mchChanId
);
sb
.
append
(
", payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", payAcctId='"
).
append
(
payAcctId
).
append
(
'\''
);
sb
.
append
(
", payAcctId='"
).
append
(
payAcctId
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
0 → 100644
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
import
cn.quant.spring.security.Base64Cipher
;
import
cn.quant.spring.security.CharacterCipher
;
import
javax.crypto.Cipher
;
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
;
public
MerchantAcquirer
init
(
AcquirerProperties
properties
)
throws
NoSuchPaddingException
,
NoSuchAlgorithmException
,
InvalidKeyException
{
characterCipher
=
new
Base64Cipher
();
String
secretType
=
properties
.
getSecretType
();
if
(
secretType
.
startsWith
(
"AES"
))
{
secretKey
=
new
SecretKeySpec
(
properties
.
getSecretKey
().
getBytes
(),
"AES"
);
}
cipher
=
Cipher
.
getInstance
(
secretType
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
);
Base64
.
getEncoder
().
encodeToString
(
"aaa"
.
getBytes
());
// 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/acquirer/weixin/WeiXinMerchantAcquirer.java
0 → 100644
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
acquirer
.
weixin
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
/**
* Created by Administrator on 2021/8/31 0031.
*/
public
class
WeiXinMerchantAcquirer
extends
MerchantAcquirer
{
}
baa-pay-core/src/main/java/cn/quant/baa/pay/config/ServerConfiguration.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
config
;
package
cn
.
quant
.
baa
.
pay
.
config
;
import
cn.quant.baa.pay.acquirer.AcquirerConfiguration
;
import
cn.quant.baa.pay.acquirer.AcquirerConfigurer
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.repository.*
;
import
cn.quant.baa.pay.jpa.repository.*
;
import
cn.quant.baa.pay.model.DictionaryItem
;
import
cn.quant.baa.pay.model.DictionaryItem
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -31,20 +32,20 @@ public class ServerConfiguration {
...
@@ -31,20 +32,20 @@ public class ServerConfiguration {
@Autowired
@Autowired
private
DictionaryRepository
dictionaryRepository
;
private
DictionaryRepository
dictionaryRepository
;
public
Acquirer
Builder
acquirerBuild
er
()
{
public
Acquirer
Configurer
configur
er
()
{
List
<
PayAccountEntity
>
accounts
=
payAccountRepository
.
findAll
();
List
<
PayAccountEntity
>
accounts
=
payAccountRepository
.
findAll
();
List
<
PayFeatureEntity
>
features
=
payFeatureRepository
.
findAll
();
List
<
PayFeatureEntity
>
features
=
payFeatureRepository
.
findAll
();
List
<
PayAppEntity
>
apps
=
payAppRepository
.
findAll
();
List
<
PayAppEntity
>
apps
=
payAppRepository
.
findAll
();
Acquirer
Builder
builder
=
new
AcquirerBuild
er
();
Acquirer
Configurer
configurer
=
new
AcquirerConfigur
er
();
build
er
.
accounts
(
accounts
)
configur
er
.
accounts
(
accounts
)
.
features
(
features
)
.
features
(
features
)
.
apps
(
apps
);
.
apps
(
apps
);
accounts
.
clear
();
accounts
.
clear
();
features
.
clear
();
features
.
clear
();
apps
.
clear
();
apps
.
clear
();
return
build
er
;
return
configur
er
;
}
}
@Bean
@Bean
...
@@ -63,12 +64,12 @@ public class ServerConfiguration {
...
@@ -63,12 +64,12 @@ public class ServerConfiguration {
}
}
@Bean
@Bean
public
MerchantAcquirerBuilder
merchantAcquirerBuilder
()
{
public
AcquirerConfiguration
acquirerConfiguration
()
{
Acquirer
Builder
acquirerBuilder
=
acquirerBuild
er
();
Acquirer
Configurer
configurer
=
configur
er
();
List
<
MchChannelEntity
>
entities
=
mchChannelRepository
.
findAll
();
List
<
MchChannelEntity
>
entities
=
mchChannelRepository
.
findAll
();
MerchantAcquirerBuilder
builder
=
acquirerBuilder
.
build
(
entities
);
AcquirerConfiguration
configuration
=
configurer
.
configure
(
entities
);
acquirerBuild
er
.
release
();
configur
er
.
release
();
entities
.
clear
();
entities
.
clear
();
return
builder
;
return
configuration
;
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.dict.*
;
import
cn.quant.baa.pay.dict.*
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.web.GoodsDetail
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.model.web.PayRequestData
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.spring.util.DateUtils
;
import
cn.quant.spring.util.DateUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -59,7 +59,7 @@ public class EntityBuilder {
...
@@ -59,7 +59,7 @@ public class EntityBuilder {
return
account
;
return
account
;
}
}
public
static
PayHistoryEntity
history
(
AccountEntity
account
,
PayHistoryIds
ids
,
long
historyId
,
PayRequestData
data
,
MerchantAcquirerProfile
profile
public
static
PayHistoryEntity
history
(
AccountEntity
account
,
PayHistoryIds
ids
,
long
historyId
,
PayRequestData
data
,
AcquirerProperties
profile
,
TransactionSession
session
)
{
,
TransactionSession
session
)
{
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayAccountEntity.java
View file @
7188ae0e
...
@@ -29,11 +29,11 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
...
@@ -29,11 +29,11 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
@Column
(
name
=
"NAME"
,
nullable
=
false
,
length
=
255
)
@Column
(
name
=
"NAME"
,
nullable
=
false
,
length
=
255
)
private
String
name
;
private
String
name
;
@Column
(
name
=
"
ENCRYP
T_KEY"
,
nullable
=
false
,
length
=
64
)
@Column
(
name
=
"
SECRE
T_KEY"
,
nullable
=
false
,
length
=
64
)
private
String
encryp
tKey
;
private
String
secre
tKey
;
@Column
(
name
=
"
ENCRYP
T_TYPE"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"
SECRE
T_TYPE"
,
nullable
=
false
,
length
=
32
)
private
String
encryp
tType
;
private
String
secre
tType
;
@Column
(
name
=
"SIGN_TYPE"
,
nullable
=
false
,
length
=
32
)
@Column
(
name
=
"SIGN_TYPE"
,
nullable
=
false
,
length
=
32
)
private
String
signType
;
private
String
signType
;
...
@@ -76,20 +76,20 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
...
@@ -76,20 +76,20 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
this
.
name
=
name
;
this
.
name
=
name
;
}
}
public
String
get
Encryp
tKey
()
{
public
String
get
Secre
tKey
()
{
return
encryp
tKey
;
return
secre
tKey
;
}
}
public
void
set
Encryp
tKey
(
String
encryptKey
)
{
public
void
set
Secre
tKey
(
String
encryptKey
)
{
this
.
encryp
tKey
=
encryptKey
;
this
.
secre
tKey
=
encryptKey
;
}
}
public
String
get
Encryp
tType
()
{
public
String
get
Secre
tType
()
{
return
encryp
tType
;
return
secre
tType
;
}
}
public
void
set
Encryp
tType
(
String
encryptType
)
{
public
void
set
Secre
tType
(
String
encryptType
)
{
this
.
encryp
tType
=
encryptType
;
this
.
secre
tType
=
encryptType
;
}
}
public
String
getSignType
()
{
public
String
getSignType
()
{
...
@@ -136,8 +136,8 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
...
@@ -136,8 +136,8 @@ public class PayAccountEntity extends OptimisticEntity implements Serializable {
sb
.
append
(
", payChanType="
).
append
(
payChanType
);
sb
.
append
(
", payChanType="
).
append
(
payChanType
);
sb
.
append
(
", domain='"
).
append
(
domain
).
append
(
'\''
);
sb
.
append
(
", domain='"
).
append
(
domain
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
",
encryptKey='"
).
append
(
encryp
tKey
).
append
(
'\''
);
sb
.
append
(
",
secretKey='"
).
append
(
secre
tKey
).
append
(
'\''
);
sb
.
append
(
",
encryptType='"
).
append
(
encryp
tType
).
append
(
'\''
);
sb
.
append
(
",
secretType='"
).
append
(
secre
tType
).
append
(
'\''
);
sb
.
append
(
", signType='"
).
append
(
signType
).
append
(
'\''
);
sb
.
append
(
", signType='"
).
append
(
signType
).
append
(
'\''
);
sb
.
append
(
", privateKey='"
).
append
(
privateKey
).
append
(
'\''
);
sb
.
append
(
", privateKey='"
).
append
(
privateKey
).
append
(
'\''
);
sb
.
append
(
", payPublicKey='"
).
append
(
payPublicKey
).
append
(
'\''
);
sb
.
append
(
", payPublicKey='"
).
append
(
payPublicKey
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/repository/PayHistoryRepository.java
View file @
7188ae0e
...
@@ -14,6 +14,4 @@ import org.springframework.stereotype.Repository;
...
@@ -14,6 +14,4 @@ import org.springframework.stereotype.Repository;
@Repository
@Repository
public
interface
PayHistoryRepository
extends
JpaRepository
<
PayHistoryEntity
,
PayHistoryIds
>
{
public
interface
PayHistoryRepository
extends
JpaRepository
<
PayHistoryEntity
,
PayHistoryIds
>
{
@Query
(
""
)
int
counAAAt
(
PayHistoryIds
ids
);
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/model/Acquirer.java
deleted
100644 → 0
View file @
09570a5b
package
cn
.
quant
.
baa
.
pay
.
model
;
/**
* Created by Administrator on 2021/8/23 0023.
*/
public
class
Acquirer
{
private
String
code
;
private
String
name
;
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/model/ModelBuilder.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.config.DictionaryViewer
;
import
cn.quant.baa.pay.config.DictionaryViewer
;
import
cn.quant.baa.pay.dict.DictType
;
import
cn.quant.baa.pay.dict.DictType
;
import
cn.quant.baa.pay.model.web.MerchantChannelResponseData
;
import
cn.quant.spring.UnsupportedException
;
import
cn.quant.spring.UnsupportedException
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -21,8 +24,8 @@ public class ModelBuilder {
...
@@ -21,8 +24,8 @@ public class ModelBuilder {
@Autowired
@Autowired
private
DictionaryViewer
dictionaryViewer
;
private
DictionaryViewer
dictionaryViewer
;
public
MerchantAcquirer
toModel
(
MerchantAcquirerProfile
profile
)
{
public
MerchantAcquirer
Properties
toModel
(
AcquirerProperties
profile
)
{
MerchantAcquirer
response
=
new
MerchantAcquirer
();
MerchantAcquirer
Properties
response
=
new
MerchantAcquirerProperties
();
response
.
setAccessCode
(
profile
.
getAccessCode
().
name
());
response
.
setAccessCode
(
profile
.
getAccessCode
().
name
());
response
.
setAccessType
(
profile
.
getAccessType
().
name
());
response
.
setAccessType
(
profile
.
getAccessType
().
name
());
response
.
setChanCode
(
profile
.
getPayChanCode
());
response
.
setChanCode
(
profile
.
getPayChanCode
());
...
@@ -34,27 +37,30 @@ public class ModelBuilder {
...
@@ -34,27 +37,30 @@ public class ModelBuilder {
return
response
;
return
response
;
}
}
public
Collection
<
MerchantAcquirer
>
toModel
(
Collection
<
MerchantAcquirerProfile
>
profiles
)
{
public
Collection
<
MerchantAcquirer
Properties
>
toModel
(
Collection
<
AcquirerProperties
>
profiles
)
{
LinkedList
<
MerchantAcquirer
>
list
=
new
LinkedList
<>();
LinkedList
<
MerchantAcquirer
Properties
>
list
=
new
LinkedList
<>();
for
(
MerchantAcquirerProfile
profile
:
profiles
)
{
for
(
AcquirerProperties
profile
:
profiles
)
{
list
.
add
(
toModel
(
profile
));
list
.
add
(
toModel
(
profile
));
}
}
return
list
;
return
list
;
}
}
public
Map
<
String
,
Merchant
AcquirerBook
>
toModel
(
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
profile
s
)
{
public
Map
<
String
,
Merchant
ChannelResponseData
>
toModel
(
Map
<
String
,
Collection
<
AcquirerProperties
>>
profiles
,
String
acces
s
)
{
Map
<
String
,
Merchant
AcquirerBook
>
models
=
new
HashMap
<>();
Map
<
String
,
Merchant
ChannelResponseData
>
models
=
new
HashMap
<>();
for
(
String
code
:
profiles
.
keySet
())
{
for
(
String
code
:
profiles
.
keySet
())
{
DictionaryItem
item
=
dictionaryViewer
.
get
(
DictType
.
PAY
,
code
);
DictionaryItem
item
=
dictionaryViewer
.
get
(
DictType
.
PAY
,
code
);
if
(
item
==
null
)
{
if
(
item
==
null
)
{
throw
new
UnsupportedException
(
StringUtils
.
format
(
"Dictionary item is null({}, {})."
,
DictType
.
PAY
,
code
));
throw
new
UnsupportedException
(
StringUtils
.
format
(
"Dictionary item is null({}, {})."
,
DictType
.
PAY
,
code
));
}
}
Collection
<
MerchantAcquirerProfile
>
collection
=
profiles
.
get
(
code
);
Collection
<
AcquirerProperties
>
collection
=
profiles
.
get
(
code
);
Merchant
AcquirerBook
book
=
new
MerchantAcquirerBook
();
Merchant
ChannelResponseData
book
=
new
MerchantChannelResponseData
();
book
.
setCode
(
code
);
book
.
setCode
(
code
);
book
.
setName
(
item
.
getName
());
book
.
setName
(
item
.
getName
());
book
.
setImageUrl
(
item
.
getImageUrl
());
book
.
setImageUrl
(
item
.
getImageUrl
());
for
(
MerchantAcquirerProfile
profile
:
collection
)
{
for
(
AcquirerProperties
profile
:
collection
)
{
if
((
access
!=
null
)
&&
(!
access
.
equals
(
profile
.
getAccessCode
().
name
())))
{
continue
;
}
book
.
add
(
toModel
(
profile
));
book
.
add
(
toModel
(
profile
));
}
}
models
.
put
(
book
.
getCode
(),
book
);
models
.
put
(
book
.
getCode
(),
book
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/GoodsDetail.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
web/
GoodsDetail.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
web
;
import
javax.validation.constraints.*
;
import
javax.validation.constraints.*
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
MerchantAcquirer
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
web/MerchantAcquirerProperties
.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
web
;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* Created by Administrator on 2021/8/23 0023.
* Created by Administrator on 2021/8/23 0023.
*/
*/
public
class
MerchantAcquirer
implements
Serializable
{
public
class
MerchantAcquirer
Properties
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1777009242558105988L
;
private
static
final
long
serialVersionUID
=
1777009242558105988L
;
private
Long
chanId
;
private
Long
chanId
;
private
String
chanCode
;
private
String
chanCode
;
...
@@ -82,7 +82,7 @@ public class MerchantAcquirer implements Serializable {
...
@@ -82,7 +82,7 @@ public class MerchantAcquirer implements Serializable {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"MerchantAcquirer{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"MerchantAcquirer
Properties
{"
);
sb
.
append
(
"chanId="
).
append
(
chanId
);
sb
.
append
(
"chanId="
).
append
(
chanId
);
sb
.
append
(
", chanCode='"
).
append
(
chanCode
).
append
(
'\''
);
sb
.
append
(
", chanCode='"
).
append
(
chanCode
).
append
(
'\''
);
sb
.
append
(
", chanType='"
).
append
(
chanType
).
append
(
'\''
);
sb
.
append
(
", chanType='"
).
append
(
chanType
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/MerchantChannelRequestData.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
web/
MerchantChannelRequestData.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
web
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
MerchantAcquirerBook
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
web/MerchantChannelResponseData
.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
web
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -7,7 +7,7 @@ import java.util.Map;
...
@@ -7,7 +7,7 @@ import java.util.Map;
/**
/**
* Created by Administrator on 2021/8/23 0023.
* Created by Administrator on 2021/8/23 0023.
*/
*/
public
class
Merchant
AcquirerBook
implements
Serializable
{
public
class
Merchant
ChannelResponseData
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7479646457077040392L
;
private
static
final
long
serialVersionUID
=
-
7479646457077040392L
;
private
String
code
;
private
String
code
;
...
@@ -16,17 +16,17 @@ public class MerchantAcquirerBook implements Serializable {
...
@@ -16,17 +16,17 @@ public class MerchantAcquirerBook implements Serializable {
private
String
imageUrl
;
private
String
imageUrl
;
private
Map
<
String
,
MerchantAcquirer
>
acquirers
;
private
Map
<
String
,
MerchantAcquirer
Properties
>
acquirers
;
public
Merchant
AcquirerBook
()
{
public
Merchant
ChannelResponseData
()
{
acquirers
=
new
HashMap
<
String
,
MerchantAcquirer
>();
acquirers
=
new
HashMap
<
String
,
MerchantAcquirer
Properties
>();
}
}
public
Map
<
String
,
MerchantAcquirer
>
getAcquirers
()
{
public
Map
<
String
,
MerchantAcquirer
Properties
>
getAcquirers
()
{
return
acquirers
;
return
acquirers
;
}
}
public
void
add
(
MerchantAcquirer
acquirer
)
{
public
void
add
(
MerchantAcquirer
Properties
acquirer
)
{
acquirers
.
put
(
acquirer
.
getAccessCode
(),
acquirer
);
acquirers
.
put
(
acquirer
.
getAccessCode
(),
acquirer
);
}
}
...
@@ -56,7 +56,7 @@ public class MerchantAcquirerBook implements Serializable {
...
@@ -56,7 +56,7 @@ public class MerchantAcquirerBook implements Serializable {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"Merchant
AcquirerBook
{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"Merchant
ChannelResponseData
{"
);
sb
.
append
(
"code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
"code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/PayRequestData.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
web/
PayRequestData.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
web
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Size
;
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/MerchantService.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
service
;
package
cn
.
quant
.
baa
.
pay
.
service
;
import
cn.quant.baa.pay.
model.MerchantChannelRequestData
;
import
cn.quant.baa.pay.
acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.
config.MerchantAcquirerBuilder
;
import
cn.quant.baa.pay.
model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.
MerchantAcquirer
;
import
cn.quant.baa.pay.model.
web.MerchantChannelResponseData
;
import
cn.quant.baa.pay.model.
MerchantAcquirerBook
;
import
cn.quant.baa.pay.model.
web.MerchantChannelRequestData
;
import
cn.quant.baa.pay.
model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.
acquirer.AcquirerConfiguration
;
import
cn.quant.baa.pay.model.ModelBuilder
;
import
cn.quant.baa.pay.model.ModelBuilder
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -20,39 +20,39 @@ import java.util.Map;
...
@@ -20,39 +20,39 @@ import java.util.Map;
@Service
@Service
public
class
MerchantService
{
public
class
MerchantService
{
@Autowired
@Autowired
private
MerchantAcquirerBuilder
merchantAcquirerBuilder
;
private
AcquirerConfiguration
acquirerConfiguration
;
@Autowired
@Autowired
private
ModelBuilder
modelBuilder
;
private
ModelBuilder
modelBuilder
;
@Cacheable
(
cacheManager
=
"profileCacheManager"
//
@Cacheable(cacheManager = "profileCacheManager"
,
cacheNames
=
"LOCAL_PROFILE"
//
, cacheNames = "LOCAL_PROFILE"
,
key
=
"#requestData.persistenceKey()"
)
//
, key = "#requestData.persistenceKey()")
public
Map
<
String
,
Merchant
AcquirerBook
>
getChannels
(
MerchantChannelRequestData
requestData
)
{
public
Map
<
String
,
Merchant
ChannelResponseData
>
getChannels
(
MerchantChannelRequestData
requestData
)
{
String
mchId
=
requestData
.
getMchId
();
String
mchId
=
requestData
.
getMchId
();
String
channel
=
requestData
.
getChannel
();
String
channel
=
requestData
.
getChannel
();
Map
<
String
,
Collection
<
MerchantAcquirerProfile
>>
profiles
;
Map
<
String
,
Collection
<
AcquirerProperties
>>
profiles
;
if
(
StringUtils
.
isEmpty
(
channel
))
{
if
(
StringUtils
.
isEmpty
(
channel
))
{
profiles
=
merchantAcquirerBuilder
.
get
(
mchId
);
profiles
=
acquirerConfiguration
.
get
(
mchId
);
}
else
{
}
else
{
profiles
=
merchantAcquirerBuilder
.
get
(
mchId
,
channel
);
profiles
=
acquirerConfiguration
.
get
(
mchId
,
channel
);
}
}
Map
<
String
,
Merchant
AcquirerBook
>
response
=
modelBuilder
.
toModel
(
profiles
);
Map
<
String
,
Merchant
ChannelResponseData
>
response
=
modelBuilder
.
toModel
(
profiles
,
requestData
.
getAccess
()
);
return
response
;
return
response
;
}
}
public
MerchantAcquirer
getChannel
(
MerchantChannelRequestData
requestData
)
{
public
MerchantAcquirer
Properties
getChannel
(
MerchantChannelRequestData
requestData
)
{
return
getChannel
(
Long
.
parseLong
(
requestData
.
getChanId
()));
return
getChannel
(
Long
.
parseLong
(
requestData
.
getChanId
()));
}
}
@Cacheable
(
cacheManager
=
"profileCacheManager"
@Cacheable
(
cacheManager
=
"profileCacheManager"
,
cacheNames
=
"LOCAL_PROFILE"
,
cacheNames
=
"LOCAL_PROFILE"
,
key
=
"#id"
)
,
key
=
"#id"
)
public
MerchantAcquirer
getChannel
(
Long
id
)
{
public
MerchantAcquirer
Properties
getChannel
(
Long
id
)
{
MerchantAcquirerProfile
profile
=
merchantAcquirerBuilder
.
get
(
id
);
AcquirerProperties
profile
=
acquirerConfiguration
.
get
(
id
);
return
modelBuilder
.
toModel
(
profile
);
return
modelBuilder
.
toModel
(
profile
);
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
service
;
package
cn
.
quant
.
baa
.
pay
.
service
;
import
cn.quant.baa.pay.
config.MerchantAcquirerBuilder
;
import
cn.quant.baa.pay.
acquirer.AcquirerConfiguration
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.
mode
l.AssertUtils
;
import
cn.quant.baa.pay.
uti
l.AssertUtils
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.
web.
GoodsDetail
;
import
cn.quant.baa.pay.
model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.
acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.baa.pay.model.
web.
PayRequestData
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -28,7 +28,7 @@ public class TransactionService extends BusinessService {
...
@@ -28,7 +28,7 @@ public class TransactionService extends BusinessService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TransactionService
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TransactionService
.
class
);
@Autowired
@Autowired
private
MerchantAcquirerBuilder
merchantAcquirerBuilder
;
private
AcquirerConfiguration
acquirerConfiguration
;
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
void
check
(
PayHistoryIds
ids
,
TransactionSession
session
)
{
public
void
check
(
PayHistoryIds
ids
,
TransactionSession
session
)
{
...
@@ -44,7 +44,7 @@ public class TransactionService extends BusinessService {
...
@@ -44,7 +44,7 @@ public class TransactionService extends BusinessService {
validate
(
data
);
validate
(
data
);
String
chanId
=
data
.
getChanId
();
String
chanId
=
data
.
getChanId
();
MerchantAcquirerProfile
profile
=
merchantAcquirerBuilder
.
get
(
Long
.
valueOf
(
chanId
));
AcquirerProperties
profile
=
acquirerConfiguration
.
get
(
Long
.
valueOf
(
chanId
));
if
(
profile
==
null
)
{
if
(
profile
==
null
)
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOSUCH
,
chanId
);
AssertUtils
.
throwMessage
(
ACQUIRER_NOSUCH
,
chanId
);
}
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/
mode
l/AssertUtils.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/
uti
l/AssertUtils.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
mode
l
;
package
cn
.
quant
.
baa
.
pay
.
uti
l
;
import
cn.quant.baa.pay.BusinessException
;
import
cn.quant.baa.pay.BusinessException
;
import
cn.quant.baa.pay.dict.MessageEnum
;
import
cn.quant.baa.pay.dict.MessageEnum
;
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/ServerApplication.java
View file @
7188ae0e
...
@@ -20,8 +20,8 @@ import java.time.format.DateTimeFormatter;
...
@@ -20,8 +20,8 @@ import java.time.format.DateTimeFormatter;
/**
/**
* <p><b>Application VM Option:</b><br/>
* <p><b>Application VM Option:</b><br/>
* <code>--spring.config.file=${project.
build
.directory}/target/config/application-dev.properties </code><br/>
* <code>--spring.config.file=${project.
configure
.directory}/target/config/application-dev.properties </code><br/>
* <code>-Dlogging.config=${project.
build
.directory}/target/config/logback-spring.xml</code></p>
* <code>-Dlogging.config=${project.
configure
.directory}/target/config/logback-spring.xml</code></p>
* <p><b>Enable Dubbo Annotation: </b><br/>
* <p><b>Enable Dubbo Annotation: </b><br/>
* <code>@org.springframework.context.annotation.ImportResource(locations = {"classpath:application-dubbo.xml"})</code></p>
* <code>@org.springframework.context.annotation.ImportResource(locations = {"classpath:application-dubbo.xml"})</code></p>
*/
*/
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/BusinessController.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
rest
;
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.spring.IllegalParameterException
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.context.ContextLoader
;
import
cn.quant.spring.context.ServerApplicationContext
;
import
cn.quant.spring.rest.AbstractController
;
import
cn.quant.spring.rest.AbstractController
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.Validator
;
import
java.util.Set
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.
EMPTY_REQ_DATA
;
/**
/**
* Created by Administrator on 2021/8/28 0028.
* Created by Administrator on 2021/8/28 0028.
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/MerchantController.java
View file @
7188ae0e
package
cn
.
quant
.
baa
.
pay
.
rest
;
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.model.
MerchantAcquirer
;
import
cn.quant.baa.pay.model.
web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.
MerchantAcquirerBook
;
import
cn.quant.baa.pay.model.
web.MerchantChannelResponseData
;
import
cn.quant.baa.pay.model.MerchantChannelRequestData
;
import
cn.quant.baa.pay.model.
web.
MerchantChannelRequestData
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.
mode
l.AssertUtils
;
import
cn.quant.baa.pay.
uti
l.AssertUtils
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.service.MerchantService
;
import
cn.quant.baa.pay.service.MerchantService
;
import
cn.quant.spring.http.HttpResponseData
;
import
cn.quant.spring.http.HttpResponseData
;
import
cn.quant.spring.rest.AbstractController
;
import
cn.quant.spring.rest.AbstractController
;
import
cn.quant.spring.util.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -46,7 +45,7 @@ public class MerchantController extends AbstractController {
...
@@ -46,7 +45,7 @@ public class MerchantController extends AbstractController {
}
}
Map
<
String
,
Merchant
AcquirerBook
>
channels
=
merchantService
.
getChannels
(
data
);
Map
<
String
,
Merchant
ChannelResponseData
>
channels
=
merchantService
.
getChannels
(
data
);
ResponseEntity
<
HttpResponseData
>
entity
=
succeed
(
session
.
getRequestId
(),
channels
);
ResponseEntity
<
HttpResponseData
>
entity
=
succeed
(
session
.
getRequestId
(),
channels
);
return
entity
;
return
entity
;
}
}
...
@@ -64,7 +63,7 @@ public class MerchantController extends AbstractController {
...
@@ -64,7 +63,7 @@ public class MerchantController extends AbstractController {
}
}
MerchantAcquirer
channel
=
merchantService
.
getChannel
(
data
);
MerchantAcquirer
Properties
channel
=
merchantService
.
getChannel
(
data
);
ResponseEntity
<
HttpResponseData
>
entity
=
succeed
(
session
.
getRequestId
(),
channel
);
ResponseEntity
<
HttpResponseData
>
entity
=
succeed
(
session
.
getRequestId
(),
channel
);
return
entity
;
return
entity
;
}
}
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
7188ae0e
...
@@ -3,18 +3,12 @@ package cn.quant.baa.pay.rest;
...
@@ -3,18 +3,12 @@ package cn.quant.baa.pay.rest;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.web.PayRequestData
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.baa.pay.service.TransactionService
;
import
cn.quant.baa.pay.service.TransactionService
;
import
cn.quant.spring.rest.AbstractController
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.Validator
;
import
java.util.Set
;
/**
/**
* Created by Administrator on 2021/8/24 0024.
* Created by Administrator on 2021/8/24 0024.
*/
*/
...
...
baa-pay-server/src/test/java/cn/quant/baa/pay/TestApplication.java
View file @
7188ae0e
...
@@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner;
...
@@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner;
/**
/**
* <p><b>JUnit VM Option:</b><br/>
* <p><b>JUnit VM Option:</b><br/>
* <code>-Dspring.config.file=${project.
build
.directory}/target/config/application-dev.properties </code><br/>
* <code>-Dspring.config.file=${project.
configure
.directory}/target/config/application-dev.properties </code><br/>
* </p>
* </p>
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
...
...
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