API turn OFF auto withdrawal


(Adam Esterle) #1

How do you turn off auto withdrawal via the API?

The docs say you can:
https://docs.dwolla.com/#enabledisable-auto-withdrawal

But the thing is, if you pass false as status, it returns immediately because of the first line in
toggleAutoWithdrawalStatus()

if (!$status) { return self::_error(“toggleAutoWithdrawalStatus() requires \$status parameter.\n”); }

SOLUTION:

public function toggleAutoWithdrawalStatus($status, $fundingId = false, $alternate_token = false) {
if (!isset($status)) { return self::_error(“toggleAutoWithdrawalStatus() requires \$status parameter.\n”); }
if ($status && !$fundingId) { return self::_error(“toggleAutoWithdrawalStatus() requires \$fundingId parameter.\n”); }

    return self::_post('/accounts/features/auto_withdrawl',
        [
            'oauth_token' => $alternate_token ? $alternate_token : self::$settings->oauth_token,
            'enabled' => $status,
            'fundingId' => $fundingId
        ]);
}

That is a quick fix though there may be a better way.

There is also a misspelling on that endpoint
auto_withdrawl should be auto_withdrawal

I also posted on Github


(Cory Anderson) #2

(Cory Anderson) #3

(Cory Anderson) #4