-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notification more 4 percent declined
- Loading branch information
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/resources/db/migration/V9__insert_notification_more_4_percent_fraud.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
INSERT INTO fb_notificator.notification_template (name, type, skeleton, basic_params, query_text) | ||
VALUES ('> 4% decline', 'MAIL_FORM', '<>', 'partyId,shopId', | ||
'select partyId,shopId,percent from ( ' || | ||
'SELECT partyId,shopId,resultStatus,count() as status_count, ' || | ||
'sum(status_count) over(partition by partyId, shopId) as host_count, ' || | ||
'round(100 * status_count / host_count, 2) as percent ' || | ||
'FROM fraud.fruad ' || | ||
'WHERE timestamp >= toDate(:currentDate) - INTERVAL 1 day ' || | ||
'GROUP BY partyId, shopId, resultStatus )' || | ||
'where resultStatus = ''DECLINE'' and percent > 4 ' || | ||
'order by percent ASC'); |