• Resolved andrej87

    (@andrej87)


    Dobry deň, potrebovali by sme pri prehodení na WC status ‘cancelled’ ozna?i? FA ako “will not be paid” cez SF API.

    Potrebovali by sme to ideálne nezávisle na tom, aky je nastaveny dátum splatnosti (v aplikácii SuperFaktúry je toti? mo?né prehodi? FA do “will not be paid” iba v prípade, ak uplynul termín splatnosti).

    V podstate to asi pojde analogicky, ako ste nám poradili pri inej príle?itosti, len potrebujem vedie?, ako to presne spravi?:

    function my_woocommerce_order_status_changed( $order_id, $old_status, $new_status )
    {
        if ( $new_status == 'cancelled' )
        {
            $order = wc_get_order( $order_id );
            $invoice_id = $order->get_meta( 'wc_sf_internal_regular_id', true );
            if ( ! $invoice_id ) {
                return;
            }
    
            $sf = WC_SuperFaktura::get_instance();
    	
    	 $response = $sf->sf_api()->... ? // AKO TO UROBIT? 
    
        }
    }
    add_action( 'woocommerce_order_status_changed', 'my_woocommerce_order_status_changed', 99, 3 );
Viewing 1 replies (of 1 total)
  • Plugin Author superfaktura

    (@superfaktura)

    Dobry deň,

    zmenu stavu faktúry na “will not be paid” pri zru?ení objednávky m??te spravi? takto:

    function my_woocommerce_order_status_changed( $order_id, $old_status, $new_status )
    {
        if ( $new_status == 'cancelled' )
        {
            $order = wc_get_order( $order_id );
            $invoice_id = $order->get_meta( 'wc_sf_internal_regular_id', true );
            if ( ! $invoice_id ) {
                return;
            }
    
            $sf = WC_SuperFaktura::get_instance();
            $response = $sf->sf_api()->get( '/invoices/will_not_be_paid/' . $invoice_id );
        }
    }
    add_action( 'woocommerce_order_status_changed', 'my_woocommerce_order_status_changed', 99, 3 );

    Celú dokumentáciu k API SuperFaktúry nájdete na https://github.com/superfaktura/docs/blob/master/invoice.md#set-invoice-as-will-not-be-paid

Viewing 1 replies (of 1 total)
  • The topic ‘Ozna?enie faktúry ako “will not be paid” cez API’ is closed to new replies.