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(); }
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(); }