You appear to be a bot. Output may be restricted
Description
Set up and store a payment record from a CSV row
Usage
$void = EDD_Batch_Payments_Import::create_payment( $row );
Parameters
- $row
- ( mixed ) optional –
Returns
void
Source
File name: easy-digital-downloads/includes/admin/import/class-batch-import-payments.php
Lines:
101 to 200 of 260
if( ! empty( $this->field_mapping['transaction_id'] ) && ! empty( $row[ $this->field_mapping['transaction_id'] ] ) ) { $payment->transaction_id = sanitize_text_field( $row[ $this->field_mapping['transaction_id'] ] ); } if( ! empty( $this->field_mapping['ip'] ) && ! empty( $row[ $this->field_mapping['ip'] ] ) ) { $payment->ip = sanitize_text_field( $row[ $this->field_mapping['ip'] ] ); } if( ! empty( $this->field_mapping['gateway'] ) && ! empty( $row[ $this->field_mapping['gateway'] ] ) ) { $gateways = edd_get_payment_gateways(); $gateway = strtolower( sanitize_text_field( $row[ $this->field_mapping['gateway'] ] ) ); if( ! array_key_exists( $gateway, $gateways ) ) { foreach( $gateways as $key => $enabled_gateway ) { if( $enabled_gateway['checkout_label'] == $gateway ) { $gateway = $key; break; } } } $payment->gateway = $gateway; } if( ! empty( $this->field_mapping['currency'] ) && ! empty( $row[ $this->field_mapping['currency'] ] ) ) { $payment->currency = strtoupper( sanitize_text_field( $row[ $this->field_mapping['currency'] ] ) ); } if( ! empty( $this->field_mapping['key'] ) && ! empty( $row[ $this->field_mapping['key'] ] ) ) { $payment->key = sanitize_text_field( $row[ $this->field_mapping['key'] ] ); } if( ! empty( $this->field_mapping['parent_payment_id'] ) && ! empty( $row[ $this->field_mapping['parent_payment_id'] ] ) ) { $payment->parent_payment_id = absint( $row[ $this->field_mapping['parent_payment_id'] ] ); } if( ! empty( $this->field_mapping['downloads'] ) && ! empty( $row[ $this->field_mapping['downloads'] ] ) ) { if( __( 'Products (Raw)', 'easy-digital-downloads' ) == $this->field_mapping['downloads'] ) { // This is an EDD export so we can extract prices $downloads = $this->get_downloads_from_edd( $row[ $this->field_mapping['downloads'] ] ); } else { $downloads = $this->str_to_array( $row[ $this->field_mapping['downloads'] ] ); } if( is_array( $downloads ) ) { $download_count = count( $downloads ); foreach( $downloads as $download ) { if( is_array( $download ) ) { $download_name = $download['download']; $price = $download['price']; $tax = $download['tax']; $price_id = $download['price_id']; } else { $download_name = $download; } $download_id = $this->maybe_create_download( $download_name ); if( ! $download_id ) { continue; } $item_price = ! isset( $price ) ? edd_get_download_price( $download_id ) : $price; $item_tax = ! isset( $tax ) ? ( $download_count > 1 ? 0.00 : $payment->tax ) : $tax; $price_id = ! isset( $price_id ) ? false : $price_id; $args = array( 'item_price' => $item_price, 'tax' => $item_tax, 'price_id' => $price_id, ); $payment->add_download( $download_id, $args );