Skip to content

Commit 32a937b

Browse files
committed
Add the Sync-Beneficiary cmdlet
1 parent 95e9bda commit 32a937b

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33
## Version [0.5.0](https://github.com/MC2IT/Agicap.ps1/compare/v0.4.0...v0.5.0)
4-
- **Payments:** added the `New-SynchronizedBeneficiary` cmdlets.
4+
- **Payments:** added the `New-SynchronizedBeneficiary`, `Sync-Beneficiary` cmdlets.
55

66
## Version [0.4.0](https://github.com/MC2IT/Agicap.ps1/compare/v0.3.0...v0.4.0)
77
- Added the `-Scope` parameter to the `New-Client` cmdlet.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using namespace Mc2it.Agicap
2+
using namespace System.Net.Http
3+
4+
<#
5+
.SYNOPSIS
6+
Starts a bulk synchronization of beneficiaries from the ERP software.
7+
.OUTPUTS
8+
The identifier of the newly started synchronization.
9+
#>
10+
function Sync-Beneficiary {
11+
[CmdletBinding()]
12+
[OutputType([guid])]
13+
param (
14+
# The API client.
15+
[Parameter(Mandatory, Position = 1)]
16+
[Client] $Client,
17+
18+
# The beneficiaries to synchronize.
19+
[Parameter(Mandatory, Position = 2)]
20+
[SynchronizedBeneficiary[]] $Beneficiaries
21+
)
22+
23+
begin {
24+
$api = $Client.Payments.Beneficiaries($EntityId).Synchronization
25+
}
26+
27+
process {
28+
try { $api.Create($Beneficiaries) }
29+
catch [HttpRequestException] { Write-Error $_ }
30+
}
31+
}

0 commit comments

Comments
 (0)