Why does AlphaCommerceHub respond `1015` / «Transaction not allowed» / «The partial refund amount must be less than or equal to the remaining amount.» to a PayPal's `RefundPayment` API request even if the refund amount is the same as the captured amount?

@gallaron

1. Request

1.1. Body

{
    "Header": {
        "MerchantID": "ANTERIOR001",
        "TransactionType": "RefundPayment",
        "UserID": "<...>",
        "Version": "2"
    },
    "Transaction": {
        "Amount": "169000",
        "Currency": "AUD",
        "MerchantTxnID": "1208L.774",
        "Method": "PP"
    }
}

1.2. Headers

Request: POST / HTTP/1.1
Accept-encoding: gzip, deflate
Connection: close
Content-Length: 298
Content-Type: application/json
Host: hubapiuat.alphacommercehub.com.au
User-Agent: Mage2.PRO

2. Response

{
    "Banks": null,
    "Country": null,
    "DocumentResults": null,
    "EmailChecks": null,
    "FraudChecks": null,
    "GeoChecks": null,
    "ProviderResps": {
        "ProviderResp": [
            {
                "ProviderName": "Paypal",
                "ProviderOrder": "1",
                "ProviderResponse": "10009",
                "ProviderResponseMessage": "Transaction refused. The partial refund amount must be less than or equal to the remaining amount."
            }
        ]
    },
    "Result": {
        "custom1": null,
        "custom2": null,
        "custom3": null,
        "custom4": null,
        "custom5": null,
        "MerchantID": "ANTERIOR001",
        "MerchantTxnID": "1208L.774",
        "ResponseCode": "1015",
        "ResponseMessage": "Transaction not allowed",
        "ResponseTimestamp": "12122017062759"
    },
    "ShippingService": null,
    "TaxResultLines": null
}

See also:

See comment in 5143. Please try in USD or EUR as PayPal test system has strange behaviour on AUD