コード例 #1
0
 function Send($sandbox = false)
 {
     if ($AuthorizeOnly) {
         $this['PAYMENTACTION'] = 'Authorization';
     } else {
         $this['PAYMENTACTION'] = 'Sale';
     }
     foreach ($this->REQUIRED as $field) {
         if (!$this->{$field}) {
             throw new PayPalInvalidValueException("No value supplied for {$field}");
         }
     }
     //Charge Amount
     $this['AMT'] = number_format($this->Amount, 2, '.', '');
     //Credit Card Type
     $ccType = PayPalCodes::CardType($this->CardType);
     if ($ccType) {
         $this['CREDITCARDTYPE'] = $ccType;
     } else {
         throw new PayPalInvalidValueException("Invalid Credit Card Type: {$this->CardType}");
     }
     //Credit Card Number
     $this['ACCT'] = $this->CardNumber;
     //Credit Card Expiration Date
     if (!is_numeric($this->CardExpiration)) {
         $ccExp = strtotime($this->CardExpiration);
     } else {
         $ccExp = $this->CardExpiration;
     }
     if ($ccExp < time()) {
         throw new PayPalInvalidValueException("Invalid Credit Card Expiration Date: {$this->CardExpiration}");
     }
     $this['EXPDATE'] = date('mY', $ccExp);
     //CVV Code
     $this['CVV2'] = $this->CardCVV2;
     $this['FIRSTNAME'] = $this->FirstName;
     $this['LASTNAME'] = $this->LastName;
     if (!isset(PayPalCodes::$countries[$this->Country])) {
         throw new PayPalInvalidValueException("Country Code is not one of the allowed values: {$this->Country}");
     }
     $this['COUNTRYCODE'] = $this->Country;
     if ($this->Address && $this->City && $this->State && $this->Zip) {
         if (!isset(PayPalCodes::$states[$this->Country][$this->State])) {
             throw new PayPalInvalidValueException("State Code is not one of the allowed values: {$this->State}");
         }
         $this['STREET'] = $this->Address;
         $this['CITY'] = $this->City;
         $this['STATE'] = $this->State;
         $this['ZIP'] = $this->Zip;
     }
     $this['CURRENCYCODE'] = $this->Currency;
     return parent::Send();
 }
コード例 #2
0
 function Send()
 {
     foreach ($this->REQUIRED as $field) {
         if (!$this->{$field}) {
             throw new PayPalInvalidValueException("No value supplied for {$field}");
         }
     }
     //Amount
     $this['L_Amt0'] = $this->Amount;
     //Receiver Email Address
     $this['L_EMAIL0'] = $this->PayPalEmail;
     //number_format($this->Amount, 2, '.', '');
     //Email Subject
     $this['EMAILSUBJECT'] = $this->EmailSubject;
     //Receiver Type
     $this['RECEIVERTYPE'] = $this->ReceiverType;
     //Currency Code
     $this['CURRENCYCODE'] = $this->CurrencyCode;
     return parent::Send();
 }
コード例 #3
0
ファイル: paypal.php プロジェクト: rajveer4155/vidmgr
 public function __construct($amount = null)
 {
     parent::__construct(self::$name);
 }
コード例 #4
0
ファイル: paypal.php プロジェクト: psykomo/kutump-enhanced
 public function __construct($desc, $amount = null)
 {
     parent::__construct(self::$name);
     $this->setNVP("TOKEN", urlencode($_GET['token']));
     //UTC time  date("Y-m-d\TH:i:s\Z", mktime(0,0,0,date("m"), date("d")+1, date("y")));
     //GMT time  gmdate("M d Y H:i:s", mktime(0,0,0,date("m"), date("d")+1, date("y"))); !!! not working need to find out why
     $this->setNVP("PROFILESTARTDATE", date("Y-m-d\\TH:i:s\\Z", mktime(0, 0, 0, date("m"), date("d") + 1, date("y"))));
     $this->setNVP("DESC", $desc);
     if (!is_null($amount)) {
         $this->setNVP("AMT", $amount);
     }
 }