PHP 클래스 Give_Payment, Give

This class is for working with payments in Give.
부터: 1.5
파일 보기 프로젝트 열기: wordimpress/give 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$ID integer The Payment ID.

보호된 프로퍼티들

프로퍼티 타입 설명
$_ID integer Protected non-read $_ID.
$address array The physical address used for the payment if provided
$completed_date string The date the payment was marked as 'complete'.
$currency string The the payment was made with
$customer_id integer The customer ID that made the payment
$date string The date the payment was created
$email string The email used for the payment
$fees array Array of global fees for this payment
$fees_total float The sum of the fee amounts
$first_name string The first name of the payee
$form_id string The Donation Form ID
$form_title string The Donation Form Title
$gateway string The gateway used to process the payment
$ip string IP Address payment was made from
$key string The unique donation payment key.
$last_name string The last name of the payee
$mode string The Gateway mode the payment was made in.
$new boolean Identify if the payment is a new one or existing.
$number string The Payment number (for use with sequential payments).
$old_status string When updating, the old status prior to the change
$parent_payment integer The parent payment (if applicable)
$post_date string The date the payment post was created.
$post_status string
$price_id string | integer The Donation Form Price ID
$status string The status of the donation payment.
$status_nicename string The display name of the current payment status.
$subtotal float The Subtotal fo the payment before fees
$total float Includes donation amount and fees.
$transaction_id string The transaction ID returned by the gateway
$user_id integer The User ID (if logged in) that made the payment

공개 메소드들

메소드 설명
__construct ( integer $payment_id = false ) : mixed Setup the Give Payments class
__get ( string $key ) : mixed Magic GET function.
__isset ( string $name ) : boolean Magic ISSET function, which allows empty checks on protected elements
__set ( string $key, mixed $value ) Magic SET function
add_donation ( integer $form_id, array $args = [], array $options = [] ) : boolean Add a donation to a given payment
add_fee ( array $args, boolean $global = true ) : boolean Add a fee to a given payment
add_note ( string $note = false ) : void Add a note to a payment
array_convert ( ) : array Converts this object into an array for special cases
get_fees ( string $type = 'all' ) : array Get the fees, filterable by type
get_meta ( string $meta_key = '_give_payment_meta', boolean $single = true ) : mixed Get a post meta item for the payment
refund ( ) : void Change the status of the payment to refunded, and run the necessary changes
remove_donation ( integer $form_id, array $args = [] ) : boolean Remove a donation from the payment
remove_fee ( integer $key ) : boolean Remove a fee from the payment
remove_fee_by ( string $key, integer | string $value, boolean $global = false ) : boolean Remove a fee by the defined attributed
save ( ) : boolean Save
update_meta ( string $meta_key = '', string $meta_value = '', string $prev_value = '' ) : integer | boolean Update the post meta
update_payment_setup ( integer $payment_id ) : void Payment class object is storing various meta value in object parameter.
update_status ( string $status = false ) : boolean Set the payment status and run any status specific changes necessary.

비공개 메소드들

메소드 설명
decrease_fees ( float $amount ) : void Decrease the payment's subtotal.
decrease_subtotal ( float $amount ) : void Decrease the payment's subtotal.
delete_sales_logs ( ) : void Delete sales logs for this purchase
get_address ( ) : array Retrieve payment billing address
get_completed_date ( ) : string Retrieve payment completion date
get_currency ( ) : string Retrieve payment currency
get_customer_id ( ) : integer Retrieve payment customer ID
get_email ( ) : string Retrieve payment email
get_form_id ( ) : string Retrieve payment form id
get_gateway ( ) : string Retrieve payment gateway
get_ip ( ) : string Retrieve payment IP
get_key ( ) : string Retrieve payment key
get_number ( ) : integer | string Retrieve payment number
get_subtotal ( ) : float Retrieve payment subtotal
get_transaction_id ( ) : string Retrieve payment transaction ID
get_user_id ( ) : integer Retrieve payment user ID
get_user_info ( ) : array Retrieve payment user info
increase_fees ( float $amount ) : void Increase the payment's subtotal.
increase_subtotal ( float $amount ) : void Increase the payment's subtotal
insert_payment ( ) : integer | boolean Create the base of a payment.
maybe_alter_stats ( boolean $alter_store_earnings, boolean $alter_customer_value, boolean $alter_customer_purchase_count ) : void Used during the process of moving to refunded or pending, to decrement stats
process_cancelled ( ) : void Process when a payment moves to cancelled
process_failure ( ) : void Process when a payment is set to failed
process_pending ( ) : void Process when a payment moves to pending
process_refund ( ) : void When a payment is set to a status of 'refunded' process the necessary actions to reduce stats
process_revoked ( ) : void Process when a payment moves to revoked
recalculate_total ( ) : void Set or update the total for a payment.
setup_address ( ) : array Setup the Address for the payment
setup_completed_date ( ) : string Setup the payment completed date
setup_currency ( ) : string Setup the currency code
setup_customer_id ( ) : integer Setup the customer ID
setup_email ( ) : string Setup the email address for the donation.
setup_fees ( ) : array Setup any fees associated with the payment
setup_fees_total ( ) : float Setup the payment fees
setup_form_id ( ) : integer Setup the form ID
setup_form_title ( ) : string Setup the form title
setup_gateway ( ) : string Setup the gateway used for the payment
setup_ip ( ) : string Setup the IP Address for the payment
setup_mode ( ) : string Setup the payment mode
setup_payment ( integer $payment_id ) : boolean Setup payment properties
setup_payment_key ( ) : string Setup the payment key
setup_payment_number ( ) : integer | string Setup the payment number
setup_price_id ( ) : integer Setup the price ID
setup_subtotal ( ) : float Setup the payment subtotal
setup_total ( ) : float Setup the payment total
setup_transaction_id ( ) : string Setup the transaction ID
setup_user_id ( ) : integer Setup the User ID associated with the purchase
setup_user_info ( ) : array Setup the user info

