Commit 265c206c authored by Mark Harding's avatar Mark Harding

(fix): provide id_number if required

1 merge request!420Additional stripe steps and ability to add phone number
Pipeline #102407278 running with stages
<?php
/**
*
*/
namespace Minds\Controllers\api\v2\payments\stripe\connect;
use Minds\Api\Factory;
use Minds\Common\Cookie;
use Minds\Core\Di\Di;
use Minds\Core\Config;
use Minds\Core\Session;
use Minds\Interfaces;
use Minds\Core\Payments\Stripe;
class update implements Interfaces\Api
{
public function get($pages)
{
return Factory::response([]);
}
public function post($pages)
{
$user = Session::getLoggedInUser();
$connectManager = new Stripe\Connect\Manager();
$account = $connectManager->getByUser($user);
if ($_POST['phone'] ?? null) {
$account->setPhoneNumber($_POST['phone']);
}
if ($_POST['id_number'] ?? null) {
$account->setPersonalIdNumber($_POST['id_number']);
}
try {
$connectManager->update($account);
} catch (\Exception $e) {
return Factory::response([
'status' => 'error',
'message' => $e->getMessage(),
]);
}
return Factory::response([]);
}
public function put($pages)
{
return Factory::response([]);
}
public function delete($pages)
{
return Factory::response([]);
}
}
......@@ -165,20 +165,12 @@ class Manager
if (!($stripeAccount->individual->ssn_last_4i ?? null) && $account->getSSN()) {
$stripeAccount->individual->ssn_last_4 = $account->getSSN();
}
if (!$account->individual->id_number_provided && $account->getPersonalIdNumber()) {
$account->individual->id_number = $account->getPersonalIdNumber();
}
}
/*if ($account->getAccountNumber()) {
$stripeAccount->external_account->account_number = $account->getAccountNumber();
if (!$account->individual->id_number_provided && $account->getPersonalIdNumber()) {
$stripeAccount->individual->id_number = $account->getPersonalIdNumber();
}
if ($account->getRoutingNumber()) {
$stripeAccount->external_account->routing_number = $account->getRoutingNumber();
}*/
if ($account->getEmail()) {
$stripeAccount->individual->email = $account->getEmail();
}
......
Please register or to comment