Order Tab

I am working on ecommerce website for medical health care company.Here i am using Group Buying plugin for payment integration with the paypal option.

Client wants a EBS payment gateway integration but there is no plugin available which will be suit with Group buying plugin.There is woocommerce plugin with EBS payment gateway integration but that plugin not usable for me due to Group Buying Plugin.

I have completed the setup of php ebs integration kit v 2.5 which is core php.Here i have passed all values like Price of product to EBS and its working good and getting return response with successful transaction.

The problem is that i have to save that EBS response array value like in the same way that group Buying is saving.so it will display both payment value in back end under the tab of Payment and Order like bellow snipe shot.

Payment Tab:-

Order Tab:-

Order Tab

Group Buying plugin using bellow function to capture payment.I have searched lot how the group buy plugin storing the value of payment but i am not getting any thing because they are using lots of hooks and filter.

public  function capture_payment( Group_Buying_Payment $payment ) {
        // is this the right payment processor? does the payment still need processing?
        if ( $payment->get_payment_method() == $this->get_payment_method() && $payment->get_status() != Group_Buying_Payment::STATUS_COMPLETE ) {
            $data = $payment->get_data();
            // Do we have a transaction ID to use for the capture?
            if ( isset( $data['api_response']['PAYMENTINFO_0_TRANSACTIONID'] ) && $data['api_response']['PAYMENTINFO_0_TRANSACTIONID'] ) {
                $transaction_id = $data['api_response']['PAYMENTINFO_0_TRANSACTIONID'];
                $items_to_capture = $this->items_to_capture( $payment );
                if ( $items_to_capture ) {
                    $status = ( count( $items_to_capture ) < count( $data['uncaptured_deals'] ) )?'NotComplete':'Complete';
                    $post_data = $this->capture_nvp_data( $transaction_id, $items_to_capture, $status );
                    do_action( 'gb_log', __CLASS__ . '::' . __FUNCTION__ . ' - PayPal EC DoCapture Request', $post_data );
                    $response = wp_remote_post( $this->get_api_url(), array(
                            'httpversion' => '1.1',
                            'body' => $post_data,
                            'timeout' => apply_filters( 'http_request_timeout', 15 ),
                            'sslverify' => false
                        ) );
                    if ( !is_wp_error( $response ) && $response['response']['code'] == '200' ) {
                        $response = wp_parse_args( wp_remote_retrieve_body( $response ) );
                        do_action( 'gb_log', __CLASS__ . '::' . __FUNCTION__ . ' - PayPal EC DoCapture Response', $response );
                        if ( strpos( $response['ACK'], 'Success' ) === 0 ) {
                            foreach ( $items_to_capture as $deal_id => $amount ) {
                                unset( $data['uncaptured_deals'][$deal_id] );
                            }
                            if ( !isset( $data['capture_response'] ) ) {
                                $data['capture_response'] = array();
                            }
                            $data['capture_response'][] = $response;
                            $payment->set_data( $data );
                            do_action( 'payment_captured', $payment, array_keys( $items_to_capture ) );
                            if ( $status == 'Complete' ) {
                                $payment->set_status( Group_Buying_Payment::STATUS_COMPLETE );
                                do_action( 'payment_complete', $payment );
                            } else {
                                $payment->set_status( Group_Buying_Payment::STATUS_PARTIAL );
                            }
                        } else {
                            $error = array(
                                    'items_to_capture' => $items_to_capture,
                                    'payment_id' => $payment->get_id(),
                                    'response' => $response,
                                );
                            do_action( 'gb_error', __CLASS__ . '::' . __FUNCTION__ . ' - capture response error', $error );
                            // authorization expired or authorization complete
                            if ( $response['L_ERRORCODE0'] == 10601 || 10602 ) { 
                                $payment->set_status(Group_Buying_Payment::STATUS_VOID);
                            }
                        }
                    }
                }
            }
            // Check if the payment date is older than 120 days
            if ( get_post_time( 'U', FALSE, $payment->get_id() ) < ( time() - ( apply_filters( 'gb_void_old_pending_payments_age', 60*60*24*120 ) ) ) ) {
                // Void payment since it can't be captured at this point.
                $payment->set_status( Group_Buying_Payment::STATUS_VOID );
            }
        }
    }

I have to save the EBS payment gateway return response array value like bellow table structure like Group buying plugin transaction inserting in table of wp_postmeta.
after inserting the EBS value in above table it will display both payment gateway transaction details in the back end under the group buying tab of Order and Payment.

Here you can see that group buying saving subtotal,deal id, in wp_postmeta table.
Order table

Read more here: EBS payment gateway integration with Group Buying plugin


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , ,

Wordpress related questions and answers: