-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
124 lines (120 loc) · 3.3 KB
/
serverless.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
service: ph-roadshow-demo
custom:
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
provider:
name: aws
runtime: nodejs10.x
environment:
CARDS_TABLE: ${self:service}-${self:custom.stage}-cards
TRANSACTIONS_TABLE: ${self:service}-${self:custom.stage}-transactions
URL: { "Fn::Join" : ["", [" https://", { "Ref" : "ApiGatewayRestApi" }, ".execute-api.${self:custom.region}.amazonaws.com/${self:custom.stage}/" ] ] }
ACCOUNT: "test"
MERCHANT_ID: "test_merchantId"
KEY: "testKey"
SECRET: "testSecret"
SERVICE_URL: "https://v1-hub-staging.sph-test-solinor.com"
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.CARDS_TABLE}"
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.TRANSACTIONS_TABLE}"
functions:
listCards:
handler: listCards.list
events:
- http:
path: cards
method: get
cors: true
addCard:
handler: addCard.add
events:
- http:
path: card/add
method: get
cors: true
buildAddCardForm:
handler: buildAddCardForm.build
events:
- http:
path: card/add/form
method: get
cors: true
charge:
handler: charge.charge
events:
- http:
path: charge
method: get
cors: true
listTransactions:
handler: listTransactions.list
events:
- http:
path: transactions
method: get
cors: true
commitScaPayment:
handler: charge.commitScaPayment
events:
- http:
path: charge/webhook
method: get
cors: true
resources:
Resources:
CardsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
-
AttributeName: user
AttributeType: S
-
AttributeName: card_token
AttributeType: S
KeySchema:
-
AttributeName: user
KeyType: HASH
-
AttributeName: card_token
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.CARDS_TABLE}
TransactionsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
- AttributeName: user
AttributeType: S
- AttributeName: transaction_id
AttributeType: S
KeySchema:
- AttributeName: user
KeyType: HASH
- AttributeName: transaction_id
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.TRANSACTIONS_TABLE}