Overview

Namespaces

  • mcfedr
    • Paypal
      • Exceptions
      • Notifications
      • Products
  • PHP

Classes

  • AdaptivePaymentNotification
  • CartChangeNotification
  • CartNotification
  • MasspayNotification
  • MasspayNotifications
  • Notification
  • PaymentNotification
  • SubscriptionNotification
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace mcfedr\Paypal\Notifications;
 4: 
 5: use mcfedr\Paypal\Authentication;
 6: use mcfedr\Paypal\Settings;
 7: 
 8: class MasspayNotifications extends Notification {
 9: 
10:     /**
11:      * Sub notifications, used by masspay
12:      * @var MasspayNotification[]
13:      */
14:     public $notifications;
15: 
16:     public function __construct($vars) {
17:         parent::__construct($vars);
18:         $this->type = static::MASSPAYS;
19: 
20:         $this->notifications = array();
21:         for ($i = 1; isset($vars["status_$i"]); $i++) {
22:             $n = new MasspayNotification($vars, $i);
23:             $this->notifications[] = $n;
24:         }
25: 
26:         $this->amount = 0;
27:         $this->fee = 0;
28:         if (count($this->notifications)) {
29:             foreach ($this->notifications as $notification) {
30:                 $this->amount += $notification->amount;
31:                 $this->fee += $notification->fee;
32:             }
33:             $this->currency = $this->notifications[0]->currency;
34:         }
35:     }
36: 
37:     /**
38:      * Check everything is as expected
39:      * 
40:      * @param Authentication $authentication
41:      * @param Settings $settings
42:      * @return bool
43:      */
44:     public function isOK(Authentication $authentication, Settings $settings) {
45:         if (empty($this->notifications)) {
46:             return false;
47:         }
48:         foreach ($this->notifications as $notification) {
49:             if (!$notification->isOK($authentication, $settings)) {
50:                 return false;
51:             }
52:         }
53:         return true;
54:     }
55: 
56: }
57: 
Paypal API documentation generated by ApiGen 2.8.0