Page MenuHomePhorge

Wallet charge: top-ups and notifications
ClosedPublic

Authored by machniak on May 6 2020, 1:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 23, 9:31 PM
Unknown Object (File)
Fri, Mar 8, 11:13 PM
Unknown Object (File)
Feb 23 2024, 6:01 AM
Unknown Object (File)
Feb 20 2024, 8:23 PM
Unknown Object (File)
Feb 19 2024, 5:30 AM
Unknown Object (File)
Feb 15 2024, 11:06 AM
Unknown Object (File)
Feb 6 2024, 6:44 AM
Unknown Object (File)
Feb 2 2024, 2:27 AM
Subscribers
Restricted Project

Details

Reviewers
vanmeeuwen
Group Reviewers
Restricted Project
Commits
rKc4f6f1b8b280: Wallet charge: top-ups and notifications
Summary

UI additions:

wallet1.png (577×513 px, 42 KB)

wallet2.png (457×509 px, 35 KB)

Diff Detail

Repository
rK kolab
Branch
dev/wallet-charge
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 29362
Build 10693: arc lint + arc unit

Event Timeline

machniak created this revision.
  • Add some payment notification jobs/emails
  • More on auto-top-ups and disabling mandates
  • Added tests for two jobs
  • Tests for Mollie wallet top-ups
  • Rename templates
  • Fix parse error
  • Stripe: Webhook fixes, more tests
  • Add todo
machniak edited the summary of this revision. (Show Details)
machniak added a subscriber: Restricted Project.
  • More webhook tests, send notifications for recurring payments only
  • Disable auto-payment mandate on failed payment
  • Add payment success/failure notification emails with tests
  • Payment mandate disabled notification
  • Fix typos
  • Small improvements
  • Improve wording
machniak edited the summary of this revision. (Show Details)
  • Add some payment notification jobs/emails
  • More on auto-top-ups and disabling mandates
  • Added tests for two jobs
  • Tests for Mollie wallet top-ups
  • Rename templates
  • Fix parse error
  • Stripe: Webhook fixes, more tests
  • Add todo
  • More webhook tests, send notifications for recurring payments only
  • Disable auto-payment mandate on failed payment
  • Add payment success/failure notification emails with tests
  • Payment mandate disabled notification
  • Fix typos
  • Small improvements
  • Improve wording
  • Add fakeRender() for all templates
  • Update transaction log with payment description
  • Add wallet:mandate command to view/enable/disable auto-payment
  • Disabled mandate handling, test and fixed some flaky tests
machniak retitled this revision from WIP: Wallet charge: top-ups and notifications to Wallet charge: top-ups and notifications.

I set up auto-payment for CHF 50 for john@kolab.org using https://kanarip.dev.kolab.io/ and the mollie provider, clicking through the mollie interface with status 'paid', but the balance remained -9,99 after I executed a wallet:charge.

Screenshot from 2020-06-02 11-02-32.png (1×1 px, 73 KB)

Screenshot from 2020-06-02 11-01-03.png (1×1 px, 77 KB)

Am I missing something?

