Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented a facade for PaymentMethod #402

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Anindya007
Copy link

Noticed there is no PaymentMethod facade implementation in the codebase so I provided one. Please review and merge. Thank you.

@kingIZZZY
Copy link
Contributor

kingIZZZY commented Jun 28, 2022

Temporary / hacky workaround:

// add/create
$pm = QuickBooksOnline\API\Facades\FacadeHelper::reflectArrayToObject("PaymentMethod", ['Name' => 'Bitcoin', 'Type' => ['value' => 'NON_CREDIT_CARD']], true );
$pm1 = $dataService->add($pm);

// update - for ex. deactivate (as delete is apparently not supported)
$newObj = FacadeHelper::reflectArrayToObject("PaymentMethod", ['Active' => false], true );
$clonedOfObj = FacadeHelper::cloneObj($pm1);
$pm2 = FacadeHelper::mergeObj($clonedOfObj, $newObj);
$pm3 = $dataService->update($pm2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants