PagamentoCerto
[ class tree: PagamentoCerto ] [ index: PagamentoCerto ] [ all elements ]

Class: Payment_PagamentoCerto_Order

Source Location: /Payment_PagamentoCerto-0.2.3/Payment/PagamentoCerto/Order.php

Class Overview


Class representing an Order


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 35]
Class representing an Order

This class provides an easy-to-use collection of methods that will help with the process of submitting an order to the payment gateway. It works as a shopping cart, so you add products, select payment method, collect buyer information, apply discounts and calculate the total amount of the order.

When you want to begin a transaction with the payment gateway, an instance of this class is one of the parameters, since it will contain all the order information.



[ Top ]


Class Variables

$buyerInfo = array()

[line 94]

Array containing the buyer's personal info
  • Access: protected

Type:   mixed


[ Top ]

$buyerType =

[line 66]

Buyer type
  • Access: protected

Type:   mixed


[ Top ]

$orderId =

[line 125]

The order ID
  • Access: protected

Type:   mixed


[ Top ]

$otherCharges =

[line 118]

Additional charges of the order
  • Access: protected

Type:   mixed


[ Top ]

$paymentMethod =

[line 80]

Selected payment method
  • Access: protected

Type:   mixed


[ Top ]

$products = array()

[line 87]

Array contaning all the products of the order
  • Access: protected

Type:   mixed


[ Top ]

$shippingAddress = array()

[line 101]

Array containing shipping ingo
  • Access: protected

Type:   mixed


[ Top ]

$shippingValue =

[line 73]

Shipping value for the order
  • Access: protected

Type:   mixed


[ Top ]

$supportedPaymentMethods = array(
        self::PAYMENT_METHOD_INVOICE,
        self::PAYMENT_METHOD_CC_VISA
    )

[line 108]

Array describing current payment methods
  • Access: protected

Type:   mixed


[ Top ]



Method Detail

__construct (Constructor)   [line 131]

Payment_PagamentoCerto_Order __construct( )

Class constructor
  • Access: public

[ Top ]

addProduct   [line 245]

void addProduct( string $id, string $description, int $quantity, float $value)

Adds a product to the shopping cart
  • Access: public

Parameters:

string   $id   —  Product ID
string   $description   —  Short description of the product
int   $quantity   —  Number of items for this product
float   $value   —  Product value

[ Top ]

applyDiscount   [line 526]

int|float applyDiscount( int|float $value)

Applies discount to a given value and returns the result
  • Access: public

Parameters:

int|float   $value   —  Discount value

[ Top ]

applyDiscountPercentage   [line 582]

int|float applyDiscountPercentage( int|float $value)

Applies a discount set as a percentage
  • Access: protected

Parameters:

int|float   $value   —  Value that will recieve the discount

[ Top ]

applyDiscountValue   [line 564]

int|float applyDiscountValue( int|float $value)

Applies a flat value discount and returns the result
  • Access: protected

Parameters:

int|float   $value   —  Value that will recieve the discount

[ Top ]

getBillingAddress   [line 381]

array getBillingAddress( )

Returns the billing information
  • Access: public

[ Top ]

getBuyerInfo   [line 201]

array getBuyerInfo( )

Returns an array containing the buyer's personal info
  • Access: public

[ Top ]

getBuyerType   [line 211]

int getBuyerType( )

Returns the buyer type
  • Access: public

[ Top ]

getCalculatedDiscount   [line 595]

int|float getCalculatedDiscount( )

Applies the discount to the order sub total and returns the result
  • Access: public

[ Top ]

getDiscountType   [line 701]

int getDiscountType( )

Returns the discount type
  • Access: public

[ Top ]

getDiscountValue   [line 711]

int|float getDiscountValue( )

Returns the discount value
  • Access: public

[ Top ]

getOrderId   [line 158]

int getOrderId( )

Returns the order ID
  • Access: public

[ Top ]

getOrderSubTotal   [line 489]

float getOrderSubTotal( )

Returns the sub total of the order (only product values)
  • Access: public

[ Top ]

