Trigger Reference of GS2-Money Script
Reference of event triggers that call extended scripts
createWallet
Event trigger to call GS2-Script before creating a new wallet.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| wallet | Wallet | Wallet |
Result
| Type | Require | Default | Limitation | Description |
|---|
| permit | bool | ✓ | | | Allow wallet creation |
| initialAmount | int | ✓ | | 0 ~ 2147483645 | Initial Wallet balance - will be credited as a free grant |
Implementation Example
namespace = args.namespace
wallet = args.wallet
result = {
permit=permit,
initialAmount=initialAmount
}
createWalletDone
GS2-Script called after creating a new wallet.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| wallet | Wallet | Wallet |
Result
| Type | Require | Default | Limitation | Description |
|---|
Implementation Example
namespace = args.namespace
wallet = args.wallet
result = {
}
deposit
Event trigger to call GS2-Script before wallet balance is added.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before deposit |
| newWallet | Wallet | Wallet after deposit |
| price | float | Purchase Price |
| depositCount | int | Quantity of billable currency to be granted |
Result
| Type | Require | Default | Limitation | Description |
|---|
| permit | bool | ✓ | | | Allow wallet balance addition |
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
price = args.price
depositCount = args.depositCount
result = {
permit=permit
}
depositDone
GS2-Script called after wallet balance is added.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before deposit |
| newWallet | Wallet | Wallet after deposit |
| price | float | Purchase Price |
| depositCount | int | Quantity of billable currency to be granted |
Result
| Type | Require | Default | Limitation | Description |
|---|
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
price = args.price
depositCount = args.depositCount
result = {
}
withdraw
Event trigger to call GS2-Script before wallet balance is consumed.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before withdraw |
| newWallet | Wallet | Wallet after withdraw |
| withdrawCount | int | Quantity of billable currency to be consumed |
| paidOnly | bool | Only for paid currency |
Result
| Type | Require | Default | Limitation | Description |
|---|
| permit | bool | ✓ | | | Allow wallet balance consumption |
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
withdrawCount = args.withdrawCount
paidOnly = args.paidOnly
result = {
permit=permit
}
withdrawDone
GS2-Script called after wallet balance is consumed.
Request
| Type | Description |
|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before withdraw |
| newWallet | Wallet | Wallet after withdraw |
| withdrawCount | int | Quantity of billable currency to be consumed |
| paidOnly | bool | Only for paid currency |
Result
| Type | Require | Default | Limitation | Description |
|---|
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
withdrawCount = args.withdrawCount
paidOnly = args.paidOnly
result = {
}