Last active
November 10, 2020 21:20
-
-
Save RobertWaiteREPAY/43d2be53154032a90d206dd27dbb74d8 to your computer and use it in GitHub Desktop.
PSBlog005
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Create A payment for invoice $ReferenceNbr" | |
$body = @" | |
{ | |
`"Type`": {`"value`": `"Payment`"}, | |
`"CustomerID`": {`"value`": `"$CustomerNbr`"}, | |
`"PaymentMethod`": {`"value`": `"$PaymentMethod`"}, | |
`"PaymentAmount`": {`"value`": $UnitPrice}, | |
`"DocumentsToApply`": [{`"ReferenceNbr`": {`"value`": `"$ReferenceNbr`"}}] | |
} | |
"@ | |
$HashArguments = @{ | |
Uri = "$AcumaticaEndPoint/entity/default/18.200.001/Payment" | |
Method = 'PUT' | |
Headers = $headers | |
Body = $body | |
WebSession = $WebSession | |
} | |
$response = Invoke-RestMethod @HashArguments | |
$PaymentAsPSObject = $response | ConvertTo-Json | ConvertFrom-Json | |
$PaymentEntityID = $PaymentAsPSObject.id | |
"Capturing CC Payment for Invoice $ReferenceNbr on EntityID $PaymentEntityID" | |
$body = @" | |
{ | |
`"entity`": | |
{ | |
`"id`": `"$PaymentEntityID`" | |
} | |
} | |
"@ | |
$HashArguments = @{ | |
Uri = "$AcumaticaEndPoint/entity/default/18.200.001/Payment/CaptureCreditCardPayment" | |
Method = 'POST' | |
Headers = $headers | |
Body = $body | |
WebSession = $WebSession | |
} | |
$response = Invoke-RestMethod -Method 'POST' -Headers $headers -Body $body | |
$response | ConvertTo-Json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment