-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple.js
51 lines (48 loc) · 1.4 KB
/
simple.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const { FlexMessageBuilder, FlexComponentBuilder } = require('@catcatio/line-flex-builder')
const makePaymentTemplate = (title, message, paymentLink, languageCode) => {
const lineTemplate = new FlexMessageBuilder()
const template = lineTemplate.flexMessage('Payment')
.addBubble()
.addHeader()
.addComponents(
FlexComponentBuilder.flexBox()
.setLayout('horizontal')
.addContents(FlexComponentBuilder.flexText()
.setText(title)
.setWeight('bold')
.setSize('sm')
.build())
.build()
)
.addBody()
.setStyleBackgroundColor('#EFEFEF')
.setStyleSeparator(true)
.setStyleSeparatorColor('#DDDDDD')
.setLayout('vertical')
.setSpacing('md')
.addComponents(
FlexComponentBuilder.flexText()
.setText(message)
.setWrap(true)
.setSize('sm')
.build()
)
.addFooter()
.setStyleSeparator(true)
.setStyleSeparatorColor('#DDDDDD')
.setLayout('horizontal')
.setSpacing('md')
.addComponents(
FlexComponentBuilder.flexButton()
.setStyle('secondary')
.setColor('#b0bec5')
.setAction({
'type': 'uri',
'label': languageCode === 'th' ? 'จ่ายด้วย LINE Pay' : 'Pay by LINE Pay',
'uri': paymentLink
})
.build(),
)
return template.build()
}
module.exports = makePaymentTemplate