public function parseReserveResource(ResourceModel $resource)
    {
        $intent = $resource->getIntent();
        $customer = $resource->getCustomer();
        $transaction = $resource->getTransaction();
        $amount = $transaction->getAmount();
        $total = Formatter::formatToInteger($amount->getTotal());
        $payuReference = $resource->getPayUReference() ?: $resource->getReturn()->getPayUReference();
        $merchantReference = $resource->getMerchantReference() ?: $resource->getReturn()->getMerchantReference();

        $payload = array(
            'TransactionType' => strtoupper($resource->intent),
            'AdditionalInformation' => array(
                'merchantReference' => $merchantReference,
                'payUReference' => $payuReference
            ),
            'Basket' => array(
                'currencyCode' => $amount->currency,
                'amountInCents' => $total
            ),
        );


        if ($intent === Transaction::TYPE_FINALIZE) {
            $paymentMethod = $customer->getPaymentMethod();
            if ($paymentMethod && PaymentMethod::TYPE_CREDITCARD == $paymentMethod) {
                $payload = array_merge($payload, array(
                    'Creditcard' => array(
                        'amountInCents' => $total
                    )
                ));
            }
        }

        return $payload;
    }
public function parseReserveResource(ResourceModel $resource)
    {
        $intent = $resource->getIntent();
        $customer = $resource->getCustomer();
        $transaction = $resource->getTransaction();
        $amount = $transaction->getAmount();
        $total = Formatter::formatToInteger($amount->getTotal());
        $payuReference = $resource->getPayUReference() ?: $resource->getReturn()->getPayUReference();
        $merchantReference = $resource->getMerchantReference() ?: $resource->getReturn()->getMerchantReference();

        $payload = array(
            'TransactionType' => strtoupper($resource->intent),
            'AdditionalInformation' => array(
                'merchantReference' => $merchantReference,
                'payUReference' => $payuReference
            ),
            'Basket' => array(
                'currencyCode' => $amount->currency,
                'amountInCents' => $total
            ),
        );


        if ($intent === Transaction::TYPE_FINALIZE) {
            $paymentMethod = $customer->getPaymentMethod();
            if ($paymentMethod && PaymentMethod::TYPE_CREDITCARD == $paymentMethod) {
                $payload = array_merge($payload, array(
                    'Creditcard' => array(
                        'amountInCents' => $total
                    )
                ));
            }
        }

        return $payload;
    }
public function parseReserveResource ( ResourceModel $ resource ) { $ intent = $ resource -> getIntent ( ) ; $ customer = $ resource -> getCustomer ( ) ; $ transaction = $ resource -> getTransaction ( ) ; $ amount = $ transaction -> getAmount ( ) ; $ total = Formatter :: formatToInteger ( $ amount -> getTotal ( ) ) ; $ payuReference = $ resource -> getPayUReference ( ) ? : $ resource -> getReturn ( ) -> getPayUReference ( ) ; $ merchantReference = $ resource -> getMerchantReference ( ) ? : $ resource -> getReturn ( ) -> getMerchantReference ( ) ; $ payload = array ( 'TransactionType' => strtoupper ( $ resource -> intent ) , 'AdditionalInformation' => array ( 'merchantReference' => $ merchantReference , 'payUReference' => $ payuReference ) , 'Basket' => array ( 'currencyCode' => $ amount -> currency , 'amountInCents' => $ total ) , ) ; if ( $ intent === Transaction :: TYPE_FINALIZE ) { $ paymentMethod = $ customer -> getPaymentMethod ( ) ; if ( $ paymentMethod && PaymentMethod :: TYPE_CREDITCARD == $ paymentMethod ) { $ payload = array_merge ( $ payload , array ( 'Creditcard' => array ( 'amountInCents' => $ total ) ) ) ; } } return $ payload ; }
Parse a resource for void, credit, and capture transactions

@param ResourceModel $resource the payment resource

@return array $payload transaction payload for SOAP API request
Parse a resource for void credit and capture transactions