Skip to content

Commit

Permalink
Merge pull request #4 from alipay/feature-update
Browse files Browse the repository at this point in the history
 update-example
  • Loading branch information
ScottWryyyyy authored Oct 18, 2024
2 parents a458796 + 549da4b commit bfd375c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 45 deletions.
50 changes: 35 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
# 忽略操作系统生成的文件
.DS_Store
Thumbs.db

# 忽略 Go 编译生成的二进制文件
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
# 忽略构建输出目录
/bin/
/build/
/dist/

# 忽略缓存和依赖文件
vendor/
/go.sum
/go.work

# 忽略 go build 生成的文件
/tmp/
*.o
*.a

# 忽略测试生成的文件
/coverage.out

# 忽略 go tool 编译缓存目录
/go-build/

# Go workspace file
go.work
go.work.sum
# 忽略临时文件
*.swp
*.tmp
*.log

# env file
.env
# 忽略编辑器或 IDE 生成的文件
*.sublime-workspace
*.sublime-project
*.iml
.idea/
/.vscode/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.2.2 - 2024-10-18
* [#4](https://github.com/alipay/global-open-sdk-go/pull/4) update-example


## 1.2.1 - 2024-09-30
* [#3](https://github.com/alipay/global-open-sdk-go/pull/3) update-p1
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
```
Language:GO
GO version:1.22.5+
Tags:v1.2.1
Tags:v1.2.2
Copyright:Ant financial services group
```

Expand Down Expand Up @@ -33,8 +33,8 @@ https://mvnrepository.com/artifact/com.alipay.global.sdk/global-open-sdk-go
request.PaymentAmount = model.NewAmount("100", "HKD")
request.PaymentNotifyUrl = "https://www.alipay.com"
request.PaymentRedirectUrl = "https://www.alipay.com"
request.PaymentNotifyUrl = "https://www.yourNotifyUrl.com"
request.PaymentRedirectUrl = "https://www.yourRedirectUrl.com"
request.PaymentMethod = &model.PaymentMethod{PaymentMethodType: model.ALIPAY_HK, PaymentMethodId: "1234567890"}
Expand Down
2 changes: 1 addition & 1 deletion com/alipay/example/auth_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {

func authConsult(client *defaultAlipayClient.DefaultAlipayClient) {
request, authConsultRequest := auth.NewAlipayAuthConsultRequest()
authConsultRequest.AuthRedirectUrl = "https://www.alipay.com"
authConsultRequest.AuthRedirectUrl = "https://www.yourRedirectUrl.com"
authConsultRequest.AuthState = uuid.NewString()
authConsultRequest.CustomerBelongsTo = model.ALIPAY_CN
authConsultRequest.OsType = model.ANDROID
Expand Down
2 changes: 1 addition & 1 deletion com/alipay/example/customs_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func declare(paymentId string, client *defaultAlipayClient.DefaultAlipayClient)
request, customsDeclareRequest := customs.NewAlipayCustomsDeclareRequest()
customsDeclareRequest.PaymentId = paymentId
customsDeclareRequest.DeclarationRequestId = uuid.NewString()
customsDeclareRequest.DeclarationAmount = &model.Amount{Value: "CNY", Currency: "1000"}
customsDeclareRequest.DeclarationAmount = &model.Amount{Value: "10000", Currency: "CNY"}
customsDeclareRequest.MerchantCustomsInfo = &model.MerchantCustomsInfo{
MerchantCustomsName: "merchantCustomsName",
MerchantCustomsCode: "merchantCustomsCode",
Expand Down
8 changes: 1 addition & 7 deletions com/alipay/example/marketplace_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,19 +229,13 @@ func createPayout(client *defaultAlipayClient.DefaultAlipayClient) {
func createTransfer(client *defaultAlipayClient.DefaultAlipayClient) {
request, createTransferRequest := marketplace.NewAlipayCreateTransferRequest()
createTransferRequest.TransferRequestId = uuid.NewString()
createTransferRequest.TransferFromDetail = &model.TransferFromDetail{
TransferFromMethod: &model.PaymentMethod{
PaymentMethodId: uuid.NewString(),
PaymentMethodType: model.BALANCE_ACCOUNT,
},
}

createTransferRequest.TransferFromDetail = &model.TransferFromDetail{
TransferFromMethod: &model.PaymentMethod{
PaymentMethodId: uuid.NewString(),
PaymentMethodType: model.BALANCE_ACCOUNT,
},
TransferFromAmount: model.NewAmount("BRL", "100"),
TransferFromAmount: model.NewAmount("100", "BRL"),
}

createTransferRequest.TransferToDetail = &model.TransferToDetail{
Expand Down
8 changes: 4 additions & 4 deletions com/alipay/example/pay_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ func doPay(body *defaultAlipayClient.DefaultAlipayClient) {

request.PaymentAmount = model.NewAmount("100", "HKD")

request.PaymentNotifyUrl = "https://www.alipay.com"
request.PaymentRedirectUrl = "https://www.alipay.com"
request.PaymentNotifyUrl = "https://www.yourNotifyUrl.com"
request.PaymentRedirectUrl = "https://www.yourRedirectUrl.com"

request.PaymentMethod = &model.PaymentMethod{PaymentMethodType: model.ALIPAY_HK}

Expand Down Expand Up @@ -172,8 +172,8 @@ func createSession(client *defaultAlipayClient.DefaultAlipayClient) {
createSessionRequest.PaymentMethod = &model.PaymentMethod{
PaymentMethodType: model.SHOPEEPAY_SG,
}
createSessionRequest.PaymentNotifyUrl = "https://www.alipay.com"
createSessionRequest.PaymentRedirectUrl = "https://www.alipay.com"
createSessionRequest.PaymentNotifyUrl = "https://www.yourNotifyUrl.com"
createSessionRequest.PaymentRedirectUrl = "https://www.yourRedirectUrl.com"
createSessionRequest.Env = &model.Env{
OsType: model.IOS,
TerminalType: model.APP,
Expand Down
16 changes: 6 additions & 10 deletions com/alipay/example/subscription_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func main() {
alipayAlipayPublicKey)

//SubscriptionsCreate(client)
//SubscriptionsChange(client, "202409141900000000000001J0000009488")
subscriptionCancel(client, "202409141900000000000001J0000009488")
SubscriptionsChange(client, "202409141900000000000001J0000009488")
//subscriptionCancel(client, "202409141900000000000001J0000009488")

}

Expand All @@ -40,7 +40,7 @@ func SubscriptionsCreate(client *defaultAlipayClient.DefaultAlipayClient) {
Currency: "HKD",
Value: "10",
}
alipaySubscriptionCreateRequest.PaymentNotificationUrl = "http://www.alipay.com"
alipaySubscriptionCreateRequest.PaymentNotificationUrl = "https://www.yourNotifyUrl.com"
alipaySubscriptionCreateRequest.PeriodRule = &model.PeriodRule{
PeriodType: model.PeriodType_MONTH,
PeriodCount: 1,
Expand All @@ -53,7 +53,7 @@ func SubscriptionsCreate(client *defaultAlipayClient.DefaultAlipayClient) {
alipaySubscriptionCreateRequest.SubscriptionEndTime = "2024-09-14T12:01:01+08:00"
// The duration of subscription preparation process should be less than 48 hours
alipaySubscriptionCreateRequest.SubscriptionExpiryTime = "2024-09-15T12:01:01+08:00"
alipaySubscriptionCreateRequest.PaymentNotificationUrl = "http://www.alipay.com"
alipaySubscriptionCreateRequest.PaymentNotificationUrl = "https://www.yourNotifyUrl.com"

alipaySubscriptionCreateRequest.OrderInfo = &model.OrderInfo{
OrderAmount: &model.Amount{
Expand All @@ -66,12 +66,8 @@ func SubscriptionsCreate(client *defaultAlipayClient.DefaultAlipayClient) {
PaymentMethodType: model.ALIPAY_HK,
}

alipaySubscriptionCreateRequest.SettlementStrategy = &model.SettlementStrategy{
SettlementCurrency: "USD",
}

alipaySubscriptionCreateRequest.SubscriptionRedirectUrl = "http://www.alipay.com"
alipaySubscriptionCreateRequest.SubscriptionNotificationUrl = "http://www.alipay.com"
alipaySubscriptionCreateRequest.SubscriptionRedirectUrl = "https://www.alipay.com"
alipaySubscriptionCreateRequest.SubscriptionNotificationUrl = "https://www.alipay.com"

execute, err := client.Execute(request)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions com/alipay/example/vaulting_demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func createVaultingSession(client *defaultAlipayClient.DefaultAlipayClient) {
request, vaultingRequest := vaulting.NewAlipayVaultingSessionRequest()
vaultingRequest.VaultingRequestId = uuid.NewString()
vaultingRequest.PaymentMethodType = "CARD"
vaultingRequest.VaultingNotificationUrl = "www.global.alipay.com"
vaultingRequest.RedirectUrl = "www.global.alipay.com"
vaultingRequest.VaultingNotificationUrl = "https://www.yourNotifyUrl.com"
vaultingRequest.RedirectUrl = "https://www.yourRedirectUrl.com"
vaultingRequest.MerchantRegion = "BR"

response, err := client.Execute(request)
Expand All @@ -47,8 +47,8 @@ func createVaultingSession(client *defaultAlipayClient.DefaultAlipayClient) {
func vaultPaymentMethod(client *defaultAlipayClient.DefaultAlipayClient) {
request, vaultPaymentMethodRequest := vaulting.NewAlipayVaultingPaymentMethodRequest()
vaultPaymentMethodRequest.VaultingRequestId = uuid.NewString()
vaultPaymentMethodRequest.VaultingNotificationUrl = "www.global.alipay.com"
vaultPaymentMethodRequest.RedirectUrl = "www.global.alipay.com"
vaultPaymentMethodRequest.VaultingNotificationUrl = "https://www.yourNotifyUrl.com"
vaultPaymentMethodRequest.RedirectUrl = "https://www.yourRedirectUrl.com"
vaultPaymentMethodRequest.MerchantRegion = "BR"

vaultPaymentMethodRequest.PaymentMethodDetail = &model.PaymentMethodDetail{
Expand Down

0 comments on commit bfd375c

Please sign in to comment.