pronamic / wp-pronamic-pay-rabo-smart-pay

Rabo Smart Pay driver for the WordPress payment processing library.
http://www.wp-pay.org/gateways/rabo-smart-pay/
3 stars 4 forks source link

Support for refunds? #10

Closed remcotolsma closed 1 year ago

remcotolsma commented 3 years ago

Hello Nico,

Thank you for clearing it up.

At the moment the Rabo OmniKassa doesnt support automatic refunds, however they are working on an option to make it possible. We are closely working with them, in order to make it possible in the plug-in as well.

The way it is at the moment, it requires an additional service on the OmniKassa called the Merchant Services. These merchant services make it able to perform refunds and download/view transactions. The integration however is entirely different, so thats what we are currently working on.

So it will come in an update in the near future.

https://wordpress.org/support/topic/returning-payments/#post-14029310

Hello Nico,

To give you an update, the Rabobank has an API which you can use for the refunds. We could integrate that, however they are going to move the functionality to the OmniKassa itself. Therefor the integration changes and how we integrate it in the plug-in. Once the changes have been made, we will update the plug-in with the functionality.

https://wordpress.org/support/topic/returning-payments/#post-14340323

Did some research and found: https://developer.rabobank.nl/reference/omnikassa-merchant-services-api/2-4-0-0.

developer rabobank nl_reference_omnikassa-merchant-services-api_2-4-0-0

POST https://api.rabobank.nl/openapi/omnikassa/merchant/transactions/{transactionId}/refunds Use this endpoint to initiate a refund for a payment transaction.

rvdsteege commented 3 years ago

however they are going to move the functionality to the OmniKassa itself

I'd suggest waiting for the OmniKassa functionality, instead of integrating with merchant services.

remcotolsma commented 1 year ago

This seems to be available now:

$url = 'https://betalen.rabobank.nl/omnikassa-api-sandbox/order/server/api/v2/refund/transactions/8b7ed296-929a-408d-96c5-a8ca052f7117/refunds';

$test = wp_remote_post(
    $url,
    [ 
        'method'  => 'POST',
        'headers' => [
            'Authorization' => 'Bearer ' . $this->config->access_token,
            'Request-ID'    => '9fd4eb02-84da-11ec-a9f1-973e359e11c9',
            'Accept'        => 'application/json',
            'Content-Type'  => 'application/json',
        ],
        'body'   => \wp_json_encode(
            (object) [
                'money' => (object) [
                    'amount'   => 100,
                    'currency' => 'EUR',
                ],
                'description' => 'Test',
            ]
        ),
        'timeout' => 30,
    ]
);

var_dump( $test );

https://developer.rabobank.nl/product/9773/api/9770#/RaboSmartPayOnlinePaymentAPI_1013/operation/%2Forder%2Fserver%2Fapi%2Fv2%2Frefund%2Ftransactions%2F{transaction_id}%2Frefunds/post

{"refundId":"c131f4c1-40aa-4ac3-92f4-25b144301000","refundTransactionId":"ed276ae0-f54f-4f23-b7c8-4657ad0f28d2","createdAt":"2023-02-06T15:18:44.607Z","updatedAt":null,"vatCategory":"LOW","paymentBrand":"VISA","status":"PENDING","description":"Description","transactionId":"8b7ed296-929a-408d-96c5-a8ca052f7117","refundMoney":{"currency":"EUR","amount":"100"}}