<?php
use PaymentWebhooks\Infrastructure\Config;

return [
    'log_enabled' => (bool) Config::get('PW_PAYPAL_LOG', false),
    'status_map'  => [
        // PayPal webhook payload event_type => WooCommerce status
        'CHECKOUT.ORDER.APPROVED' => null, // No change WC status. There will be next event (PAYMENT.CAPTURE.COMPLETED) to change.
        'PAYMENT.CAPTURE.COMPLETED' => 'processing', // tests
        'PAYMENT.CAPTURE.REFUNDED' => 'refunded', // tests
        'PAYMENT.CAPTURE.DENIED' => 'failed', // ??
        'CUSTOMER.DISPUTE.CREATED' => 'on-hold', // logs and WC cases
    ],
    'json_fields' => [
        'order_id' => 'resource.invoice_id',
        'event' => 'event_type',
        // payment data field
        'transaction_id' => 'resource.id'
    ],
    // Payment update block
    'payment_collect_data_trigger' => [
        'event' => 'PAYMENT.CAPTURE.COMPLETED',
    ],
    'payment_data' => [
        'method' => 'nuxt_paypal',
        'title'  => 'PayPal',
    ],
];
