Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

Commit

Permalink
Pass payments to conversations as property
Browse files Browse the repository at this point in the history
  • Loading branch information
krismuniz committed Jun 24, 2017
1 parent 818a5f8 commit bc52a31
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vott-messenger",
"version": "0.13.0",
"version": "0.13.1",
"description": "An extensible framework for building Messenger bots",
"main": "./lib/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ export class MessengerBot extends Vott {
this.dispatch('referral', event)
} else if (event.payment) {
event.chat_enabled = true
event.message = event.payment

this.dispatch('payment', event)
} else if (event.checkout_update) {
event.chat_enabled = true
event.message = event.checkout_update

this.dispatch('checkout_update', event)
} else if (event.account_linking) {
this.dispatch('account_linking', event)
Expand Down
8 changes: 8 additions & 0 deletions test/vott.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ test('[VottMessenger#receive] emits payment', (t) => {
page_id: 'my_page'
},
chat_enabled: true,
message: {
prop_a: 'A',
prop_b: 'B'
},
payment: {
prop_a: 'A',
prop_b: 'B'
Expand Down Expand Up @@ -460,6 +464,10 @@ test('[VottMessenger#receive] emits checkout_update', (t) => {
page_id: 'my_page'
},
chat_enabled: true,
message: {
prop_a: 'A',
prop_b: 'B'
},
checkout_update: {
prop_a: 'A',
prop_b: 'B'
Expand Down

0 comments on commit bc52a31

Please sign in to comment.