메소드 상세

__construct() 공개 메소드

Setup the Give Payments class
부터: 1.0
public __construct ( integer $payment_id = false ) : mixed
$payment_id integer A given payment
리턴 mixed void|false

__get() 공개 메소드

Magic GET function.
부터: 1.5
public __get ( string $key ) : mixed
$key string The property.
리턴 mixed The value.

__isset() 공개 메소드

Magic ISSET function, which allows empty checks on protected elements
부터: 1.5
public __isset ( string $name ) : boolean
$name string The attribute to get
리턴 boolean If the item is set or not

__set() 공개 메소드

Sets up the pending array for the save method
부터: 1.5
public __set ( string $key, mixed $value )
$key string The property name
$value mixed The value of the property

add_donation() 공개 메소드

Add a donation to a given payment
부터: 1.5
public add_donation ( integer $form_id, array $args = [], array $options = [] ) : boolean
$form_id integer The donation form to add
$args array Other arguments to pass to the function
$options array List of donation options
리턴 boolean True when successful, false otherwise

add_fee() 공개 메소드

Add a fee to a given payment
부터: 1.5
public add_fee ( array $args, boolean $global = true ) : boolean
$args array Array of arguments for the fee to add
$global boolean
리턴 boolean If the fee was added

add_note() 공개 메소드

Add a note to a payment
부터: 1.0
public add_note ( string $note = false ) : void
$note string The note to add
리턴 void

array_convert() 공개 메소드

Converts this object into an array for special cases
public array_convert ( ) : array
리턴 array The payment object as an array

get_fees() 공개 메소드

Get the fees, filterable by type
부터: 1.5
public get_fees ( string $type = 'all' ) : array
$type string All, item, fee
리턴 array The Fees for the type specified

get_meta() 공개 메소드

Get a post meta item for the payment
부터: 1.5
public get_meta ( string $meta_key = '_give_payment_meta', boolean $single = true ) : mixed
$meta_key string The Meta Key
$single boolean Return single item or array
리턴 mixed The value from the post meta

refund() 공개 메소드

Change the status of the payment to refunded, and run the necessary changes
부터: 1.5
public refund ( ) : void
리턴 void

remove_donation() 공개 메소드

Remove a donation from the payment
부터: 1.5
public remove_donation ( integer $form_id, array $args = [] ) : boolean
$form_id integer The form ID to remove
$args array Arguments to pass to identify (quantity, amount, price_id)
리턴 boolean If the item was removed or not

remove_fee() 공개 메소드

Remove a fee from the payment
부터: 1.5
public remove_fee ( integer $key ) : boolean
$key integer The array key index to remove
리턴 boolean If the fee was removed successfully

remove_fee_by() 공개 메소드

Remove a fee by the defined attributed
부터: 1.5
public remove_fee_by ( string $key, integer | string $value, boolean $global = false ) : boolean
$key string The key to remove by
$value integer | string The value to search for
$global boolean False - removes the first value it fines, True - removes all matches.
리턴 boolean If the item is removed

save() 공개 메소드

Once items have been set, an update is needed to save them to the database.
public save ( ) : boolean
리턴 boolean True of the save occurred, false if it failed or wasn't needed

update_meta() 공개 메소드

Update the post meta
부터: 1.5
public update_meta ( string $meta_key = '', string $meta_value = '', string $prev_value = '' ) : integer | boolean
$meta_key string The meta key to update
$meta_value string The meta value
$prev_value string Previous meta value
리턴 integer | boolean Meta ID if the key didn't exist, true on successful update, false on failure

