Documentation ¶
Index ¶
- Constants
- type ChargeByItem
- func (c ChargeByItem) AddCartItem(id string, charge price.Charge) ChargeByItem
- func (c ChargeByItem) AddShippingItems(id string, charge price.Charge) ChargeByItem
- func (c ChargeByItem) AddTotalItem(id string, charge price.Charge) ChargeByItem
- func (c ChargeByItem) CartItems() map[string]price.Charge
- func (c ChargeByItem) ChargeForCartItem(itemid string) (*price.Charge, bool)
- func (c ChargeByItem) ChargeForDeliveryCode(itemid string) (*price.Charge, bool)
- func (c ChargeByItem) ChargeForTotal(itemid string) (*price.Charge, bool)
- func (c ChargeByItem) ShippingItems() map[string]price.Charge
- func (c ChargeByItem) TotalItems() map[string]price.Charge
- type CreditCardInfo
- type Payment
- type PlacedOrderInfo
- type PlacedOrderInfos
- type Service
- type Transaction
Constants ¶
const ( // PaymentStatusCaptured a payment which has been captured PaymentStatusCaptured = "CAPTURED" // PaymentStatusAuthorized a payment which has been AUTHORIZED PaymentStatusAuthorized = "AUTHORIZED" // PaymentStatusOpen payment is still open PaymentStatusOpen = "OPEN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChargeByItem ¶
type ChargeByItem struct {
// contains filtered or unexported fields
}
ChargeByItem - the Charge that is paid for the individual items
func (ChargeByItem) AddCartItem ¶
func (c ChargeByItem) AddCartItem(id string, charge price.Charge) ChargeByItem
AddCartItem modifies the current instance and adds a charge for a cart item
func (ChargeByItem) AddShippingItems ¶
func (c ChargeByItem) AddShippingItems(id string, charge price.Charge) ChargeByItem
AddShippingItems modifies the current instance and adds a charge for a shipping item
func (ChargeByItem) AddTotalItem ¶
func (c ChargeByItem) AddTotalItem(id string, charge price.Charge) ChargeByItem
AddTotalItem modifies the current instance and adds a charge for a total item
func (ChargeByItem) CartItems ¶
func (c ChargeByItem) CartItems() map[string]price.Charge
CartItems return CartItems
func (ChargeByItem) ChargeForCartItem ¶
func (c ChargeByItem) ChargeForCartItem(itemid string) (*price.Charge, bool)
ChargeForCartItem returns Charge for a cart item by id
func (ChargeByItem) ChargeForDeliveryCode ¶
func (c ChargeByItem) ChargeForDeliveryCode(itemid string) (*price.Charge, bool)
ChargeForDeliveryCode returns Charge for a shipping item by delivery code
func (ChargeByItem) ChargeForTotal ¶
func (c ChargeByItem) ChargeForTotal(itemid string) (*price.Charge, bool)
ChargeForTotal returns Charge for a total item by code
func (ChargeByItem) ShippingItems ¶
func (c ChargeByItem) ShippingItems() map[string]price.Charge
ShippingItems returns ShippingItems
func (ChargeByItem) TotalItems ¶
func (c ChargeByItem) TotalItems() map[string]price.Charge
TotalItems returns totalItems
type CreditCardInfo ¶
type CreditCardInfo struct { AnonymizedCardNumber string Type string CardHolder string Expire string }
CreditCardInfo contains the necessary data
type Payment ¶
type Payment struct { // The name of the Gateway that has returned the Payment for the cart Gateway string // Transactions is the list of individual transactions - most cases only one Transaction might be part of the payment Transactions []Transaction // RawTransactionData can be used to store any additional stuff (specific for Gateway) RawTransactionData interface{} // PaymentID is a optional reference of the Payment (that contains the Transactions) PaymentID string }
Payment represents all payments done for the cart and which items have been purchased by what method
func (*Payment) AddTransaction ¶
func (cp *Payment) AddTransaction(transaction Transaction)
AddTransaction for a paymentInfo with items
type PlacedOrderInfo ¶
PlacedOrderInfo defines the additional info struct for placed orders
type PlacedOrderInfos ¶
type PlacedOrderInfos []PlacedOrderInfo
PlacedOrderInfos represents a slice of PlacedOrderInfo
func (PlacedOrderInfos) GetOrderNumberForDeliveryCode ¶
func (poi PlacedOrderInfos) GetOrderNumberForDeliveryCode(deliveryCode string) string
GetOrderNumberForDeliveryCode returns the order number for a delivery code
type Service ¶
type Service interface { PlaceGuestCart(ctx context.Context, cart *cart.Cart, payment *Payment) (PlacedOrderInfos, error) PlaceCustomerCart(ctx context.Context, identity auth.Identity, cart *cart.Cart, payment *Payment) (PlacedOrderInfos, error) ReserveOrderID(ctx context.Context, cart *cart.Cart) (string, error) // CancelGuestOrder cancels a previously placed guest order and returns the used cart CancelGuestOrder(ctx context.Context, orderInfos PlacedOrderInfos) error // CancelCustomerOrder cancels a previously placed guest order and returns the used cart CancelCustomerOrder(ctx context.Context, orderInfos PlacedOrderInfos, identity auth.Identity) error }
Service interface - Secondary PORT
type Transaction ¶
type Transaction struct { // PaymentProvider - optional - the underling processor of this transaction (e.g. "paymark") PaymentProvider string // Method like "paymark_cc" , "paypal", Method string // Status - Method specific status e.g. Auth, Captured, Open, ... Status string // TransactionID - The main reference of the payment that was done TransactionID string // AdditionalData - room for AdditionalData - specific to the payment AdditionalData map[string]string // AmountPayed the amount that have been paid - eventually in a different currency AmountPayed price.Price // ValuedPayed the value of the AmountPayed in the cart default currency ValuedAmountPayed price.Price // CreditCardInfo Optional CreditCardInfo *CreditCardInfo // Title - speaking title - optional may describe the payment and may be shown to the customer Title string // RawTransactionData - place to store any additional stuff (specific for Gateway) RawTransactionData interface{} // ChargeAssignments - optional the assignment of this transaction to charges - this might be required for payments that are really only done for a certain item ChargeByItem *ChargeByItem }
Transaction representing the transaction