vanmeeuwen added inline comments.
src/tests/Unit/Mail/PaymentSuccessTest.php
41 ↗(On Diff #3466)

This should be 'The auto-payment'.

Why not, here too, use:

$this->assertTrue(strpos($html, \trans('mail.paymentsuccess-subject', ['site' => $appName])) > 0);

?

This revision now requires changes to proceed.Jun 2 2020, 11:44 AM
[2020-06-02 09:52:50] local.DEBUG: C: POST https://kanarip.dev.kolab.io/api/v4/payments/mandate [5.8M]: 6.7196 sec.  
[2020-06-02 09:52:50] local.DEBUG: [SQL] select * from `users` where `id` = ? and `users`.`deleted_at` is null limit 1 [3502450530]  
[2020-06-02 09:52:50] local.DEBUG: [SQL] select * from `wallets` where `wallets`.`user_id` = ? and `wallets`.`user_id` is not null [3502450530]  
[2020-06-02 09:52:50] local.DEBUG: [SQL] select * from `wallet_settings` where `wallet_settings`.`wallet_id` = ? and `wallet_settings`.`wallet_id` is not null and (`key` = ?) limit 1 [a68f5ac9-1425-4691-9cf1-eb0947c0c657, mandate_amount]  
[2020-06-02 09:52:50] local.DEBUG: [SQL] select * from `wallet_settings` where `wallet_settings`.`wallet_id` = ? and `wallet_settings`.`wallet_id` is not null and (`key` = ?) limit 1 [a68f5ac9-1425-4691-9cf1-eb0947c0c657, mandate_balance]  
[2020-06-02 09:52:50] local.DEBUG: [SQL] select * from `wallet_settings` where `wallet_settings`.`wallet_id` = ? and `wallet_settings`.`wallet_id` is not null [a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:52:51] local.DEBUG: [SQL] select * from `wallet_settings` where `wallet_settings`.`wallet_id` = ? and `wallet_settings`.`wallet_id` is not null and (`key` = ?) limit 1 [a68f5ac9-1425-4691-9cf1-eb0947c0c657, mollie_mandate_id]  
[2020-06-02 09:52:51] local.DEBUG: [SQL] update `wallet_settings` set `value` = ?, `wallet_settings`.`updated_at` = ? where `id` = ? [mdt_QHSWvmRxxF, 2020-06-02 09:52:51, 4]  
[2020-06-02 09:52:51] local.DEBUG: [SQL] select * from `wallet_settings` where `wallet_settings`.`wallet_id` = ? and `wallet_settings`.`wallet_id` is not null [a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:52:51] local.DEBUG: C: POST https://kanarip.dev.kolab.io/api/v4/payments/mandate [5.7M]: 0.7062 sec.  
[2020-06-02 09:53:09] local.DEBUG: [SQL] select * from `payments` where `payments`.`id` = ? limit 1 [tr_nr4hDVveMc]  
[2020-06-02 09:53:09] local.DEBUG: C: POST https://kanarip.dev.kolab.io/api/webhooks/payment/mollie [5M]: 0.0141 sec.  
[2020-06-02 09:53:09] local.DEBUG: C: GET https://kanarip.dev.kolab.io/wallet [4.4M]: 0.0398 sec.  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `users` where `id` = ? and `users`.`deleted_at` is null limit 1 [3502450530]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `user_settings` where `user_settings`.`user_id` = ? and `user_settings`.`user_id` is not null and `key` in (?, ?, ?, ?, ?, ?, ?, ?) [3502450530, billing_address, country, currency, external_email, first_name, last_name, organization, phone]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `user_aliases` where `user_aliases`.`user_id` = ? and `user_aliases`.`user_id` is not null [3502450530]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `domains` where `namespace` = ? and `domains`.`deleted_at` is null limit 1 [kolab.org]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `wallets` where `wallets`.`user_id` = ? and `wallets`.`user_id` is not null [3502450530]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select `wallets`.*, `user_accounts`.`user_id` as `pivot_user_id`, `user_accounts`.`wallet_id` as `pivot_wallet_id` from `wallets` inner join `user_accounts` on `wallets`.`id` = `user_accounts`.`wallet_id` where `user_accounts`.`user_id` = ? [3502450530]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`entitleable_id` = ? and `entitlements`.`entitleable_id` is not null and `entitlements`.`entitleable_type` = ? and `entitlements`.`deleted_at` is null limit 1 [3502450530, App\User]  
[2020-06-02 09:53:14] local.DEBUG: [SQL] select * from `wallets` where `wallets`.`id` = ? limit 1 [a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:53:14] local.DEBUG: C: GET https://kanarip.dev.kolab.io/api/auth/info [5.2M]: 0.0176 sec.  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `wallets` []  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [130ee29b-3be0-4765-a3c1-e3eff405fb72]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [2bfe7b05-a3b5-4d0b-8d0b-b6ad6ab2c2a6]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [58d0e908-4e97-4bd2-a560-60abebb8396c]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [6af7868e-d2e7-4292-b7d0-fa48daa7c8c8]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [6e0d02fc-ab3e-41fd-aca9-1dca549b8468]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [70ff3911-5969-45fa-a7d5-a135098fb74f]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [756d00f3-2e21-454b-ad80-c5c4124446e5]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [7a65bd5e-54ad-44e0-a311-8e2369778a8f]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [9569982c-a092-4260-ba52-29050c70f878]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `id` in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [04a2562c-fcdc-4e62-b31c-fa82ed2ec6bc, 1626ec3e-10d9-4c01-9ddb-511bfb937dbf, 29ee7a84-cbd3-4878-a771-9ccb36685cfb, 37658d29-1433-4b57-880b-e0ba1d6672dc, 4526d709-81ec-4795-b5a6-e3db8a7bb724, 4736d839-a797-43fb-ac07-5ba07321a439, 4827c232-75ef-4791-9b43-c42f3580a10f, 495437a4-5c1d-4b7b-ad57-93dc7bb785ca, 4f9936df-c36b-4f7d-8d2c-39b49d1f996d, 703a9067-c22a-4981-947d-1bec9fbb0e4a, 81b1741f-cd7b-4b28-a009-2e97127caada, 81bcef55-6a1d-41dc-a85b-d901e60a9f1b, 832b65d6-9cdd-4fd5-a53f-afb15dccd86b, 90fa6408-40e3-4737-9cd5-bae201b3ee7e, 927a7128-89cb-40de-875f-d116c9f6a8f8, b12c478a-594e-4da9-8757-212a86fed750, b26e1d74-e098-4696-8a2b-82ff20eabf0b, ea603f31-093a-453e-9ddf-9f5dcf9acd41]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `entitlements` set `entitlements`.`updated_at` = ? where `id` = ? [2020-06-02 09:52:13, 37658d29-1433-4b57-880b-e0ba1d6672dc]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `entitlements` set `entitlements`.`updated_at` = ? where `id` = ? [2020-06-02 09:52:13, 4736d839-a797-43fb-ac07-5ba07321a439]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `transactions` where `transactions`.`id` = ? limit 1 [1202e276-a798-4c9a-b595-46442d94cad7]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] insert into `transactions` (`user_email`, `object_id`, `object_type`, `type`, `amount`, `id`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?, ?, ?) [, 4736d839-a797-43fb-ac07-5ba07321a439, App\Entitlement, billed, 555, 1202e276-a798-4c9a-b595-46442d94cad7, 2020-06-02 09:53:28, 2020-06-02 09:53:28]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `entitlements` set `entitlements`.`updated_at` = ? where `id` = ? [2020-06-02 09:52:13, 4827c232-75ef-4791-9b43-c42f3580a10f]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `entitlements` set `entitlements`.`updated_at` = ? where `id` = ? [2020-06-02 09:52:13, 495437a4-5c1d-4b7b-ad57-93dc7bb785ca]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `transactions` where `transactions`.`id` = ? limit 1 [8e8ab001-f5fd-49f9-8397-f9936daa9991]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] insert into `transactions` (`user_email`, `object_id`, `object_type`, `type`, `amount`, `id`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?, ?, ?) [, 495437a4-5c1d-4b7b-ad57-93dc7bb785ca, App\Entitlement, billed, 444, 8e8ab001-f5fd-49f9-8397-f9936daa9991, 2020-06-02 09:53:28, 2020-06-02 09:53:28]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `wallets` set `balance` = ? where `id` = ? [-999, a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `transactions` where `transactions`.`id` = ? limit 1 [734b2767-0c46-4f1d-ba80-707b92f557ff]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] insert into `transactions` (`user_email`, `object_id`, `object_type`, `type`, `amount`, `id`, `updated_at`, `created_at`) values (?, ?, ?, ?, ?, ?, ?, ?) [, a68f5ac9-1425-4691-9cf1-eb0947c0c657, App\Wallet, debit, 999, 734b2767-0c46-4f1d-ba80-707b92f557ff, 2020-06-02 09:53:28, 2020-06-02 09:53:28]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] update `transactions` set `transaction_id` = ?, `transactions`.`updated_at` = ? where `id` in (?, ?) [734b2767-0c46-4f1d-ba80-707b92f557ff, 2020-06-02 09:53:28, 1202e276-a798-4c9a-b595-46442d94cad7, 8e8ab001-f5fd-49f9-8397-f9936daa9991]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `users` where `users`.`id` = ? and `users`.`deleted_at` is null limit 1 [3502450530]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [b9b92209-a329-4a40-8460-021617425287]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [ccc43a57-a5d8-42c3-b120-43049da9ddff]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [cfba5a16-934e-450b-ab75-a6748b99754a]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [ede1a4a0-4e18-4758-8f72-57337c23bd1d]  
[2020-06-02 09:53:28] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`wallet_id` = ? and `entitlements`.`wallet_id` is not null and `entitlements`.`deleted_at` is null [fb248b72-bf60-4db3-9a0d-348962e3e0ac]  
[2020-06-02 09:53:39] local.DEBUG: C: GET https://kanarip.dev.kolab.io/wallet [4.4M]: 0.0905 sec.  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `users` where `id` = ? and `users`.`deleted_at` is null limit 1 [3502450530]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `user_settings` where `user_settings`.`user_id` = ? and `user_settings`.`user_id` is not null and `key` in (?, ?, ?, ?, ?, ?, ?, ?) [3502450530, billing_address, country, currency, external_email, first_name, last_name, organization, phone]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `user_aliases` where `user_aliases`.`user_id` = ? and `user_aliases`.`user_id` is not null [3502450530]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `domains` where `namespace` = ? and `domains`.`deleted_at` is null limit 1 [kolab.org]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `wallets` where `wallets`.`user_id` = ? and `wallets`.`user_id` is not null [3502450530]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select `wallets`.*, `user_accounts`.`user_id` as `pivot_user_id`, `user_accounts`.`wallet_id` as `pivot_wallet_id` from `wallets` inner join `user_accounts` on `wallets`.`id` = `user_accounts`.`wallet_id` where `user_accounts`.`user_id` = ? [3502450530]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`entitleable_id` = ? and `entitlements`.`entitleable_id` is not null and `entitlements`.`entitleable_type` = ? and `entitlements`.`deleted_at` is null limit 1 [3502450530, App\User]  
[2020-06-02 09:53:44] local.DEBUG: [SQL] select * from `wallets` where `wallets`.`id` = ? limit 1 [a68f5ac9-1425-4691-9cf1-eb0947c0c657]  
[2020-06-02 09:53:44] local.DEBUG: C: GET https://kanarip.dev.kolab.io/api/auth/info [5.2M]: 0.0189 sec.
  • Fix Stripe auto-payment charge
  • Fix Mollie auto-payment
  • Add more tests
src/tests/Unit/Mail/PaymentSuccessTest.php
41 ↗(On Diff #3466)

We could use trans() here. However, what if the localization is broken? Also, some labels might contain characters that are converted to html entities (or nl2br) which would make a difference. So, I'd keep it this way.

vanmeeuwen added inline comments.
src/app/Providers/Payment/Mollie.php
251 ↗(On Diff #3478)

Typo.

This revision now requires changes to proceed.Jun 3 2020, 10:54 AM
This revision is now accepted and ready to land.Jun 3 2020, 12:18 PM
This revision was automatically updated to reflect the committed changes.