update_payment_setup() 공개 메소드

So if user is updating payment meta but not updating payment object, then payment meta values will not reflect/changes on payment meta automatically and you can still access payment meta old value in any old payment object ( previously created ) which can cause to show or save wrong payment data. To prevent that user can use this function after updating any payment meta value ( in bulk or single update ).
부터: 1.6
public update_payment_setup ( integer $payment_id ) : void
$payment_id integer Payment ID.
리턴 void

update_status() 공개 메소드

Set the payment status and run any status specific changes necessary.
부터: 1.0
public update_status ( string $status = false ) : boolean
$status string The status to set the payment to.
리턴 boolean $updated Returns if the status was successfully updated.

프로퍼티 상세

$ID 공개적으로 프로퍼티

The Payment ID.
부터: 1.5
public int $ID
리턴 integer

$_ID 보호되어 있는 프로퍼티

Protected non-read $_ID.
protected int $_ID
리턴 integer

$address 보호되어 있는 프로퍼티

The physical address used for the payment if provided
부터: 1.5
protected array $address
리턴 array

$completed_date 보호되어 있는 프로퍼티

The date the payment was marked as 'complete'.
부터: 1.5
protected string $completed_date
리턴 string

$currency 보호되어 있는 프로퍼티

The the payment was made with
부터: 1.5
protected string $currency
리턴 string

$customer_id 보호되어 있는 프로퍼티

The customer ID that made the payment
부터: 1.5
protected int $customer_id
리턴 integer

$date 보호되어 있는 프로퍼티

The date the payment was created
부터: 1.5
protected string $date
리턴 string

$email 보호되어 있는 프로퍼티

The email used for the payment
부터: 1.5
protected string $email
리턴 string

$fees 보호되어 있는 프로퍼티

Array of global fees for this payment
부터: 1.5
protected array $fees
리턴 array

$fees_total 보호되어 있는 프로퍼티

The sum of the fee amounts
부터: 1.5
protected float $fees_total
리턴 float

$first_name 보호되어 있는 프로퍼티

The first name of the payee
부터: 1.5
protected string $first_name
리턴 string

$form_id 보호되어 있는 프로퍼티

The Donation Form ID
부터: 1.5
protected string $form_id
리턴 string

$form_title 보호되어 있는 프로퍼티

The Donation Form Title
부터: 1.5
protected string $form_title
리턴 string

$gateway 보호되어 있는 프로퍼티

The gateway used to process the payment
부터: 1.5
protected string $gateway
리턴 string

$ip 보호되어 있는 프로퍼티

IP Address payment was made from
부터: 1.5
protected string $ip
리턴 string

$key 보호되어 있는 프로퍼티

The unique donation payment key.
부터: 1.5
protected string $key
리턴 string

$last_name 보호되어 있는 프로퍼티

The last name of the payee
부터: 1.5
protected string $last_name
리턴 string

$mode 보호되어 있는 프로퍼티

The Gateway mode the payment was made in.
부터: 1.5
protected string $mode
리턴 string

$new 보호되어 있는 프로퍼티

Identify if the payment is a new one or existing.
부터: 1.5
protected bool $new
리턴 boolean

$number 보호되어 있는 프로퍼티

The Payment number (for use with sequential payments).
부터: 1.5
protected string $number
리턴 string

$old_status 보호되어 있는 프로퍼티

When updating, the old status prior to the change
부터: 1.5
protected string $old_status
리턴 string

$parent_payment 보호되어 있는 프로퍼티

The parent payment (if applicable)
부터: 1.5
protected int $parent_payment
리턴 integer

$post_date 보호되어 있는 프로퍼티

The date the payment post was created.
protected string $post_date
리턴 string

$post_status 보호되어 있는 프로퍼티

protected string $post_status
리턴 string

$price_id 보호되어 있는 프로퍼티

The Donation Form Price ID
부터: 1.5
protected string|int $price_id
리턴 string | integer

$status 보호되어 있는 프로퍼티

The status of the donation payment.
부터: 1.5
protected string $status
리턴 string

$status_nicename 보호되어 있는 프로퍼티

The display name of the current payment status.
부터: 1.5
protected string $status_nicename
리턴 string

$subtotal 보호되어 있는 프로퍼티

The Subtotal fo the payment before fees
부터: 1.5
protected float $subtotal
리턴 float

$total 보호되어 있는 프로퍼티

Includes donation amount and fees.
부터: 1.5
protected float $total
리턴 float

$transaction_id 보호되어 있는 프로퍼티

The transaction ID returned by the gateway
부터: 1.5
protected string $transaction_id
리턴 string

$user_id 보호되어 있는 프로퍼티

The User ID (if logged in) that made the payment
부터: 1.5
protected int $user_id
리턴 integer