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
01085b7a
Commit
01085b7a
authored
Sep 28, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
fb914b8e
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
152 additions
and
101 deletions
+152
-101
Constant.java
baa-pay-core/src/main/java/cn/quant/baa/pay/Constant.java
+1
-2
WeiXinMerchantAcquirer.java
...quant/baa/pay/acquirer/weixin/WeiXinMerchantAcquirer.java
+14
-15
EntityBuilder.java
...ore/src/main/java/cn/quant/baa/pay/jpa/EntityBuilder.java
+5
-4
AccountEntity.java
.../main/java/cn/quant/baa/pay/jpa/entity/AccountEntity.java
+46
-46
TransactionSummaryEntity.java
...cn/quant/baa/pay/jpa/entity/TransactionSummaryEntity.java
+12
-0
PayRequestData.java
.../main/java/cn/quant/baa/pay/model/web/PayRequestData.java
+36
-13
BusinessController.java
...c/main/java/cn/quant/baa/pay/rest/BusinessController.java
+3
-1
PayTestController.java
...rc/main/java/cn/quant/baa/pay/rest/PayTestController.java
+1
-1
TechController.java
...r/src/main/java/cn/quant/baa/pay/rest/TechController.java
+18
-0
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+3
-0
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+9
-15
logback-dev.xml
baa-pay-server/src/main/resources/logback-dev.xml
+2
-2
logback-pro.xml
baa-pay-server/src/main/resources/logback-pro.xml
+2
-2
No files found.
baa-pay-core/src/main/java/cn/quant/baa/pay/Constant.java
View file @
01085b7a
...
@@ -26,6 +26,5 @@ public class Constant {
...
@@ -26,6 +26,5 @@ public class Constant {
public
final
static
String
DICT_TYPE_PAY
=
"PAY"
;
public
final
static
String
DICT_TYPE_PAY
=
"PAY"
;
public
final
static
String
DICT_CODE_WXP
=
"WXP"
;
public
final
static
String
DICT_CODE_WXP
=
"WXP"
;
public
final
static
String
DICT_TYPE_APP_CONFIG
=
"APP_CONFIG"
;
public
final
static
String
DICT_TYPE_WXP_CALLBACK_URL
=
"WXP_CALLBACK_URL"
;
public
final
static
String
DICT_CODE_CALLBACK_URL
=
"CALLBACK_URL"
;
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/weixin/WeiXinMerchantAcquirer.java
View file @
01085b7a
...
@@ -34,9 +34,8 @@ import java.security.spec.InvalidKeySpecException;
...
@@ -34,9 +34,8 @@ import java.security.spec.InvalidKeySpecException;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Base64
;
import
java.util.Base64
;
import
java.util.UUID
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
*
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
DICT_TYPE_WXP_CALLBACK_URL
;
import
static
cn
.
quant
.
baa
.
pay
.
acquirer
.
AcquirerConstant
.*;
import
static
cn
.
quant
.
baa
.
pay
.
acquirer
.
AcquirerConstant
.*;
/**
/**
...
@@ -101,13 +100,13 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -101,13 +100,13 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
}
}
@Override
@Override
public
ChannelResponse
pay
(
PayRequestData
request
,
TransactionSummaryEntity
history
)
throws
Exception
{
public
ChannelResponse
pay
(
PayRequestData
request
,
TransactionSummaryEntity
transaction
)
throws
Exception
{
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
// 转换金额为分
// 转换金额为分
DictionaryItemDTO
callback
=
DictionaryViewer
.
get
(
DICT_TYPE_
APP_CONFIG
,
DICT_CODE_CALLBACK_URL
);
DictionaryItemDTO
callback
=
DictionaryViewer
.
get
(
DICT_TYPE_
WXP_CALLBACK_URL
,
properties
.
getAccessCode
().
name
()
);
if
(
callback
==
null
)
{
if
(
callback
==
null
)
{
throw
new
ProfileException
(
"Configuration not found in dictionary : {}; {}; {};"
,
DICT_TYPE_
APP_CONFIG
,
DICT_CODE_CALLBACK_URL
,
request
);
throw
new
ProfileException
(
"Configuration not found in dictionary : {}; {}; {};"
,
DICT_TYPE_
WXP_CALLBACK_URL
,
properties
.
getAccessCode
().
name
()
,
request
);
}
}
BigInteger
amount
=
new
BigDecimal
(
request
.
getAmount
()).
multiply
(
new
BigDecimal
(
100
)).
toBigInteger
();
BigInteger
amount
=
new
BigDecimal
(
request
.
getAmount
()).
multiply
(
new
BigDecimal
(
100
)).
toBigInteger
();
...
@@ -116,25 +115,25 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -116,25 +115,25 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
.
put
(
"attach"
,
request
.
getAttach
())
.
put
(
"attach"
,
request
.
getAttach
())
.
put
(
"description"
,
request
.
getSubject
())
.
put
(
"description"
,
request
.
getSubject
())
.
put
(
"notify_url"
,
callback
.
getValue
()
+
request
.
getChanId
())
.
put
(
"notify_url"
,
callback
.
getValue
()
+
request
.
getChanId
())
.
put
(
"out_trade_no"
,
history
.
getTransactionId
().
toString
());
.
put
(
"out_trade_no"
,
transaction
.
getTransactionId
().
toString
());
bodyNode
.
putObject
(
"amount"
)
bodyNode
.
putObject
(
"amount"
)
.
put
(
"total"
,
amount
);
.
put
(
"total"
,
amount
);
ObjectNode
sceneInfo
=
objectMapper
.
createObjectNode
()
ObjectNode
sceneInfo
=
objectMapper
.
createObjectNode
()
.
put
(
"payer_client_ip"
,
"127.0.0.1"
);
.
put
(
"payer_client_ip"
,
request
.
getRequestIp
()
);
switch
(
properties
.
getAccessCode
())
{
switch
(
properties
.
getAccessCode
())
{
case
H5:
case
H5:
sceneInfo
.
putObject
(
"h5_info"
).
put
(
"type"
,
"Wap"
);
sceneInfo
.
putObject
(
"h5_info"
).
put
(
"type"
,
"Wap"
);
break
;
break
;
case
JS:
case
JS:
bodyNode
.
putObject
(
"payer"
)
bodyNode
.
putObject
(
"payer"
)
.
put
(
"openid"
,
"oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
);
.
put
(
"openid"
,
transaction
.
getAccountNo
()
);
break
;
break
;
case
APP:
case
APP:
default
:
default
:
}
}
bodyNode
.
set
(
"scene_info"
,
sceneInfo
);
bodyNode
.
set
(
"scene_info"
,
sceneInfo
);
String
payAccess
=
properties
.
getPayAccess
();
String
payAccess
=
properties
.
getPayAccess
();
ChannelResponse
response
=
doExecute
(
EXECUTE_PAY
,
payAccess
,
request
,
bodyNode
);
ChannelResponse
response
=
doExecute
(
EXECUTE_PAY
,
payAccess
,
request
,
bodyNode
,
transaction
);
JsonNode
node
=
response
.
getNode
();
JsonNode
node
=
response
.
getNode
();
if
(
node
!=
null
)
{
if
(
node
!=
null
)
{
node
=
response
.
getNode
().
get
(
"h5_url"
);
node
=
response
.
getNode
().
get
(
"h5_url"
);
...
@@ -155,13 +154,13 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -155,13 +154,13 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"mchid"
,
properties
.
getPayAcctId
());
bodyNode
.
put
(
"mchid"
,
properties
.
getPayAcctId
());
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_trade_no}"
,
checkPayRequestData
.
getOutTradeNo
());
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_trade_no}"
,
checkPayRequestData
.
getOutTradeNo
());
return
doExecute
(
EXECUTE_CHECK_PAY
,
payAccess
,
null
,
bodyNode
);
return
doExecute
(
EXECUTE_CHECK_PAY
,
payAccess
,
null
,
bodyNode
,
null
);
}
}
@Override
@Override
public
ChannelResponse
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
throws
Exception
{
public
ChannelResponse
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
throws
Exception
{
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_refund_no}"
,
checkRefundRequestData
.
getOutRefundNo
());
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_refund_no}"
,
checkRefundRequestData
.
getOutRefundNo
());
return
doExecute
(
EXECUTE_CHECK_REFUND
,
payAccess
,
null
,
null
);
return
doExecute
(
EXECUTE_CHECK_REFUND
,
payAccess
,
null
,
null
,
null
);
}
}
@Override
@Override
...
@@ -169,7 +168,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -169,7 +168,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"mchid"
,
properties
.
getPayAcctId
());
bodyNode
.
put
(
"mchid"
,
properties
.
getPayAcctId
());
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_trade_no}"
,
closeRequestData
.
getOutTradeNo
());
String
payAccess
=
properties
.
getPayAccess
().
replace
(
"{out_trade_no}"
,
closeRequestData
.
getOutTradeNo
());
return
doExecute
(
EXECUTE_CLOSE
,
payAccess
,
null
,
bodyNode
);
return
doExecute
(
EXECUTE_CLOSE
,
payAccess
,
null
,
bodyNode
,
null
);
}
}
@Override
@Override
...
@@ -186,7 +185,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -186,7 +185,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
.
put
(
"total"
,
amount
)
.
put
(
"total"
,
amount
)
.
put
(
"currency"
,
"CNY"
);
.
put
(
"currency"
,
"CNY"
);
String
payAccess
=
properties
.
getPayAccess
();
String
payAccess
=
properties
.
getPayAccess
();
return
doExecute
(
EXECUTE_REFUND
,
payAccess
,
null
,
bodyNode
);
return
doExecute
(
EXECUTE_REFUND
,
payAccess
,
null
,
bodyNode
,
null
);
}
}
/**
/**
...
@@ -194,7 +193,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -194,7 +193,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
* @param bodyNode
* @param bodyNode
* @return
* @return
*/
*/
private
ChannelResponse
doExecute
(
String
execute
,
String
access
,
Object
request
,
ObjectNode
bodyNode
)
throws
Exception
{
private
ChannelResponse
doExecute
(
String
execute
,
String
access
,
Object
request
,
ObjectNode
bodyNode
,
TransactionSummaryEntity
history
)
throws
Exception
{
ChannelResponse
response
=
null
;
ChannelResponse
response
=
null
;
...
@@ -218,7 +217,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
...
@@ -218,7 +217,7 @@ public class WeiXinMerchantAcquirer extends MerchantAcquirer {
}
}
String
uri
=
uriComponentsBuilder
.
build
().
toString
();
String
uri
=
uriComponentsBuilder
.
build
().
toString
();
long
timestamp
=
System
.
currentTimeMillis
()
/
1000
;
long
timestamp
=
System
.
currentTimeMillis
()
/
1000
;
String
nonceStr
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
nonceStr
=
history
.
getCheckCode
(
);
// 代签名字符串
// 代签名字符串
String
signText
=
joining
(
"\n"
,
method
,
uri
,
String
.
valueOf
(
timestamp
),
nonceStr
,
requestBody
);
String
signText
=
joining
(
"\n"
,
method
,
uri
,
String
.
valueOf
(
timestamp
),
nonceStr
,
requestBody
);
String
sign
=
sign
(
signText
);
String
sign
=
sign
(
signText
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/EntityBuilder.java
View file @
01085b7a
...
@@ -40,10 +40,10 @@ public class EntityBuilder {
...
@@ -40,10 +40,10 @@ public class EntityBuilder {
account
.
setAutoStatus
(
StatusCode
.
NORM
);
account
.
setAutoStatus
(
StatusCode
.
NORM
);
account
.
setAutoStatusDate
(
now
);
account
.
setAutoStatusDate
(
now
);
account
.
setCorpotateAcctFlag
(
false
);
account
.
setCorpotateAcctFlag
(
false
);
account
.
setCreditTxnCount
(
0
);
//
account.setCreditTxnCount(0);
account
.
setCurrencyCode
(
CurrencyCode
.
CNY
);
account
.
setCurrencyCode
(
CurrencyCode
.
CNY
);
account
.
setCurrentCycleNo
(
1
);
account
.
setCurrentCycleNo
(
1
);
account
.
setDebitTxtCount
(
0
);
//
account.setDebitTxtCount(0);
account
.
setExternalAcctNo
(
buyerId
);
account
.
setExternalAcctNo
(
buyerId
);
account
.
setManualStatus
(
null
);
account
.
setManualStatus
(
null
);
account
.
setManualStatusDate
(
null
);
account
.
setManualStatusDate
(
null
);
...
@@ -51,8 +51,8 @@ public class EntityBuilder {
...
@@ -51,8 +51,8 @@ public class EntityBuilder {
account
.
setOpenDate
(
now
);
account
.
setOpenDate
(
now
);
account
.
setProductId
(
productId
);
account
.
setProductId
(
productId
);
account
.
setProtocolRule
(
null
);
account
.
setProtocolRule
(
null
);
account
.
setTotalCredit
(
BigDecimal
.
ZERO
);
//
account.setTotalCredit(BigDecimal.ZERO);
account
.
setTotalDebit
(
BigDecimal
.
ZERO
);
//
account.setTotalDebit(BigDecimal.ZERO);
account
.
setTxnNo
(
0
);
account
.
setTxnNo
(
0
);
Date
date
=
DateUtils
.
now
();
Date
date
=
DateUtils
.
now
();
...
@@ -78,6 +78,7 @@ public class EntityBuilder {
...
@@ -78,6 +78,7 @@ public class EntityBuilder {
entity
.
setAccountId
(
account
.
getAccountId
());
entity
.
setAccountId
(
account
.
getAccountId
());
entity
.
setAddress
(
data
.
getAddress
());
entity
.
setAddress
(
data
.
getAddress
());
entity
.
setAttachText
(
data
.
getAttach
());
entity
.
setAttachText
(
data
.
getAttach
());
entity
.
setAccountNo
(
data
.
getAccountNo
());
entity
.
setCreditDebitFlag
(
CreditDebitFlag
.
C
);
entity
.
setCreditDebitFlag
(
CreditDebitFlag
.
C
);
entity
.
setCurrencyCode
(
CurrencyCode
.
CNY
);
entity
.
setCurrencyCode
(
CurrencyCode
.
CNY
);
entity
.
setCustomerGenFlag
(
true
);
entity
.
setCustomerGenFlag
(
true
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/AccountEntity.java
View file @
01085b7a
...
@@ -79,17 +79,17 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
...
@@ -79,17 +79,17 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
@Column
(
name
=
"NEXT_TXN_NO"
,
nullable
=
false
)
@Column
(
name
=
"NEXT_TXN_NO"
,
nullable
=
false
)
private
Integer
nextTxnNo
;
private
Integer
nextTxnNo
;
@Column
(
name
=
"TOTAL_CREDIT"
,
nullable
=
false
,
precision
=
2
)
//
@Column(name = "TOTAL_CREDIT", nullable = false, precision = 2)
private
BigDecimal
totalCredit
;
//
private BigDecimal totalCredit;
//
@Column
(
name
=
"TOTAL_DEBIT"
,
nullable
=
false
,
precision
=
2
)
//
@Column(name = "TOTAL_DEBIT", nullable = false, precision = 2)
private
BigDecimal
totalDebit
;
//
private BigDecimal totalDebit;
//
@Column
(
name
=
"CREDIT_TXN_COUNT"
,
nullable
=
false
)
//
@Column(name = "CREDIT_TXN_COUNT", nullable = false)
private
Integer
creditTxnCount
;
//
private Integer creditTxnCount;
//
@Column
(
name
=
"DEBIT_TXT_COUNT"
,
nullable
=
false
)
//
@Column(name = "DEBIT_TXT_COUNT", nullable = false)
private
Integer
debitTxtCount
;
//
private Integer debitTxtCount;
public
AccountIds
getIds
()
{
public
AccountIds
getIds
()
{
return
ids
;
return
ids
;
...
@@ -235,37 +235,37 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
...
@@ -235,37 +235,37 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
this
.
nextTxnNo
=
nextTxnNo
;
this
.
nextTxnNo
=
nextTxnNo
;
}
}
public
BigDecimal
getTotalCredit
()
{
//
public BigDecimal getTotalCredit() {
return
totalCredit
;
//
return totalCredit;
}
//
}
//
public
void
setTotalCredit
(
BigDecimal
totalCredit
)
{
//
public void setTotalCredit(BigDecimal totalCredit) {
this
.
totalCredit
=
totalCredit
;
//
this.totalCredit = totalCredit;
}
//
}
//
public
BigDecimal
getTotalDebit
()
{
//
public BigDecimal getTotalDebit() {
return
totalDebit
;
//
return totalDebit;
}
//
}
//
public
void
setTotalDebit
(
BigDecimal
totalDebit
)
{
//
public void setTotalDebit(BigDecimal totalDebit) {
this
.
totalDebit
=
totalDebit
;
//
this.totalDebit = totalDebit;
}
//
}
//
public
Integer
getCreditTxnCount
()
{
//
public Integer getCreditTxnCount() {
return
creditTxnCount
;
//
return creditTxnCount;
}
//
}
//
public
void
setCreditTxnCount
(
Integer
creditTxnCount
)
{
//
public void setCreditTxnCount(Integer creditTxnCount) {
this
.
creditTxnCount
=
creditTxnCount
;
//
this.creditTxnCount = creditTxnCount;
}
//
}
//
public
Integer
getDebitTxtCount
()
{
//
public Integer getDebitTxtCount() {
return
debitTxtCount
;
//
return debitTxtCount;
}
//
}
//
public
void
setDebitTxtCount
(
Integer
debitTxtCount
)
{
//
public void setDebitTxtCount(Integer debitTxtCount) {
this
.
debitTxtCount
=
debitTxtCount
;
//
this.debitTxtCount = debitTxtCount;
}
//
}
@Override
@Override
public
String
getPersistentKey
()
{
public
String
getPersistentKey
()
{
...
@@ -301,10 +301,10 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
...
@@ -301,10 +301,10 @@ public class AccountEntity extends DescribablePartitionEntity implements Seriali
sb
.
append
(
", autoPaymentWarnDate="
).
append
(
autoPaymentWarnDate
);
sb
.
append
(
", autoPaymentWarnDate="
).
append
(
autoPaymentWarnDate
);
sb
.
append
(
", txnNo="
).
append
(
txnNo
);
sb
.
append
(
", txnNo="
).
append
(
txnNo
);
sb
.
append
(
", nextTxnNo="
).
append
(
nextTxnNo
);
sb
.
append
(
", nextTxnNo="
).
append
(
nextTxnNo
);
sb
.
append
(
", totalCredit="
).
append
(
totalCredit
);
//
sb.append(", totalCredit=").append(totalCredit);
sb
.
append
(
", totalDebit="
).
append
(
totalDebit
);
//
sb.append(", totalDebit=").append(totalDebit);
sb
.
append
(
", creditTxnCount="
).
append
(
creditTxnCount
);
//
sb.append(", creditTxnCount=").append(creditTxnCount);
sb
.
append
(
", debitTxtCount="
).
append
(
debitTxtCount
);
//
sb.append(", debitTxtCount=").append(debitTxtCount);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
return
sb
.
toString
();
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/TransactionSummaryEntity.java
View file @
01085b7a
...
@@ -61,6 +61,9 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
...
@@ -61,6 +61,9 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
@Column
(
name
=
"STATUS_CODE"
,
nullable
=
false
,
length
=
4
)
@Column
(
name
=
"STATUS_CODE"
,
nullable
=
false
,
length
=
4
)
private
StatusCode
statusCode
;
private
StatusCode
statusCode
;
@Column
(
name
=
"ACCOUNT_NO"
,
nullable
=
false
,
updatable
=
false
,
length
=
128
)
private
String
accountNo
;
@Enumerated
(
EnumType
.
STRING
)
@Enumerated
(
EnumType
.
STRING
)
@Column
(
name
=
"CURRENCY_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
3
)
@Column
(
name
=
"CURRENCY_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
3
)
private
CurrencyCode
currencyCode
;
private
CurrencyCode
currencyCode
;
...
@@ -220,6 +223,14 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
...
@@ -220,6 +223,14 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
this
.
statusCode
=
statusCode
;
this
.
statusCode
=
statusCode
;
}
}
public
String
getAccountNo
()
{
return
accountNo
;
}
public
void
setAccountNo
(
String
accountNo
)
{
this
.
accountNo
=
accountNo
;
}
public
CurrencyCode
getCurrencyCode
()
{
public
CurrencyCode
getCurrencyCode
()
{
return
currencyCode
;
return
currencyCode
;
}
}
...
@@ -449,6 +460,7 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
...
@@ -449,6 +460,7 @@ public class TransactionSummaryEntity extends DescribablePartitionEntity impleme
sb
.
append
(
", channelId="
).
append
(
channelId
);
sb
.
append
(
", channelId="
).
append
(
channelId
);
sb
.
append
(
", subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
", subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
", statusCode="
).
append
(
statusCode
);
sb
.
append
(
", statusCode="
).
append
(
statusCode
);
sb
.
append
(
", accountNo='"
).
append
(
accountNo
).
append
(
'\''
);
sb
.
append
(
", currencyCode="
).
append
(
currencyCode
);
sb
.
append
(
", currencyCode="
).
append
(
currencyCode
);
sb
.
append
(
", payMethod="
).
append
(
payMethod
);
sb
.
append
(
", payMethod="
).
append
(
payMethod
);
sb
.
append
(
", txnType='"
).
append
(
txnType
).
append
(
'\''
);
sb
.
append
(
", txnType='"
).
append
(
txnType
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/web/PayRequestData.java
View file @
01085b7a
...
@@ -21,14 +21,16 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -21,14 +21,16 @@ public class PayRequestData implements ChannelRequest, Serializable{
@Size
(
max
=
128
,
message
=
"ILLEGAL_REQ_SUBJECT"
)
@Size
(
max
=
128
,
message
=
"ILLEGAL_REQ_SUBJECT"
)
private
String
subject
;
private
String
subject
;
/**
//
/**
* 商户ID
//
* 商户ID
*/
//
*/
@NotNull
(
message
=
"ILLEGAL_REQ_MCH_ID"
)
//
@NotNull(message = "ILLEGAL_REQ_MCH_ID")
private
String
mchId
;
//
private String mchId;
private
String
chanId
;
private
String
chanId
;
private
String
requestIp
;
/**
/**
* 商户订单号
* 商户订单号
*/
*/
...
@@ -74,6 +76,10 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -74,6 +76,10 @@ public class PayRequestData implements ChannelRequest, Serializable{
@NotNull
(
message
=
"ILLEGAL_REQ_BUYER_ID"
)
@NotNull
(
message
=
"ILLEGAL_REQ_BUYER_ID"
)
private
String
buyerId
;
private
String
buyerId
;
@Size
(
min
=
6
,
max
=
128
,
message
=
"ILLEGAL_REQ_ACCT_NO"
)
@NotNull
(
message
=
"ILLEGAL_REQ_ACCT_NO"
)
private
String
accountNo
;
/**
/**
* 通知地址
* 通知地址
*/
*/
...
@@ -117,13 +123,13 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -117,13 +123,13 @@ public class PayRequestData implements ChannelRequest, Serializable{
this
.
subject
=
subject
;
this
.
subject
=
subject
;
}
}
public
String
getMchId
()
{
//
public String getMchId() {
return
mchId
;
//
return mchId;
}
//
}
//
public
void
setMchId
(
String
mchId
)
{
//
public void setMchId(String mchId) {
this
.
mchId
=
mchId
;
//
this.mchId = mchId;
}
//
}
public
String
getChanId
()
{
public
String
getChanId
()
{
return
chanId
;
return
chanId
;
...
@@ -133,6 +139,14 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -133,6 +139,14 @@ public class PayRequestData implements ChannelRequest, Serializable{
this
.
chanId
=
chanId
;
this
.
chanId
=
chanId
;
}
}
public
String
getRequestIp
()
{
return
requestIp
;
}
public
void
setRequestIp
(
String
requestIp
)
{
this
.
requestIp
=
requestIp
;
}
public
String
getOutTradeNo
()
{
public
String
getOutTradeNo
()
{
return
outTradeNo
;
return
outTradeNo
;
}
}
...
@@ -197,6 +211,14 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -197,6 +211,14 @@ public class PayRequestData implements ChannelRequest, Serializable{
this
.
buyerId
=
buyerId
;
this
.
buyerId
=
buyerId
;
}
}
public
String
getAccountNo
()
{
return
accountNo
;
}
public
void
setAccountNo
(
String
accountNo
)
{
this
.
accountNo
=
accountNo
;
}
public
String
getAttach
()
{
public
String
getAttach
()
{
return
attach
;
return
attach
;
}
}
...
@@ -249,8 +271,8 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -249,8 +271,8 @@ public class PayRequestData implements ChannelRequest, Serializable{
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"PayRequestData{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"PayRequestData{"
);
sb
.
append
(
"subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
"subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
", mchId='"
).
append
(
mchId
).
append
(
'\''
);
sb
.
append
(
", chanId='"
).
append
(
chanId
).
append
(
'\''
);
sb
.
append
(
", chanId='"
).
append
(
chanId
).
append
(
'\''
);
sb
.
append
(
", requestIp='"
).
append
(
requestIp
).
append
(
'\''
);
sb
.
append
(
", outTradeNo='"
).
append
(
outTradeNo
).
append
(
'\''
);
sb
.
append
(
", outTradeNo='"
).
append
(
outTradeNo
).
append
(
'\''
);
sb
.
append
(
", originalAmount='"
).
append
(
originalAmount
).
append
(
'\''
);
sb
.
append
(
", originalAmount='"
).
append
(
originalAmount
).
append
(
'\''
);
sb
.
append
(
", amount='"
).
append
(
amount
).
append
(
'\''
);
sb
.
append
(
", amount='"
).
append
(
amount
).
append
(
'\''
);
...
@@ -258,6 +280,7 @@ public class PayRequestData implements ChannelRequest, Serializable{
...
@@ -258,6 +280,7 @@ public class PayRequestData implements ChannelRequest, Serializable{
sb
.
append
(
", cashAmount='"
).
append
(
cashAmount
).
append
(
'\''
);
sb
.
append
(
", cashAmount='"
).
append
(
cashAmount
).
append
(
'\''
);
sb
.
append
(
", creditAmount='"
).
append
(
creditAmount
).
append
(
'\''
);
sb
.
append
(
", creditAmount='"
).
append
(
creditAmount
).
append
(
'\''
);
sb
.
append
(
", buyerId='"
).
append
(
buyerId
).
append
(
'\''
);
sb
.
append
(
", buyerId='"
).
append
(
buyerId
).
append
(
'\''
);
sb
.
append
(
", accountNo='"
).
append
(
accountNo
).
append
(
'\''
);
sb
.
append
(
", notifyUrl='"
).
append
(
notifyUrl
).
append
(
'\''
);
sb
.
append
(
", notifyUrl='"
).
append
(
notifyUrl
).
append
(
'\''
);
sb
.
append
(
", attach='"
).
append
(
attach
).
append
(
'\''
);
sb
.
append
(
", attach='"
).
append
(
attach
).
append
(
'\''
);
sb
.
append
(
", shopName='"
).
append
(
shopName
).
append
(
'\''
);
sb
.
append
(
", shopName='"
).
append
(
shopName
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/rest/BusinessController.java
View file @
01085b7a
...
@@ -7,6 +7,8 @@ import cn.quant.baa.pay.acquirer.ChannelResponse;
...
@@ -7,6 +7,8 @@ import cn.quant.baa.pay.acquirer.ChannelResponse;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.model.web.PayResponseData
;
import
cn.quant.baa.pay.model.web.PayResponseData
;
import
cn.quant.baa.pay.util.AssertUtils
;
import
cn.quant.baa.pay.util.AssertUtils
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.ProfileException
;
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
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
...
@@ -54,7 +56,7 @@ public abstract class BusinessController extends AbstractController {
...
@@ -54,7 +56,7 @@ public abstract class BusinessController extends AbstractController {
AcquirerProperties
properties
=
acquirerPropertiesSource
.
get
(
Long
.
valueOf
(
chanId
));
AcquirerProperties
properties
=
acquirerPropertiesSource
.
get
(
Long
.
valueOf
(
chanId
));
if
(
properties
==
null
)
{
if
(
properties
==
null
)
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOSUCH
,
chanId
);
throw
new
NullException
(
"Acquirer not found : {}; {};"
,
chanId
,
data
);
}
}
return
properties
;
return
properties
;
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/PayTestController.java
View file @
01085b7a
...
@@ -79,7 +79,7 @@ public class PayTestController extends BusinessController {
...
@@ -79,7 +79,7 @@ public class PayTestController extends BusinessController {
PayRequestData
payRequestData
=
objectMapper
.
readValue
(
str
,
PayRequestData
.
class
);
PayRequestData
payRequestData
=
objectMapper
.
readValue
(
str
,
PayRequestData
.
class
);
String
[]
temp
=
data
.
getChanId
().
split
(
"_"
);
String
[]
temp
=
data
.
getChanId
().
split
(
"_"
);
payRequestData
.
setChanId
(
temp
[
0
]);
payRequestData
.
setChanId
(
temp
[
0
]);
payRequestData
.
setMchId
(
temp
[
1
]);
//
payRequestData.setMchId(temp[1]);
payRequestData
.
setOutTradeNo
(
data
.
getOutTradeNo
());
payRequestData
.
setOutTradeNo
(
data
.
getOutTradeNo
());
payRequestData
.
setSubject
(
data
.
getSubject
());
payRequestData
.
setSubject
(
data
.
getSubject
());
payRequestData
.
setAmount
(
data
.
getAmount
());
payRequestData
.
setAmount
(
data
.
getAmount
());
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TechController.java
0 → 100644
View file @
01085b7a
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* Created by Administrator on 2021/9/28 0028.
*/
@RestController
@RequestMapping
(
"/tech"
)
public
class
TechController
{
@RequestMapping
(
"/health/check"
)
public
ResponseEntity
checkHealth
()
throws
Exception
{
return
ResponseEntity
.
ok
(
"ok"
);
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
01085b7a
...
@@ -14,6 +14,7 @@ import cn.quant.spring.util.StringUtils;
...
@@ -14,6 +14,7 @@ import cn.quant.spring.util.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
PAY_DUE_TIME
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
PAY_DUE_TIME
;
...
@@ -48,6 +49,8 @@ public class TransactionController extends BusinessController {
...
@@ -48,6 +49,8 @@ public class TransactionController extends BusinessController {
if
(
redisValue
!=
null
)
{
if
(
redisValue
!=
null
)
{
return
ResponseEntity
.
ok
(
deserialize
(
redisValue
));
return
ResponseEntity
.
ok
(
deserialize
(
redisValue
));
}
}
requestData
.
setRequestIp
(
ObjectUtils
.
getDisplayString
(
request
.
getRequestIp
()));
ChannelResponse
channelResponse
=
transactionService
.
pay
(
properties
,
requestData
);
ChannelResponse
channelResponse
=
transactionService
.
pay
(
properties
,
requestData
);
HttpResponseData
response
=
response
(
channelResponse
);
HttpResponseData
response
=
response
(
channelResponse
);
if
(
channelResponse
.
getSuccess
())
{
if
(
channelResponse
.
getSuccess
())
{
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
01085b7a
...
@@ -55,7 +55,6 @@ public class TransactionService extends BusinessService {
...
@@ -55,7 +55,6 @@ public class TransactionService extends BusinessService {
TransactionSession
session
=
TransactionSession
.
session
();
TransactionSession
session
=
TransactionSession
.
session
();
Long
chanId
=
properties
.
getMchChanId
();
String
institutionId
=
properties
.
getInstitutionId
();
String
institutionId
=
properties
.
getInstitutionId
();
String
productId
=
properties
.
getProductId
();
String
productId
=
properties
.
getProductId
();
String
buyerId
=
data
.
getBuyerId
();
String
buyerId
=
data
.
getBuyerId
();
...
@@ -66,11 +65,6 @@ public class TransactionService extends BusinessService {
...
@@ -66,11 +65,6 @@ public class TransactionService extends BusinessService {
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
String
mchId
=
data
.
getMchId
();
if
(!
mchId
.
equals
(
properties
.
getPayAppId
()))
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
,
chanId
,
mchId
);
}
AccountEntity
account
=
session
.
getAccount
();
AccountEntity
account
=
session
.
getAccount
();
long
historyId
=
session
.
nextId
();
long
historyId
=
session
.
nextId
();
Integer
partitionKey
=
account
.
getPartitionKey
();
Integer
partitionKey
=
account
.
getPartitionKey
();
...
@@ -84,22 +78,22 @@ public class TransactionService extends BusinessService {
...
@@ -84,22 +78,22 @@ public class TransactionService extends BusinessService {
details
.
add
(
detailEntity
);
details
.
add
(
detailEntity
);
}
}
TransactionSummaryEntity
history
=
EntityBuilder
.
payHistory
(
account
,
historyId
,
data
,
properties
,
session
);
TransactionSummaryEntity
transaction
=
EntityBuilder
.
payHistory
(
account
,
historyId
,
data
,
properties
,
session
);
ChannelResponse
responseData
=
acquirer
.
pay
(
data
,
history
);
ChannelResponse
responseData
=
acquirer
.
pay
(
data
,
transaction
);
if
(
responseData
.
getSuccess
())
{
if
(
responseData
.
getSuccess
())
{
EntityBuilder
.
nextTxnNo
(
account
,
history
);
EntityBuilder
.
nextTxnNo
(
account
,
transaction
);
history
.
setCheckCode
(
checkCode
);
transaction
.
setCheckCode
(
checkCode
);
history
.
setPayDueTime
(
LocalDateTime
.
now
().
plus
(
PAY_DUE_TIME
));
transaction
.
setPayDueTime
(
LocalDateTime
.
now
().
plus
(
PAY_DUE_TIME
));
history
.
setRequestId
(
responseData
.
getRequestId
());
transaction
.
setRequestId
(
responseData
.
getRequestId
());
history
.
setDescText
(
responseData
.
getNotification
());
transaction
.
setDescText
(
responseData
.
getNotification
());
BatchCycleTriggerEntity
trigger
=
EntityBuilder
.
payTrigger
(
session
.
nextId
(),
history
);
BatchCycleTriggerEntity
trigger
=
EntityBuilder
.
payTrigger
(
session
.
nextId
(),
transaction
);
trigger
.
setRequestId
(
session
.
getRequestId
());
trigger
.
setRequestId
(
session
.
getRequestId
());
trigger
.
setNotifyUrl
(
data
.
getNotifyUrl
());
trigger
.
setNotifyUrl
(
data
.
getNotifyUrl
());
session
.
pushEntity
(
history
,
trigger
);
session
.
pushEntity
(
transaction
,
trigger
);
session
.
pushEntity
(
details
);
session
.
pushEntity
(
details
);
session
.
commit
();
session
.
commit
();
}
}
...
...
baa-pay-server/src/main/resources/logback-dev.xml
View file @
01085b7a
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</encoder>
</encoder>
</appender>
</appender>
<logger
name=
"cn.quant.baa.pay"
level=
"
DEBUG
"
/>
<logger
name=
"cn.quant.baa.pay"
level=
"
INFO
"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
level=
"ERROR"
/>
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
<root
level=
"
DEBUG
"
>
<root
level=
"
INFO
"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"ROLLINGFILE"
/>
<appender-ref
ref=
"ROLLINGFILE"
/>
</root>
</root>
...
...
baa-pay-server/src/main/resources/logback-pro.xml
View file @
01085b7a
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</encoder>
</encoder>
</appender>
</appender>
<logger
name=
"cn.quant.baa.pay"
level=
"
DEBUG
"
/>
<logger
name=
"cn.quant.baa.pay"
level=
"
INFO
"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
level=
"ERROR"
/>
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
<root
level=
"
DEBUG
"
>
<root
level=
"
INFO
"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"ROLLINGFILE"
/>
<appender-ref
ref=
"ROLLINGFILE"
/>
</root>
</root>
...
...
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