<?php

namespace IpagWoocommerce;

class TransactionCancelRequestTransformer extends TransactionInquiryRequestTransformer
{
    public function transform(array $request): array
    {
        $transformed = parent::transform($request);

        $transformed['method'] = 'POST';

        if (ArrUtils::exists($request, 'body.valor')) {
            $transformed['body'] = [
                'amount' => ArrUtils::get($request, 'body.valor'),
            ];
        }

        return $transformed;
    }
}