getOtherCharges   [line 479]

float getOtherCharges( )

Returns the additional charges value
  • Access: public

[ Top ]

getPaymentMethod   [line 415]

int getPaymentMethod( )

Returns the payment method
  • Access: public

[ Top ]

getProductQuantity   [line 337]

int getProductQuantity( string $id)

Returns the current quantity for the specified product
  • Access: public

Parameters:

string   $id   —  Product ID

[ Top ]

getProducts   [line 309]

array getProducts( )

Returns an array of all the products of the order
  • Access: public

[ Top ]

getProductTotalAmount   [line 321]

float getProductTotalAmount( string $id)

Returns the total amount for a specified product
  • Access: public

Parameters:

string   $id   —  Product ID

[ Top ]

getShippingAddress   [line 425]

array getShippingAddress( )

Returns the shipping info of the order
  • Access: public

[ Top ]

getShippingValue   [line 435]

float getShippingValue( )

Returns the shipping value
  • Access: public

[ Top ]

getTotalAmount   [line 507]

int|float getTotalAmount( )

Returns the final total amount of the order

Calculates: products, shipping, other charges and discount

  • Access: public

[ Top ]

setAddress   [line 724]

void setAddress( int $addressType, [array $addressInfo = array()])

Sets address information based on $addressType
  • Access: protected

Parameters:

int   $addressType   —  The address type (use a class constant)
array   $addressInfo   —  Array containing the address

[ Top ]

setBillingAddress   [line 368]

void setBillingAddress( [array $billingAddress = array()])

Sets the billing information
  • Access: public

Parameters:

array   $billingAddress   —  Array containing billing info

[ Top ]

setBuyerInfo   [line 171]

void setBuyerInfo( array $buyerInfo, [string $buyerType = self::BUYER_TYPE_PERSON])

Sets all buyer-related info, except for shipping
  • Access: public

Parameters:

array   $buyerInfo   —  Array containing the buyer's personal info
string   $buyerType   —  The buyer type (use a class constant)

[ Top ]

setDiscount   [line 609]

void setDiscount( float|int $discount, [int $discountType = self::DISCOUNT_TYPE_VALUE])

Sets discount for the order
  • Access: public

Parameters:

float|int   $discount   —  Discount value
int   $discountType   —  Discount type (use a class constant)

[ Top ]

setDiscountPercentage   [line 677]

void setDiscountPercentage( int|float $discount)

Defines the discount as percentage
  • Access: public

Parameters:

int|float   $discount   —  Discount percentage

[ Top ]

setDiscountValue   [line 643]

void setDiscountValue( int|float $discount)

Defines the discount as a flat value
  • Access: public

Parameters:

int|float   $discount   —  Discount value

[ Top ]

setOrderId   [line 143]

void setOrderId( int $id)

Defines the order ID
  • Access: public

Parameters:

int   $id   —  Order id

[ Top ]

setOtherCharges   [line 464]

void setOtherCharges( float $value)

Defines additional charges for the order
  • Access: public

Parameters:

float   $value   —  Additional charges

[ Top ]

setPaymentMethod   [line 223]

void setPaymentMethod( int $paymentMethod)

Sets the payment info
  • Access: public

Parameters:

int   $paymentMethod   —  The selected payment method (use a class constant)

[ Top ]

setPaymentMethodAsCreditCardVisa   [line 403]

void setPaymentMethodAsCreditCardVisa( )

Sets the payment method as VISA credit card
  • Access: public

[ Top ]

setPaymentMethodAsInvoice   [line 391]

void setPaymentMethodAsInvoice( )

Sets the payment method as invoice
  • Access: public

[ Top ]

setShippingAddress   [line 353]

void setShippingAddress( [array $shippingAddress = array()])

Sets the shipping info
  • Access: public

Parameters:

array   $shippingAddress   —  Array containing shipping info

[ Top ]

setShippingValue   [line 447]

void setShippingValue( float $value)

Defines the shipping value for the order
  • Access: public

Parameters:

float   $value   —  Shipping value

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:36:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.