public static function payment_data(SI_Payment $payment)
 {
     $payment_data = array('title' => $payment->get_title(), 'id' => $payment->get_id(), 'status' => $payment->get_status(), 'payment_method' => $payment->get_payment_method(), 'amount' => $payment->get_amount(), 'invoice_id' => $payment->get_invoice_id(), 'data' => $payment->get_data());
     $invoice = SI_Invoice::get_instance($payment->get_invoice_id());
     if (is_a($invoice, 'SI_Invoice')) {
         $payment_data['invoice_data'] = self::invoice_data($invoice);
     }
     return $payment_data;
 }
 /**
  * Create recurring payment profiles for any recurring invoices in the purchase
  * @param  SI_Invoice $invoice
  * @param  SI_Payment $payment
  * @return void
  */
 private function maybe_create_recurring_payment_profiles(SI_Invoice $invoice, SI_Payment $payment)
 {
     if ($payment->get_payment_method() != $this->get_payment_method()) {
         return false;
     }
     $data = $payment->get_data();
     if (!isset($data['payment_token'])) {
         // a payment token is needed
         return false;
     }
     if (si_is_invoice_recurring($invoice)) {
         $this->create_recurring_payment_profile($invoice, $payment);
     }
 }
 /**
  * Create recurring payment profiles for any recurring invoices in the purchase
  * @param  SI_Invoice $invoice
  * @param  SI_Payment $payment
  * @return void
  */
 private function maybe_create_recurring_payment_profiles(SI_Checkouts $checkout, SI_Invoice $invoice, SI_Payment $payment)
 {
     if ($payment->get_payment_method() != $this->get_payment_method()) {
         return false;
     }
     if (si_is_invoice_recurring($invoice)) {
         $this->create_recurring_payment_profile($checkout, $invoice, $payment);
     }
 }
Ejemplo n.º 4
0
 /**
  * Send the admin a notification when a payment is received.
  * @param  SI_Payment $payment
  * @param  array      $args
  * @return
  */
 public static function admin_payment_notification(SI_Payment $payment, $args = array())
 {
     $payment_method = $payment->get_payment_method();
     // A notification shouldn't be sent to the admin when s/he created it
     if ($payment_method == SI_Admin_Payment::PAYMENT_METHOD) {
         return;
     }
     $invoice_id = $payment->get_invoice_id();
     $invoice = SI_Invoice::get_instance($invoice_id);
     if (!is_a($invoice, 'SI_Invoice')) {
         do_action('si_error', 'Admin Payment Notification Not Sent to Client; No Invoice Found: ' . $invoice_id, $payment->get_id());
         return;
     }
     $client = $invoice->get_client();
     // Admin email
     $data = array('payment' => $payment, 'invoice' => $invoice, 'client' => $client);
     $admin_to = self::admin_email($data);
     self::send_notification('payment_notification', $data, $admin_to);
 }