Skip to content

Instantly share code, notes, and snippets.

@hprobotic
Last active November 15, 2021 01:21
Show Gist options
  • Save hprobotic/a10bc2bab40a9a6ea8862abb0ea7953f to your computer and use it in GitHub Desktop.
Save hprobotic/a10bc2bab40a9a6ea8862abb0ea7953f to your computer and use it in GitHub Desktop.
query to get payout history

during Reap Pay admin payout, when Maker marks a transaction using any intermediary review status (rec_payout, Q12345, R12345, rec_complete), does this get stored in the DB even after such transaction is moved to Completed Transfers as either SUCCESS or REFUND? If so, which column is this in the DB?

The values of rec_payout, rec_complete meaning:

# NULL: unprocessed
# 1: Successfully
# 0: Failed
  1. Find all failed payout transactions:
SELECT COUNT(*) as count FROM `reapprod`.`transaction` WHERE `rec_payout` = 0;

2.1 Find the reason befind rec_payout was failed:

  • Get the user id of transaction
  • From the user id, find the list of email has been sent from admin email logs. Check the slug of records, we can find out what's relation behind rec_payout was failed for each user. Example user: 10127 have: [refund-own-account, refund-bad-invoice, refund-breach-tos]

For example a tx id: 19385 has rec_payout failed:

SELECT COUNT(*) as count FROM `reapprod`.`admin_email_log` WHERE `user_id` LIKE '%10127%';

2.2 Use maker_remark to get latest marker status:

SELECT * FROM `reapprod`.`transaction` WHERE `rec_payout` = 0;

Checkout the maker_remark column to have latest maker: enum('QUERY_INVOICE_NOT_MATCH','QUERY_PAYOUT_FAILED','QUERY_OWN_BANK_ACCOUNT','QUERY_INVOICE_NOT_ACCEPTABLE','QUERY_OTHERS','REFUND_OWN_BANK_ACCOUNT','REFUND_INVOICE_NOT_ACCEPTABLE','REFUND_PAYMENT_CATEGORY_NOT_ACCEPTABLE','REFUND_MULTIPLE_ACCOUNTS','REFUND_BREACH_OF_TOS','REFUND_OTHERS','QUERY_BILL_NUMBER_WRONG','REFUND_NOT_OWN_BILL','REFUND_PPS_DUPLICATE')

  1. To find all rec_complete transactions, we can use:
SELECT COUNT(*) as count FROM `reapprod`.`transaction` WHERE `rec_complete` = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment