Skip to content

Commit e5c9d26

Browse files
committed
update 0924
1 parent c747548 commit e5c9d26

File tree

9 files changed

+68
-18
lines changed

9 files changed

+68
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.2.15 - 2025-09-24
4+
- 新增isv模式 agent-token
5+
- 补充已知缺少参数
6+
37
## 1.2.14 - 2025-07-09
48
- update 0709
59

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
```
22
Language:GO
33
GO version:1.22.5+
4-
Tags:v1.2.14
4+
Tags:v1.2.15
55
Copyright:Ant financial services group
66
```
77

com/alipay/api/defaultAlipayClient.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type DefaultAlipayClient struct {
2424
ClientId string
2525
MerchantPrivateKey string
2626
AlipayPublicKey string
27+
AgentToken string
2728
IsSandboxMode bool
2829
}
2930

@@ -33,20 +34,22 @@ type DefaultAlipayClient struct {
3334
* @param clientId 应用ID
3435
* @param merchantPrivateKey 商户私钥
3536
* @param alipayPublicKey 支付宝公钥
37+
* @param agentTokenOpt 代理token
3638
*/
37-
func NewDefaultAlipayClient(gatewayUrl string, clientId string, merchantPrivateKey string, alipayPublicKey string) *DefaultAlipayClient {
38-
isSandboxMode := false
39-
if strings.HasPrefix(clientId, "SANDBOX_") {
40-
isSandboxMode = true
41-
}
39+
func NewDefaultAlipayClient(gatewayUrl, clientId, merchantPrivateKey, alipayPublicKey string, agentTokenOpt ...string) *DefaultAlipayClient {
40+
isSandboxMode := strings.HasPrefix(clientId, "SANDBOX_")
4241

43-
return &DefaultAlipayClient{
42+
c := &DefaultAlipayClient{
4443
GatewayUrl: gatewayUrl,
4544
ClientId: clientId,
4645
MerchantPrivateKey: merchantPrivateKey,
4746
AlipayPublicKey: alipayPublicKey,
4847
IsSandboxMode: isSandboxMode,
4948
}
49+
if len(agentTokenOpt) > 0 {
50+
c.AgentToken = agentTokenOpt[0]
51+
}
52+
return c
5053
}
5154

5255
// @Description 支持任意方式的http请求
@@ -127,7 +130,7 @@ func (alipayClient *DefaultAlipayClient) Execute(alipayRequest *request.AlipayRe
127130
if err != nil {
128131
return nil, err
129132
}
130-
header := buildBaseHeader(reqTime, alipayClient.ClientId, alipayRequest.KeyVersion, sign)
133+
header := buildBaseHeader(reqTime, alipayClient.ClientId, alipayRequest.KeyVersion, sign, alipayClient.AgentToken)
131134
alipayResponse, err := alipayClient.httpDo(alipayClient.GatewayUrl+path, httpMethod, map[string]string{}, header, reqPayload, alipayRequest.AlipayResponse)
132135
if err != nil {
133136
return nil, err
@@ -148,7 +151,7 @@ func checkRspSign(httpMethod string, path string, clientId string, responseTime
148151
}
149152
}
150153

151-
func buildBaseHeader(reqTime string, clientId string, keyVersion string, signatureValue string) map[string]string {
154+
func buildBaseHeader(reqTime string, clientId string, keyVersion string, signatureValue string, agentToken string) map[string]string {
152155
if keyVersion == "" {
153156
keyVersion = "1"
154157
}
@@ -159,6 +162,8 @@ func buildBaseHeader(reqTime string, clientId string, keyVersion string, signatu
159162
"Client-Id": clientId,
160163
"Key-Version": keyVersion,
161164
"Signature": signatureValue,
165+
"SDK-VERSION": "global-open-sdk-go",
166+
"agent-token": agentToken,
162167
}
163168

164169
}

com/alipay/api/model/AcquirerInfo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type AcquirerInfo struct {
55
ReferenceRequestId string `json:"referenceRequestId,omitempty"`
66
AcquirerTransactionId string `json:"acquirerTransactionId,omitempty"`
77
AcquirerMerchantId string `json:"acquirerMerchantId,omitempty"`
8+
AcquirerMerchantName string `json:"acquirerMerchantName,omitempty"`
89
AcquirerResultCode string `json:"acquirerResultCode,omitempty"`
910
AcquirerResultMessage string `json:"acquirerResultMessage,omitempty"`
1011
}

com/alipay/api/model/PaymentMethod.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,15 @@ type PaymentMethod struct {
77
CustomerId string `json:"customerId,omitempty"`
88
ExtendInfo string `json:"extendInfo,omitempty"`
99
RequireIssuerAuthentication bool `json:"requireIssuerAuthentication,omitempty"`
10+
Funding FundingType `json:"funding,omitempty"`
1011
}
12+
13+
type FundingType string
14+
15+
const (
16+
FundingType_CREDIT FundingType = "CREDIT"
17+
FundingType_DEBIT FundingType = "DEBIT"
18+
FundingType_PREPAID FundingType = "PREPAID"
19+
FundingType_CHARGE FundingType = "CHARGE"
20+
FundingType_DEFERRED_DEBIT FundingType = "DEFERRED_DEBIT"
21+
)

com/alipay/api/model/PaymentMethodDetail.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ type CardPaymentMethodDetail struct {
5151
PayerEmail string `json:"payerEmail,omitempty"`
5252
NetworkTransactionId string `json:"networkTransactionId,omitempty"`
5353
Is3DSAuthentication bool `json:"is3DSAuthentication,omitempty"`
54+
Request3DS string `json:"request3DS,omitempty"`
55+
ScaExemptionIndicator string `json:"scaExemptionIndicator,omitempty"`
56+
EnableAuthenticationUpgrade string `json:"enableAuthenticationUpgrade,omitempty"`
57+
MpiData *MpiData `json:"mpiData,omitempty"`
58+
}
59+
60+
type MpiData struct {
61+
ThreeDSVersion string `json:"threeDSVersion,omitempty"`
62+
Eci string `json:"eci,omitempty"`
63+
Cavv string `json:"cavv,omitempty"`
64+
DsTransactionId string `json:"dsTransactionId,omitempty"`
65+
CredentialType CredentialType `json:"credentialType,omitempty"`
5466
}
5567

5668
type ExternalPaymentMethodDetail struct {
@@ -76,3 +88,10 @@ type CouponPaymentMethodDetail struct {
7688
CouponExpireTime string `json:"couponExpireTime,omitempty"`
7789
PaymentMethodDetailMetadata string `json:"paymentMethodDetailMetadata,omitempty"`
7890
}
91+
92+
type CredentialType string
93+
94+
const (
95+
CredentialType_NETWORK_TOKEN CredentialType = "NETWORK_TOKEN"
96+
CredentialType_PAN CredentialType = "PAN"
97+
)

com/alipay/api/model/PaymentResultInfo.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ type PaymentResultInfo struct {
1717
LastFour string `json:"lastFour,omitempty"`
1818
ExpiryMonth string `json:"expiryMonth,omitempty"`
1919
ExpiryYear string `json:"expiryYear,omitempty"`
20+
AccountNo string `json:"accountNo,omitempty"`
21+
RefusalCodeRaw string `json:"refusalCodeRaw,omitempty"`
22+
RefusalReasonRaw string `json:"refusalReasonRaw,omitempty"`
23+
MerchantAdviceCode string `json:"merchantAdviceCode,omitempty"`
24+
AcquirerInfo AcquirerInfo `json:"acquirerInfo,omitempty"`
2025
}
2126

2227
type ThreeDSResult struct {
23-
ThreeDSVersion string `json:"threeDSVersion,omitempty"`
24-
Eci string `json:"eci,omitempty"`
25-
Cavv string `json:"cavv,omitempty"`
26-
DsTransactionId string `json:"dsTransactionId,omitempty"`
27-
Xid string `json:"xid,omitempty"`
28+
ThreeDSVersion string `json:"threeDSVersion,omitempty"`
29+
Eci string `json:"eci,omitempty"`
30+
Cavv string `json:"cavv,omitempty"`
31+
DsTransactionId string `json:"dsTransactionId,omitempty"`
32+
Xid string `json:"xid,omitempty"`
33+
ThreeDStransactionStatusReason string `json:"threeDStransactionStatusReason,omitempty"`
34+
ChallengeCancel string `json:"challengeCancel,omitempty"`
2835
}

com/alipay/api/request/pay/AlipayCaptureRequest.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
)
88

99
type AlipayCaptureRequest struct {
10-
CaptureRequestId string `json:"captureRequestId,omitempty"`
11-
PaymentId string `json:"paymentId,omitempty"`
12-
CaptureAmount *model.Amount `json:"captureAmount,omitempty"`
13-
IsLastCapture bool `json:"isLastCapture,omitempty"`
10+
CaptureRequestId string `json:"captureRequestId,omitempty"`
11+
PaymentId string `json:"paymentId,omitempty"`
12+
CaptureAmount *model.Amount `json:"captureAmount,omitempty"`
13+
IsLastCapture bool `json:"isLastCapture,omitempty"`
14+
CaptureType string `json:"captureType,omitempty"`
15+
Transit *model.Transit `json:"transit,omitempty"`
1416
}
1517

1618
func (alipayCaptureRequest *AlipayCaptureRequest) NewRequest() *request.AlipayRequest {

com/alipay/api/request/pay/AlipayPaymentSessionRequest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type AlipayPaymentSessionRequest struct {
2929
AvailablePaymentMethod *model.AvailablePaymentMethod `json:"availablePaymentMethod,omitempty"`
3030
AllowedPaymentMethodRegions []string `json:"allowedPaymentMethodRegions,omitempty"`
3131
SubscriptionInfo *model.SubscriptionInfo `json:"subscriptionInfo,omitempty"`
32+
UserRegion string `json:"userRegion,omitempty"`
3233
}
3334

3435
func (alipayPaymentSessionRequest *AlipayPaymentSessionRequest) NewRequest() *request.AlipayRequest {

0 commit comments

Comments
 (0)