Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacopocarlini committed Jul 15, 2022
1 parent af84883 commit 804c71f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ venv.bak/
__pycache__/
*.py[cod]
*$py.class
/coverage/
.idea/
15 changes: 12 additions & 3 deletions Donation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {AzureFunction, Context, HttpRequest} from "@azure/functions"



// POST http://localhost:7071/api/Donation
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
context.log('HTTP trigger function processed a request.', req.body);
Expand All @@ -12,10 +14,12 @@ const httpTrigger: AzureFunction = async function (context: Context, req: HttpRe
amount: properties.amount,
description: properties.description,
isPartialPayment: false,
dueDate: "2022-03-16T09:30:42.577", // TODO
retentionDate: "2022-05-15T08:30:42.577", // TODO
dueDate: addDays(new Date(), Number(process.env['ADD_DUE_DATE_DAYS'])),
retentionDate: addDays(new Date(), Number(process.env['ADD_RETENTION_DATE_DAYS'])),
fee: 0,
transfer: []
transfer: [{
amount: properties.amount
}]
}
]
}
Expand All @@ -29,4 +33,9 @@ const httpTrigger: AzureFunction = async function (context: Context, req: HttpRe

};

function addDays(date: Date, days: number): Date {
date.setDate(date.getDate() + days);
return date;
}

export default httpTrigger;
Empty file removed env.example
Empty file.
6 changes: 4 additions & 2 deletions local.settings.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"AzureWebJobsStorage": ""
"AzureWebJobsStorage": "",
"ADD_DUE_DATE_DAYS": 15,
"ADD_RETENTION_DATE_DAYS": 15
}
}
}

0 comments on commit 804c71f

Please sign in to comment.