StripePaymentEvent.php in Stripe 2.x
File
src/Event/StripePaymentEvent.php
View source
<?php
namespace Drupal\stripe\Event;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\EventDispatcher\Event;
class StripePaymentEvent extends Event {
private $form;
private $formState;
private $element;
private $total = [];
private $billing = [];
private $metadata = [];
public function __construct(array &$form, FormStateInterface $formState, $element) {
$this->form =& $form;
$this->formState = $formState;
$this->element = $element;
}
public function &getForm() : array {
return $this->form;
}
public function getFormState() : FormStateInterface {
return $this->formState;
}
public function getFormElement() : string {
return $this->element;
}
public function getFormId() : string {
return $this->formId;
}
public function setTotal(int $amount, string $label) {
$this->total['amount'] = $amount;
$this->total['label'] = $label;
}
public function setBillingCity(string $city) {
$this->billing['address']['city'] = $city;
}
public function setBillingCountry(string $country) {
$this->billing['address']['country'] = $country;
}
public function setBillingAddress1(string $address1) {
$this->billing['address']['line1'] = $address1;
}
public function setBillingAddress2(string $address2) {
$this->billing['address']['line2'] = $address2;
}
public function setBillingPostalCode(string $postal_code) {
$this->billing['address']['postal_code'] = $postal_code;
}
public function setBillingState(string $state) {
$this->billing['address']['state'] = $state;
}
public function setBillingEmail(string $email) {
$this->billing['email'] = $email;
}
public function setBillingName(string $name) {
$this->billing['name'] = $name;
}
public function setBillingPhone(string $phone) {
$this->billing['phone'] = $phone;
}
public function setMetadata(string $key, $value) {
$this->metadata[$key] = $value;
}
public function getMetadata() : array {
return $this->metadata;
}
public function getBillingDetails() : array {
return $this->billing;
}
public function getTotal() : array {
return $this->total;
}
}