package com.intershop.adapter.payment.partnerpay.internal.service.capture;

import java.util.Map;

import javax.inject.Inject;

import com.intershop.adapter.payment.partnerpay.capi.operations.capture.CaptureOperation;
import com.intershop.adapter.payment.partnerpay.capi.operations.capture.CaptureRequest;
import com.intershop.adapter.payment.partnerpay.capi.operations.capture.CaptureResponse;
import com.intershop.api.data.common.v1.Money;
import com.intershop.api.data.common.v1.changeable.StringAttribute;
import com.intershop.api.data.payment.v1.PaymentContext;
import com.intershop.api.service.common.v1.Result;
import com.intershop.api.service.payment.v1.Payable;
import com.intershop.api.service.payment.v1.capability.Capture;
import com.intershop.api.service.payment.v1.result.CaptureResult;

public class CaptureImpl implements Capture
{
    @Inject
    private CaptureOperation captureOperation;

    @Override
    public Result<CaptureResult> capture(PaymentContext context, Payable payable, Money captureAmount)
    {
        Result<CaptureResult> res = new Result<CaptureResult>(new CaptureResult());

        // requests and responses
        CaptureRequest captureRequest = new CaptureRequest().setPaymentTransaction(context.getPaymentTransaction());
        CaptureResponse captureResponse = captureOperation.execute(captureRequest);

        // store history
        String captureId = captureResponse.getCaptureId();
        res.getOutput().put(new StringAttribute("CaptureID", captureId));

        res.setState(Result.SUCCESS);

        return res;
    }

    @Override
    public Result<CaptureResult> onCaptureNotification(PaymentContext context, Payable payable,
                    Map<String, Object> parameters)
    {
        Result<CaptureResult> result = new Result<CaptureResult>(new CaptureResult());
        result.setState("Failure");
        result.addError("CaptureNotificationsNotSupported", "{payment.error.CaptureNotificationsNotSupported}");

        return result;
    }
}

@@ -73,31 +73,8 @@
 e;%0A%0A
-import java.util.Map;%0A%0A
 impo
@@ -1549,442 +1549,7 @@
    %7D
-%0A%0A    @Override%0A    public Result%3CCaptureResult%3E onCaptureNotification(PaymentContext context, Payable payable,%0A                    Map%3CString, Object%3E parameters)%0A    %7B%0A        Result%3CCaptureResult%3E result = new Result%3CCaptureResult%3E(new CaptureResult());%0A        result.setState(%22Failure%22);%0A        result.addError(%22CaptureNotificationsNotSupported%22, %22%7Bpayment.error.CaptureNotificationsNotSupported%7D%22);%0A%0A        return result;%0A    %7D
 %0A%7D%0A

Fix unnecessary override