4.5 KiB
4.5 KiB
Original Vue Recharge Center Logic
Routes
/recharge- Clears the persisted
targetUserstore on mount. - Lets the user input a target account / user ID.
- Searches the target user before entering the payment page.
- Opens a help modal with recharge instructions.
- Clears the persisted
/recharge-pay-way- Reads the target user from the persisted
targetUserstore. - Loads payment application, target region/country, commodity packages, and payment channels.
- Places a recharge order and redirects to a third-party payment page.
- Reads the target user from the persisted
State
targetUser- Persisted Pinia store.
setTargetUser(profile)after/rechargesearch succeeds.clearTargetUser()on/rechargemount and after Airwallex order redirect starts.
selectedCountry- Country store value used by
/recharge-pay-way. - First returned country is selected when the store is empty.
- Country store value used by
countryList- Country store list populated from
/order/web/pay/user-profile.
- Country store list populated from
applicationId- Fixed value in original Vue:
1963531459019739137.
- Fixed value in original Vue:
typeFREIGHT_GOLD_SUPERwhentargetUser.isSuperFreightAgent.FREIGHT_GOLDwhentargetUser.isFreightAgent.GOLDotherwise.
APIs
Search target user
GET /user/user-profile/open-search?account=<account>
Usage:
- Called from
/rechargesearch button. - Success condition in Vue:
status && body.id. - Success action: save
bodytotargetUser, then route to/recharge-pay-way. - Failure action: toast
User info not found.
Reusable fields:
idaccountuserNicknamenameuserAvatarownSpecialId.accountisFreightAgentisSuperFreightAgent
Get payment application
GET /order/web/pay/application/{applicationId}
Usage:
- Called by
/recharge-pay-way. - Original code reads
body.appCode.
Reusable fields:
idappNameappCodeandroidLinkiosLink
Get target recharge profile and countries
GET /order/web/pay/user-profile
Query params:
sysOrigin=<appCode>account=<targetUser.account>type=GOLD | FREIGHT_GOLD | FREIGHT_GOLD_SUPER
Usage:
- Called after payment application is loaded.
- Backend resolves user region and available pay countries.
- Original Vue sets
countryList, selects the first country if none is selected, and storesregionId.
Reusable fields:
userProfile.iduserProfile.userAvataruserProfile.userNicknameuserProfile.accountuserProfile.sysOrigincountryList[].idcountryList[].countryIdcountryList[].country.countryNamecountryList[].country.aliasNamecountryList[].country.nationalFlagregionId
Get commodities and channels
GET /order/web/pay/commodity
Query params:
applicationId=1963531459019739137payCountryId=<selected country id>regionId=<regionId>type=GOLD | FREIGHT_GOLD | FREIGHT_GOLD_SUPER
Usage:
- Called after country/profile data is ready.
- Original Vue renders all returned channels, and each channel shows the same commodity grid.
Reusable fields:
applicationcommodity[].idcommodity[].contentcommodity[].awardContentcommodity[].amountUsdcommodity[].amountcommodity[].currencychannels[].channel.channelCodechannels[].channel.channelNamechannels[].channel.channelIconchannels[].details.channelCodechannels[].details.factoryChannelchannels[].details.factoryMinLimitchannels[].details.factoryMaxLimit
Place recharge order
POST /order/web/pay/recharge
Body:
{
"applicationId": "1963531459019739137",
"payCountryId": "<selected country id>",
"goodsId": "<commodity id>",
"userId": "<target user id>",
"channelCode": "<channel.channelCode>"
}
Usage:
- Called when the user taps a commodity under a payment channel.
- If
body.factoryCode === "AIRWALLEX", original Vue loads Airwallex Elements and callsredirectToCheckout. - If
body.requestUrlexists, original Vue redirects withlocation.href = decodeURIComponent(requestUrl).
Reusable fields:
orderIdtradeNofactoryCodefactoryChannelCodecurrencyrequestUrlexpand.idexpand.client_secret
New H5 implementation notes
- New page lives at
h5/hyapp/recharge-center. - It keeps the existing hyapp center architecture: static
index.html,style.css,script.js. - It uses URL
tokenfor Java API authorization and sends the same H5 request headers used by the existing hyapp center pages. - It merges the original
/rechargeand/recharge-pay-wayflows into one page, so it does not depend on Vue router or PiniatargetUser.