Today Transaction Notifications

The script returns ALL of today's notification-items with the same column-data as the notifier sends.

SELECT t."Id"                                          AS "TransactionId",
       t."UserId",
       pr."DomainName",
       mi."Referrer"                                   AS "ClientReferrer",
       u."UserName"                                    AS "Email",
       format('%s %s', pd."FirstName", pd."LastName")  AS "ClientName",
       f."Name"                                        AS "FundProcessor",
       pg."PaymentGatewayType"                         AS "PaymentGateway",
       t."Amount",
       c."Code"                                        AS "CurrencyCode",
       t."StatusId",
       to_char(t."CreatedDate", 'yyyy-MM-dd HH:mm:ss') AS "CreatedDate",
       p."Name"                                        AS "PoolName",
       t."IsFirstDeposit"                              AS "Ftd",
       FALSE                                           AS "SyncWithTradingPlatform",
       (SELECT "Notes"
        FROM "TransactionHistories"
        WHERE "TransactionId" = t."Id"
          AND t."StatusId" IN (4, 6)
          AND "NewStatusId" = t."StatusId"
        ORDER BY "Id" DESC
        LIMIT 1)                                       AS "Reason"
FROM "Transactions" t
       JOIN "UserProfile" u ON t."UserId" = u."UserId"
       JOIN "UserProfilePersonalDetails" pd ON u."UserId" = pd."UserId"
       JOIN "Leads" l on u."UserId" = l."UserId"
       LEFT JOIN "Pools" p ON l."PoolId" = p."Id"
       JOIN "LeadMarketingInfos" mi ON l."Id" = mi."LeadId"
       JOIN "BusinessUnits" b ON u."BusinessUnitId" = b."Id"
       JOIN "Portals" pr ON b."PortalId" = pr."Id"
       JOIN "FundProcessors" f ON t."FundProcessorId" = f."Id"
       LEFT JOIN "PaymentGateways" pg ON t."PaymentGatewayId" = pg."Id"
       JOIN "Currencies" c on t."CurrencyId" = c."Id"
WHERE t."StatusId" IN (4, 5, 6)
  AND t."CreatedDate" >= current_date;
faq/support/clients/sql/transactions/notifications.txt · Last modified: 2019/04/10 08:51 by 127.0.0.1
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0