Trigger Reference of GS2-Money2 Script
Trigger
deposit
Wallet balance addition
Synchronous Execution Script
Script and Wallet balance addition are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before deposit |
| newWallet | Wallet | Wallet after deposit |
| transactions | DepositTransaction[] | List of occurred transactions |
| count | int | Amount of balance to be added |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow wallet balance addition |
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count
result = {
permit=permit
}Asynchronous Execution Script
The script executes asynchronously after the Wallet balance addition.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before deposit |
| newWallet | Wallet | Wallet after deposit |
| transactions | DepositTransaction[] | List of occurred transactions |
| count | int | Amount of balance to be added |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count
result = {
}withdraw
Wallet balance consumption
Synchronous Execution Script
Script and Wallet balance consumption are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before withdraw |
| newWallet | Wallet | Wallet after withdraw |
| transactions | DepositTransaction[] | List of occurred transactions |
| count | int | Amount of balance to be consumed |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow wallet balance consumption |
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count
result = {
permit=permit
}Asynchronous Execution Script
The script executes asynchronously after the Wallet balance consumption.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| oldWallet | Wallet | Wallet before withdraw |
| newWallet | Wallet | Wallet after withdraw |
| transactions | DepositTransaction[] | List of occurred transactions |
| count | int | Amount of balance to be consumed |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count
result = {
}subscribe
New subscription
Synchronous Execution Script
Script and New subscription are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| contentModel | StoreSubscriptionContentModel | Store Subscription Content Model |
| transaction | SubscribeTransaction | Subscription Status |
| userId | string | User ID |
| ttlAt | long | Time to live for GS2-Schedule trigger |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt
result = {
}renew
Renewal subscription
Synchronous Execution Script
Script and Renewal subscription are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| contentModel | StoreSubscriptionContentModel | Store Subscription Content Model |
| transaction | SubscribeTransaction | Subscription Status |
| userId | string | User ID |
| ttlAt | long | Time to live for GS2-Schedule trigger |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt
result = {
}unsubscribe
Unsubscribe
Synchronous Execution Script
Script and Unsubscribe are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| contentModel | StoreSubscriptionContentModel | Store Subscription Content Model |
| transaction | SubscribeTransaction | Subscription Status |
| userId | string | User ID |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
result = {
}takeOver
Subscription take over
Synchronous Execution Script
Script and Subscription take over are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| contentModel | StoreSubscriptionContentModel | Store Subscription Content Model |
| transaction | SubscribeTransaction | Subscription Status |
| fromUserId | string | User ID |
| toUserId | string | User ID |
| elapsedHours | int | Elapsed hours since last user change |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow subscription take over |
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
fromUserId = args.fromUserId
toUserId = args.toUserId
elapsedHours = args.elapsedHours
result = {
permit=permit
}Asynchronous Execution Script
The script executes asynchronously after the Subscription take over.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| contentModel | StoreSubscriptionContentModel | Store Subscription Content Model |
| transaction | SubscribeTransaction | Subscription Status |
| fromUserId | string | User ID |
| toUserId | string | User ID |
| elapsedHours | int | Elapsed hours since last user change |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
fromUserId = args.fromUserId
toUserId = args.toUserId
elapsedHours = args.elapsedHours
result = {
}verifyReceipt
Receipt verification
Synchronous Execution Script
Script and Receipt verification are executed synchronously in that order.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| storeContentModel | StoreContentModel | Store Content Model |
| receipt | Receipt | Receipt |
| userId | string | User ID |
Result
| Type | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|
| permit | bool | ✓ | Whether to allow receipt verification |
Implementation Example
namespace = args.namespace
storeContentModel = args.storeContentModel
receipt = args.receipt
userId = args.userId
result = {
permit=permit
}Asynchronous Execution Script
The script executes asynchronously after the Receipt verification.
Request
| Type | Description | |
|---|---|---|
| namespace | Namespace | Namespace |
| storeContentModel | StoreContentModel | Store Content Model |
| receipt | Receipt | Receipt |
| userId | string | User ID |
Result
| Type | Required | Default | Value Limits | Description |
|---|
Implementation Example
namespace = args.namespace
storeContentModel = args.storeContentModel
receipt = args.receipt
userId = args.userId
result = {
}