Skip to content

Instantly share code, notes, and snippets.

@runezero
Last active July 26, 2023 09:34
Show Gist options
  • Save runezero/4f9159a9bd8156bc2e0ed671b68e3934 to your computer and use it in GitHub Desktop.
Save runezero/4f9159a9bd8156bc2e0ed671b68e3934 to your computer and use it in GitHub Desktop.
[Create PrimaryPayer Update List] Create a list of Business Central paying customers to update based on the given Mandate data and customer number #billybird
<?php
/* Class: Twikeyservice */
$data = $this->getCompletedMandates();
$result = [];
foreach ($data as $row) {
$order = json_decode($row->data, true);
$order['person']['phone'] = Api::validateMobileNumber($order['person']['phone'] ?? "");
$result[] = [$order['person'], $row->customer_number, $row->location];
$updateParams = [$order['person'], $row->customer_number, $row->location];
Taskrunner::insertTask('30 20 * *', 'Twikeyservice::updatePrimaryPayerInfo', $updateParams, 1, true);
}
return ["count" => count($result), "data" => $result];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment