Trigger Reference of GS2-Money2 Script

Reference of event triggers that call extended scripts

deposit

Event trigger to call GS2-Script before Deposit wallet balance.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be added

Result

TypeRequireDefaultLimitationDescription
permitboolAllow wallet balance addition

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
  permit=permit
}

depositDone

GS2-Script called after Deposit wallet balance.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before deposit
newWalletWalletWallet after deposit
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be added

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
}

withdraw

Event trigger to call GS2-Script before Withdraw wallet balance.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be consumed

Result

TypeRequireDefaultLimitationDescription
permitboolAllow wallet balance addition

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
  permit=permit
}

withdrawDone

GS2-Script called after Withdraw wallet balance.

Request

TypeDescription
namespaceNamespaceNamespace
oldWalletWalletWallet before withdraw
newWalletWalletWallet after withdraw
transactionsDepositTransaction[]List of occurred transactions
countintAmount of balance to be consumed

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
oldWallet = args.oldWallet
newWallet = args.newWallet
transactions = args.transactions
count = args.count

result = {
}

subscribe

Event trigger to call GS2-Script when New subscription.

Request

TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser Id
ttlAtlongTime to live for GS2-Schedule trigger

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt

result = {
}

renew

Event trigger to call GS2-Script when Renewal subscription.

Request

TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser Id
ttlAtlongTime to live for GS2-Schedule trigger

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId
ttlAt = args.ttlAt

result = {
}

unsubscribe

Event trigger to call GS2-Script when Unsubscribe.

Request

TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
userIdstringUser Id

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
userId = args.userId

result = {
}

takeOver

Event trigger to call GS2-Script before Take over subscription.

Request

TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
fromUserIdstringUser Id
toUserIdstringUser Id
elapsedHoursintElapsed hours since last user change

Result

TypeRequireDefaultLimitationDescription
permitboolAllow 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
}

takeOverDone

GS2-Script called after Take over subscription.

Request

TypeDescription
namespaceNamespaceNamespace
contentModelStoreSubscriptionContentModelStore Subscription Content Model
transactionSubscribeTransactionSubscription Status
fromUserIdstringUser Id
toUserIdstringUser Id
elapsedHoursintElapsed hours since last user change

Result

TypeRequireDefaultLimitationDescription

Implementation Example

namespace = args.namespace
contentModel = args.contentModel
transaction = args.transaction
fromUserId = args.fromUserId
toUserId = args.toUserId
elapsedHours = args.elapsedHours

result = {
}