feat(GBMinService, MainService): integrate Stripe payment success handling and update dialog flow
This commit is contained in:
parent
ec8b0d44df
commit
feb7939387
2 changed files with 27296 additions and 213 deletions
|
|
@ -1117,11 +1117,18 @@ export class GBMinService {
|
||||||
|
|
||||||
const step = await min.dialogs.createContext(context);
|
const step = await min.dialogs.createContext(context);
|
||||||
step.context.activity.locale = 'pt-BR';
|
step.context.activity.locale = 'pt-BR';
|
||||||
|
|
||||||
|
|
||||||
const sec = new SecService();
|
const sec = new SecService();
|
||||||
let member = context.activity.recipient;
|
let member = context.activity.recipient;
|
||||||
|
|
||||||
|
if (context.activity.type === 'conversationUpdate') {
|
||||||
|
if (context.activity.membersAdded && context.activity.membersAdded.length > 0 &&
|
||||||
|
context.activity.membersAdded[0].id !== context.activity.recipient.id) {
|
||||||
|
GBLogEx.info(min, `Bot added to conversation: ${member.name}`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.GB_MODE === 'legacy' || !member) {
|
if (process.env.GB_MODE === 'legacy' || !member) {
|
||||||
member = context.activity.from;
|
member = context.activity.from;
|
||||||
}
|
}
|
||||||
|
|
@ -1150,7 +1157,7 @@ export class GBMinService {
|
||||||
GBMinService.pidsConversation[conversationId] = pid;
|
GBMinService.pidsConversation[conversationId] = pid;
|
||||||
step.context.activity['pid'] = pid;
|
step.context.activity['pid'] = pid;
|
||||||
|
|
||||||
const auth = false; // min.core.getParam(min.instance, 'Enable Authentication', null);
|
const auth = min.core.getParam(min.instance, 'Enable Authentication', false);
|
||||||
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
const res = await t.find({ pid: pid, handle: "users.csv", args: [`key={member.id}`] });
|
const res = await t.find({ pid: pid, handle: "users.csv", args: [`key={member.id}`] });
|
||||||
|
|
@ -1276,8 +1283,6 @@ export class GBMinService {
|
||||||
// Check if a bot or a human participant is being added to the conversation.
|
// Check if a bot or a human participant is being added to the conversation.
|
||||||
|
|
||||||
const member = context.activity.membersAdded[0];
|
const member = context.activity.membersAdded[0];
|
||||||
if (context.activity.membersAdded[0].id === context.activity.recipient.id) {
|
|
||||||
GBLogEx.info(min, `Bot added to conversation, starting chat...`);
|
|
||||||
|
|
||||||
// Calls onNewSession event on each .gbapp package.
|
// Calls onNewSession event on each .gbapp package.
|
||||||
|
|
||||||
|
|
@ -1309,11 +1314,6 @@ export class GBMinService {
|
||||||
await GBVMService.callVM(startDialog.toLowerCase(), min, step, pid);
|
await GBVMService.callVM(startDialog.toLowerCase(), min, step, pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
GBLogEx.info(min, `Person added to conversation: ${member.name}`);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (context.activity.type === 'message') {
|
} else if (context.activity.type === 'message') {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
27083
pnpm-lock.yaml
generated
Normal file
27083
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue