pdt

package
v0.0.0-...-df2c501 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package pdt implements PayPal Payment Data Transfer.

See https://developer.paypal.com/docs/classic/products/payment-data-transfer.

Example
package main

import (
	"fmt"
	"github.com/arthurwhite/paypal"
	"github.com/arthurwhite/paypal/pdt"
)

func main() {
	pp := &paypal.Client{
		Token:      "G-ddvHQfRB2wqzrHCgdkbx0uXEcgKTcWbG2GjlI581zbPbGxKekGXgyVwU0",
		Production: false,
	}

	tx, err := pdt.GetTransaction(pp, "EPC66XON1D4EE27M9")
	if err != nil {
		panic(err)
	}
	fmt.Println(tx)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrTransactionNotFound = errors.New("pdt: transaction not found")
)

Errors

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	ID                    string        `paypal:"txn_id"`
	Type                  string        `paypal:"txn_type"`
	Subject               string        `paypal:"transaction_subject"`
	Business              *mail.Address `paypal:"business"`
	Custom                string        `paypal:"custom"`
	FirstName             string        `paypal:"first_name"`
	HandlingAmount        float64       `paypal:"handling_amount"`
	ItemID                string        `paypal:"item_number"`
	ItemName              string        `paypal:"item_name"`
	LastName              string        `paypal:"last_name"`
	MerchantCurrency      string        `paypal:"mc_currency"`
	MerchantFee           float64       `paypal:"mc_fee"`
	MerchantGross         float64       `paypal:"mc_gross"`
	PayerEmail            *mail.Address `paypal:"payer_email"`
	PayerID               string        `paypal:"payer_id"`
	PayerStatus           string        `paypal:"payer_status"`
	PaymentDate           time.Time     `paypal:"payment_date"`
	PaymentFee            string        `paypal:"payment_fee"`
	PaymentGross          string        `paypal:"payment_gross"`
	PaymentStatus         string        `paypal:"payment_status"`
	PaymentType           string        `paypal:"payment_type"`
	ProtectionEligibility string        `paypal:"protection_eligibility"`
	Quantity              string        `paypal:"quantity"`
	ReceiverID            string        `paypal:"receiver_id"`
	ReceiverEmail         *mail.Address `paypal:"receiver_email"`
	ResidenceCountry      string        `paypal:"residence_country"`
	Shipping              float64       `paypal:"shipping"`
	Tax                   float64       `paypal:"tax"`
}

Transaction is a PDT transaction. See https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables.

BUG(arthurwhite): Can't handle multiple items from a shopping cart transaction.

func GetTransaction

func GetTransaction(c *paypal.Client, id string) (*Transaction, error)

GetTransaction retreives a transaction from id, with client. If transaction cannot be found, error is ErrTransactionNotFound.

func (*Transaction) String

func (tx *Transaction) String() (s string)

Notes

Bugs

  • Can't handle multiple items from a shopping cart transaction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL