Skip to content
Snippets Groups Projects
Commit 2a02d304 authored by mattwire's avatar mattwire
Browse files

Upgrade to EntityFrameworkV2

parent ab3e8fd3
Branches entityframeworkv2
No related tags found
1 merge request!261Upgrade to EntityFrameworkV2
Showing
with 255 additions and 1018 deletions
<?php <?php
/** /**
* @package CRM * DAOs provide an OOP-style facade for reading and writing database records.
* @copyright CiviCRM LLC https://civicrm.org/licensing
* *
* Generated from com.drastikbydesign.stripe/xml/schema/CRM/Stripe/StripeCustomer.xml * DAOs are a primary source for metadata in older versions of CiviCRM (<5.74)
* DO NOT EDIT. Generated by CRM_Core_CodeGen * and are required for some subsystems (such as APIv3).
* (GenCodeChecksum:dd1ed7f28d02b0186afd06a69db33b83) *
*/ * This stub provides compatibility. It is not intended to be modified in a
use CRM_Stripe_ExtensionUtil as E; * substantive way. Property annotations may be added, but are not required.
* @property string $id
/** * @property string $customer_id
* Database access object for the StripeCustomer entity. * @property string $contact_id
* @property string $processor_id
* @property string $currency
*/ */
class CRM_Stripe_DAO_StripeCustomer extends CRM_Core_DAO { class CRM_Stripe_DAO_StripeCustomer extends CRM_Stripe_DAO_Base {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/** /**
* Static instance to hold the table name. * Required by older versions of CiviCRM (<5.74).
*
* @var string * @var string
*/ */
public static $_tableName = 'civicrm_stripe_customers'; public static $_tableName = 'civicrm_stripe_customers';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
* @var bool
*/
public static $_log = TRUE;
/**
* Unique ID
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* Stripe Customer ID
*
* @var string|null
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $customer_id;
/**
* FK to Contact
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $contact_id;
/**
* ID from civicrm_payment_processor
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $processor_id;
/**
* 3 character string, value from Stripe customer.
*
* @var string|null
* (SQL type: varchar(3))
* Note that values will be retrieved from the database as a string.
*/
public $currency;
/**
* Class constructor.
*/
public function __construct() {
$this->__table = 'civicrm_stripe_customers';
parent::__construct();
}
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Stripe Customers') : E::ts('Stripe Customer');
}
/**
* Returns all the column names of this table
*
* @return array
*/
public static function &fields() {
if (!isset(Civi::$statics[__CLASS__]['fields'])) {
Civi::$statics[__CLASS__]['fields'] = [
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('ID'),
'description' => E::ts('Unique ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_customers.id',
'table_name' => 'civicrm_stripe_customers',
'entity' => 'StripeCustomer',
'bao' => 'CRM_Stripe_DAO_StripeCustomer',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'customer_id' => [
'name' => 'customer_id',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Stripe Customer ID'),
'description' => E::ts('Stripe Customer ID'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_customers.customer_id',
'table_name' => 'civicrm_stripe_customers',
'entity' => 'StripeCustomer',
'bao' => 'CRM_Stripe_DAO_StripeCustomer',
'localizable' => 0,
'html' => [
'type' => 'Text',
],
'add' => NULL,
],
'contact_id' => [
'name' => 'contact_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Contact ID'),
'description' => E::ts('FK to Contact'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_customers.contact_id',
'table_name' => 'civicrm_stripe_customers',
'entity' => 'StripeCustomer',
'bao' => 'CRM_Stripe_DAO_StripeCustomer',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'html' => [
'type' => 'EntityRef',
],
'add' => NULL,
],
'processor_id' => [
'name' => 'processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Payment Processor ID'),
'description' => E::ts('ID from civicrm_payment_processor'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_customers.processor_id',
'table_name' => 'civicrm_stripe_customers',
'entity' => 'StripeCustomer',
'bao' => 'CRM_Stripe_DAO_StripeCustomer',
'localizable' => 0,
'html' => [
'type' => 'EntityRef',
],
'pseudoconstant' => [
'table' => 'civicrm_payment_processor',
'keyColumn' => 'id',
'labelColumn' => 'name',
],
'add' => NULL,
],
'currency' => [
'name' => 'currency',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Currency'),
'description' => E::ts('3 character string, value from Stripe customer.'),
'maxlength' => 3,
'size' => CRM_Utils_Type::FOUR,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_customers.currency',
'headerPattern' => '/cur(rency)?/i',
'dataPattern' => '/^[A-Z]{3}$/i',
'default' => NULL,
'table_name' => 'civicrm_stripe_customers',
'entity' => 'StripeCustomer',
'bao' => 'CRM_Stripe_DAO_StripeCustomer',
'localizable' => 0,
'html' => [
'type' => 'Text',
],
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
public static function &import($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'stripe_customers', $prefix, []);
return $r;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
public static function &export($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'stripe_customers', $prefix, []);
return $r;
}
/**
* Returns the list of indices
*
* @param bool $localize
*
* @return array
*/
public static function indices($localize = TRUE) {
$indices = [
'customer_id' => [
'name' => 'customer_id',
'field' => [
0 => 'customer_id',
],
'localizable' => FALSE,
'unique' => TRUE,
'sig' => 'civicrm_stripe_customers::1::customer_id',
],
];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
}
} }
<?php <?php
/** /**
* @package CRM * DAOs provide an OOP-style facade for reading and writing database records.
* @copyright CiviCRM LLC https://civicrm.org/licensing
* *
* Generated from com.drastikbydesign.stripe/xml/schema/CRM/Stripe/StripePaymentintent.xml * DAOs are a primary source for metadata in older versions of CiviCRM (<5.74)
* DO NOT EDIT. Generated by CRM_Core_CodeGen * and are required for some subsystems (such as APIv3).
* (GenCodeChecksum:b67646ad6a172031ee010ed01449d20e) *
*/ * This stub provides compatibility. It is not intended to be modified in a
use CRM_Stripe_ExtensionUtil as E; * substantive way. Property annotations may be added, but are not required.
* @property string $id
/** * @property string $stripe_intent_id
* Database access object for the StripePaymentintent entity. * @property string $contribution_id
* @property string $payment_processor_id
* @property string $description
* @property string $status
* @property string $identifier
* @property string $contact_id
* @property string $created_date
* @property string $flags
* @property string $referrer
* @property string $extra_data
*/ */
class CRM_Stripe_DAO_StripePaymentintent extends CRM_Core_DAO { class CRM_Stripe_DAO_StripePaymentintent extends CRM_Stripe_DAO_Base {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
/** /**
* Static instance to hold the table name. * Required by older versions of CiviCRM (<5.74).
*
* @var string * @var string
*/ */
public static $_tableName = 'civicrm_stripe_paymentintent'; public static $_tableName = 'civicrm_stripe_paymentintent';
/**
* Should CiviCRM log any modifications to this table in the civicrm_log table.
*
* @var bool
*/
public static $_log = TRUE;
/**
* Unique ID
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $id;
/**
* The Stripe PaymentIntent/SetupIntent/PaymentMethod ID
*
* @var string|null
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $stripe_intent_id;
/**
* FK ID from civicrm_contribution
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $contribution_id;
/**
* Foreign key to civicrm_payment_processor.id
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $payment_processor_id;
/**
* Description of this paymentIntent
*
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $description;
/**
* The status of the paymentIntent
*
* @var string
* (SQL type: varchar(25))
* Note that values will be retrieved from the database as a string.
*/
public $status;
/**
* An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)
*
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $identifier;
/**
* FK to Contact
*
* @var int|string|null
* (SQL type: int unsigned)
* Note that values will be retrieved from the database as a string.
*/
public $contact_id;
/**
* When was paymentIntent created
*
* @var string|null
* (SQL type: timestamp)
* Note that values will be retrieved from the database as a string.
*/
public $created_date;
/**
* Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)
*
* @var string
* (SQL type: varchar(100))
* Note that values will be retrieved from the database as a string.
*/
public $flags;
/**
* HTTP referrer of this paymentIntent
*
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $referrer;
/**
* Extra data collected to help with diagnostics (such as email, name)
*
* @var string
* (SQL type: varchar(255))
* Note that values will be retrieved from the database as a string.
*/
public $extra_data;
/**
* Class constructor.
*/
public function __construct() {
$this->__table = 'civicrm_stripe_paymentintent';
parent::__construct();
}
/**
* Returns localized title of this entity.
*
* @param bool $plural
* Whether to return the plural version of the title.
*/
public static function getEntityTitle($plural = FALSE) {
return $plural ? E::ts('Stripe Paymentintents') : E::ts('Stripe Paymentintent');
}
/**
* Returns all the column names of this table
*
* @return array
*/
public static function &fields() {
if (!isset(Civi::$statics[__CLASS__]['fields'])) {
Civi::$statics[__CLASS__]['fields'] = [
'id' => [
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('ID'),
'description' => E::ts('Unique ID'),
'required' => TRUE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.id',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'readonly' => TRUE,
'add' => NULL,
],
'stripe_intent_id' => [
'name' => 'stripe_intent_id',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Stripe Intent ID'),
'description' => E::ts('The Stripe PaymentIntent/SetupIntent/PaymentMethod ID'),
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.stripe_intent_id',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'contribution_id' => [
'name' => 'contribution_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Contribution ID'),
'description' => E::ts('FK ID from civicrm_contribution'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.contribution_id',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'payment_processor_id' => [
'name' => 'payment_processor_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Payment Processor'),
'description' => E::ts('Foreign key to civicrm_payment_processor.id'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.payment_processor_id',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor',
'pseudoconstant' => [
'table' => 'civicrm_payment_processor',
'keyColumn' => 'id',
'labelColumn' => 'name',
],
'add' => NULL,
],
'description' => [
'name' => 'description',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Description'),
'description' => E::ts('Description of this paymentIntent'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.description',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'status' => [
'name' => 'status',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Status'),
'description' => E::ts('The status of the paymentIntent'),
'required' => FALSE,
'maxlength' => 25,
'size' => CRM_Utils_Type::MEDIUM,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.status',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'identifier' => [
'name' => 'identifier',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Identifier'),
'description' => E::ts('An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.identifier',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'contact_id' => [
'name' => 'contact_id',
'type' => CRM_Utils_Type::T_INT,
'title' => E::ts('Contact ID'),
'description' => E::ts('FK to Contact'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.contact_id',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'add' => NULL,
],
'created_date' => [
'name' => 'created_date',
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => E::ts('Created Date'),
'description' => E::ts('When was paymentIntent created'),
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.created_date',
'default' => 'CURRENT_TIMESTAMP',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'flags' => [
'name' => 'flags',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Flags'),
'description' => E::ts('Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)'),
'required' => FALSE,
'maxlength' => 100,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.flags',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'referrer' => [
'name' => 'referrer',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Referrer'),
'description' => E::ts('HTTP referrer of this paymentIntent'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.referrer',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
'extra_data' => [
'name' => 'extra_data',
'type' => CRM_Utils_Type::T_STRING,
'title' => E::ts('Extra Data'),
'description' => E::ts('Extra data collected to help with diagnostics (such as email, name)'),
'required' => FALSE,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'usage' => [
'import' => FALSE,
'export' => FALSE,
'duplicate_matching' => FALSE,
'token' => FALSE,
],
'where' => 'civicrm_stripe_paymentintent.extra_data',
'table_name' => 'civicrm_stripe_paymentintent',
'entity' => 'StripePaymentintent',
'bao' => 'CRM_Stripe_DAO_StripePaymentintent',
'localizable' => 0,
'add' => NULL,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
return Civi::$statics[__CLASS__]['fields'];
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
public static function &import($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'stripe_paymentintent', $prefix, []);
return $r;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
public static function &export($prefix = FALSE) {
$r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'stripe_paymentintent', $prefix, []);
return $r;
}
/**
* Returns the list of indices
*
* @param bool $localize
*
* @return array
*/
public static function indices($localize = TRUE) {
$indices = [
'UI_stripe_intent_id' => [
'name' => 'UI_stripe_intent_id',
'field' => [
0 => 'stripe_intent_id',
],
'localizable' => FALSE,
'unique' => TRUE,
'sig' => 'civicrm_stripe_paymentintent::1::stripe_intent_id',
],
];
return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
}
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</requires> </requires>
<civix> <civix>
<namespace>CRM/Stripe</namespace> <namespace>CRM/Stripe</namespace>
<format>23.02.1</format> <format>24.09.1</format>
</civix> </civix>
<classloader> <classloader>
<psr0 prefix="CRM_" path="."/> <psr0 prefix="CRM_" path="."/>
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
<mixin>menu-xml@1.0.0</mixin> <mixin>menu-xml@1.0.0</mixin>
<mixin>mgd-php@1.0.0</mixin> <mixin>mgd-php@1.0.0</mixin>
<mixin>setting-php@1.0.0</mixin> <mixin>setting-php@1.0.0</mixin>
<mixin>smarty-v2@1.0.1</mixin>
<mixin>entity-types-php@1.0.0</mixin>
<mixin>setting-admin@1.0.1</mixin> <mixin>setting-admin@1.0.1</mixin>
<mixin>entity-types-php@2.0.0</mixin>
<mixin>smarty@1.0.3</mixin>
</mixins> </mixins>
<upgrader>CRM_Stripe_Upgrader</upgrader> <upgrader>CiviMix\Schema\Stripe\AutomaticUpgrader</upgrader>
</extension> </extension>
File added
<?php
use CRM_Stripe_ExtensionUtil as E;
return [
'name' => 'StripeCustomer',
'table' => 'civicrm_stripe_customers',
'class' => 'CRM_Stripe_DAO_StripeCustomer',
'getInfo' => fn() => [
'title' => E::ts('Stripe Customer'),
'title_plural' => E::ts('Stripe Customers'),
'description' => E::ts('Stripe Customers'),
'log' => TRUE,
],
'getIndices' => fn() => [
'customer_id' => [
'fields' => [
'customer_id' => TRUE,
],
'unique' => TRUE,
],
],
'getFields' => fn() => [
'id' => [
'title' => E::ts('ID'),
'sql_type' => 'int unsigned',
'input_type' => 'Number',
'required' => TRUE,
'description' => E::ts('Unique ID'),
'primary_key' => TRUE,
'auto_increment' => TRUE,
],
'customer_id' => [
'title' => E::ts('Stripe Customer ID'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Stripe Customer ID'),
],
'contact_id' => [
'title' => E::ts('Contact ID'),
'sql_type' => 'int unsigned',
'input_type' => 'EntityRef',
'description' => E::ts('FK to Contact'),
'entity_reference' => [
'entity' => 'Contact',
'key' => 'id',
'on_delete' => 'CASCADE',
],
],
'processor_id' => [
'title' => E::ts('Payment Processor ID'),
'sql_type' => 'int unsigned',
'input_type' => 'EntityRef',
'description' => E::ts('ID from civicrm_payment_processor'),
'pseudoconstant' => [
'table' => 'civicrm_payment_processor',
'key_column' => 'id',
'label_column' => 'name',
],
],
'currency' => [
'title' => E::ts('Currency'),
'sql_type' => 'varchar(3)',
'input_type' => 'Text',
'description' => E::ts('3 character string, value from Stripe customer.'),
'default' => NULL,
],
],
];
<?php
use CRM_Stripe_ExtensionUtil as E;
return [
'name' => 'StripePaymentintent',
'table' => 'civicrm_stripe_paymentintent',
'class' => 'CRM_Stripe_DAO_StripePaymentintent',
'getInfo' => fn() => [
'title' => E::ts('Stripe Paymentintent'),
'title_plural' => E::ts('Stripe Paymentintents'),
'description' => E::ts('Stripe PaymentIntents'),
'log' => TRUE,
],
'getIndices' => fn() => [
'UI_stripe_intent_id' => [
'fields' => [
'stripe_intent_id' => TRUE,
],
'unique' => TRUE,
],
],
'getFields' => fn() => [
'id' => [
'title' => E::ts('ID'),
'sql_type' => 'int unsigned',
'input_type' => 'Number',
'required' => TRUE,
'description' => E::ts('Unique ID'),
'primary_key' => TRUE,
'auto_increment' => TRUE,
],
'stripe_intent_id' => [
'title' => E::ts('Stripe Intent ID'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('The Stripe PaymentIntent/SetupIntent/PaymentMethod ID'),
],
'contribution_id' => [
'title' => E::ts('Contribution ID'),
'sql_type' => 'int unsigned',
'input_type' => 'Number',
'description' => E::ts('FK ID from civicrm_contribution'),
],
'payment_processor_id' => [
'title' => E::ts('Payment Processor'),
'sql_type' => 'int unsigned',
'input_type' => 'EntityRef',
'description' => E::ts('Foreign key to civicrm_payment_processor.id'),
'pseudoconstant' => [
'table' => 'civicrm_payment_processor',
'key_column' => 'id',
'label_column' => 'name',
],
'entity_reference' => [
'entity' => 'PaymentProcessor',
'key' => 'id',
'on_delete' => 'SET NULL',
],
],
'description' => [
'title' => E::ts('Description'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Description of this paymentIntent'),
],
'status' => [
'title' => E::ts('Status'),
'sql_type' => 'varchar(25)',
'input_type' => 'Text',
'description' => E::ts('The status of the paymentIntent'),
],
'identifier' => [
'title' => E::ts('Identifier'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)'),
],
'contact_id' => [
'title' => E::ts('Contact ID'),
'sql_type' => 'int unsigned',
'input_type' => 'EntityRef',
'description' => E::ts('FK to Contact'),
'entity_reference' => [
'entity' => 'Contact',
'key' => 'id',
'on_delete' => 'CASCADE',
],
],
'created_date' => [
'title' => E::ts('Created Date'),
'sql_type' => 'timestamp',
'input_type' => NULL,
'description' => E::ts('When was paymentIntent created'),
'default' => 'CURRENT_TIMESTAMP',
],
'flags' => [
'title' => E::ts('Flags'),
'sql_type' => 'varchar(100)',
'input_type' => 'Text',
'description' => E::ts('Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)'),
],
'referrer' => [
'title' => E::ts('Referrer'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('HTTP referrer of this paymentIntent'),
],
'extra_data' => [
'title' => E::ts('Extra Data'),
'sql_type' => 'varchar(255)',
'input_type' => 'Text',
'description' => E::ts('Extra data collected to help with diagnostics (such as email, name)'),
],
],
];
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC. All rights reserved. |
-- | |
-- | This work is published under the GNU AGPLv3 license with some |
-- | permitted exceptions and without any warranty. For full license |
-- | and copyright information, see https://civicrm.org/licensing |
-- +--------------------------------------------------------------------+
--
-- Generated from drop.tpl
-- DO NOT EDIT. Generated by CRM_Core_CodeGen
--
-- /*******************************************************
-- *
-- * Clean up the existing tables
-- *
-- *******************************************************/
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS `civicrm_stripe_paymentintent`;
DROP TABLE IF EXISTS `civicrm_stripe_customers`;
SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
-- /*******************************************************
-- *
-- * civicrm_stripe_customers
-- *
-- * Stripe Customers
-- *
-- *******************************************************/
CREATE TABLE `civicrm_stripe_customers` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID',
`customer_id` varchar(255) COMMENT 'Stripe Customer ID',
`contact_id` int unsigned COMMENT 'FK to Contact',
`processor_id` int unsigned COMMENT 'ID from civicrm_payment_processor',
`currency` varchar(3) DEFAULT NULL COMMENT '3 character string, value from Stripe customer.',
PRIMARY KEY (`id`),
UNIQUE INDEX `customer_id`(customer_id),
CONSTRAINT FK_civicrm_stripe_customers_contact_id FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE
)
ENGINE=InnoDB;
-- /*******************************************************
-- *
-- * civicrm_stripe_paymentintent
-- *
-- * Stripe PaymentIntents
-- *
-- *******************************************************/
CREATE TABLE `civicrm_stripe_paymentintent` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID',
`stripe_intent_id` varchar(255) COMMENT 'The Stripe PaymentIntent/SetupIntent/PaymentMethod ID',
`contribution_id` int unsigned COMMENT 'FK ID from civicrm_contribution',
`payment_processor_id` int unsigned COMMENT 'Foreign key to civicrm_payment_processor.id',
`description` varchar(255) NULL COMMENT 'Description of this paymentIntent',
`status` varchar(25) NULL COMMENT 'The status of the paymentIntent',
`identifier` varchar(255) NULL COMMENT 'An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)',
`contact_id` int unsigned COMMENT 'FK to Contact',
`created_date` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'When was paymentIntent created',
`flags` varchar(100) NULL COMMENT 'Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)',
`referrer` varchar(255) NULL COMMENT 'HTTP referrer of this paymentIntent',
`extra_data` varchar(255) NULL COMMENT 'Extra data collected to help with diagnostics (such as email, name)',
PRIMARY KEY (`id`),
UNIQUE INDEX `UI_stripe_intent_id`(stripe_intent_id),
CONSTRAINT FK_civicrm_stripe_paymentintent_payment_processor_id FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor`(`id`) ON DELETE SET NULL,
CONSTRAINT FK_civicrm_stripe_paymentintent_contact_id FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE
)
ENGINE=InnoDB;
...@@ -75,10 +75,46 @@ class CRM_Stripe_ExtensionUtil { ...@@ -75,10 +75,46 @@ class CRM_Stripe_ExtensionUtil {
return self::CLASS_PREFIX . '_' . str_replace('\\', '_', $suffix); return self::CLASS_PREFIX . '_' . str_replace('\\', '_', $suffix);
} }
/**
* @return \CiviMix\Schema\SchemaHelperInterface
*/
public static function schema() {
if (!isset($GLOBALS['CiviMixSchema'])) {
pathload()->loadPackage('civimix-schema@5', TRUE);
}
return $GLOBALS['CiviMixSchema']->getHelper(static::LONG_NAME);
}
} }
use CRM_Stripe_ExtensionUtil as E; use CRM_Stripe_ExtensionUtil as E;
pathload()->addSearchDir(__DIR__ . '/mixin/lib');
spl_autoload_register('_stripe_civix_class_loader', TRUE, TRUE);
function _stripe_civix_class_loader($class) {
if ($class === 'CRM_Stripe_DAO_Base') {
if (version_compare(CRM_Utils_System::version(), '5.74.beta', '>=')) {
class_alias('CRM_Core_DAO_Base', 'CRM_Stripe_DAO_Base');
// ^^ Materialize concrete names -- encourage IDE's to pick up on this association.
}
else {
$realClass = 'CiviMix\\Schema\\Stripe\\DAO';
class_alias($realClass, $class);
// ^^ Abstract names -- discourage IDE's from picking up on this association.
}
return;
}
// This allows us to tap-in to the installation process (without incurring real file-reads on typical requests).
if (strpos($class, 'CiviMix\\Schema\\Stripe\\') === 0) {
// civimix-schema@5 is designed for backported use in download/activation workflows,
// where new revisions may become dynamically available.
pathload()->loadPackage('civimix-schema@5', TRUE);
CiviMix\Schema\loadClass($class);
}
}
/** /**
* (Delegated) Implements hook_civicrm_config(). * (Delegated) Implements hook_civicrm_config().
* *
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{ {
"php-versions": "7.4", "php-versions": "7.4",
"drupal": "9.5.*", "drupal": "9.5.*",
"civicrm": "5.65.*" "civicrm": "5.74.*"
} }
] ]
} }
......
<?php
// This file declares a new entity type. For more details, see "hook_civicrm_entityTypes" at:
// https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
return [
[
'name' => 'StripeCustomer',
'class' => 'CRM_Stripe_DAO_StripeCustomer',
'table' => 'civicrm_stripe_customers',
],
];
<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
<base>CRM/Stripe</base>
<class>StripeCustomer</class>
<name>civicrm_stripe_customers</name>
<comment>Stripe Customers</comment>
<log>true</log>
<field>
<name>id</name>
<type>int unsigned</type>
<required>true</required>
<comment>Unique ID</comment>
</field>
<primaryKey>
<name>id</name>
<autoincrement>true</autoincrement>
</primaryKey>
<field>
<name>customer_id</name>
<title>Stripe Customer ID</title>
<type>varchar</type>
<length>255</length>
<comment>Stripe Customer ID</comment>
<html>
<type>Text</type>
</html>
</field>
<index>
<name>customer_id</name>
<fieldName>customer_id</fieldName>
<unique>true</unique>
</index>
<field>
<name>contact_id</name>
<type>int unsigned</type>
<comment>FK to Contact</comment>
<html>
<type>EntityRef</type>
</html>
</field>
<foreignKey>
<name>contact_id</name>
<table>civicrm_contact</table>
<key>id</key>
<onDelete>CASCADE</onDelete>
</foreignKey>
<field>
<name>processor_id</name>
<title>Payment Processor ID</title>
<type>int unsigned</type>
<comment>ID from civicrm_payment_processor</comment>
<html>
<type>EntityRef</type>
</html>
<pseudoconstant>
<table>civicrm_payment_processor</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
</pseudoconstant>
</field>
<field>
<name>currency</name>
<type>varchar</type>
<length>3</length>
<default>NULL</default>
<headerPattern>/cur(rency)?/i</headerPattern>
<dataPattern>/^[A-Z]{3}$/i</dataPattern>
<comment>3 character string, value from Stripe customer.</comment>
<html>
<type>Text</type>
</html>
</field>
</table>
<?php
// This file declares a new entity type. For more details, see "hook_civicrm_entityTypes" at:
// http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference
return array (
0 =>
array (
'name' => 'StripePaymentintent',
'class' => 'CRM_Stripe_DAO_StripePaymentintent',
'table' => 'civicrm_stripe_paymentintent',
),
);
<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
<base>CRM/Stripe</base>
<class>StripePaymentintent</class>
<name>civicrm_stripe_paymentintent</name>
<comment>Stripe PaymentIntents</comment>
<log>true</log>
<field>
<name>id</name>
<type>int unsigned</type>
<required>true</required>
<comment>Unique ID</comment>
</field>
<primaryKey>
<name>id</name>
<autoincrement>true</autoincrement>
</primaryKey>
<field>
<name>stripe_intent_id</name>
<title>Stripe Intent ID</title>
<type>varchar</type>
<length>255</length>
<comment>The Stripe PaymentIntent/SetupIntent/PaymentMethod ID</comment>
</field>
<index>
<name>UI_stripe_intent_id</name>
<fieldName>stripe_intent_id</fieldName>
<unique>true</unique>
</index>
<field>
<name>contribution_id</name>
<title>Contribution ID</title>
<type>int unsigned</type>
<comment>FK ID from civicrm_contribution</comment>
</field>
<field>
<name>payment_processor_id</name>
<title>Payment Processor</title>
<type>int unsigned</type>
<comment>Foreign key to civicrm_payment_processor.id</comment>
<pseudoconstant>
<table>civicrm_payment_processor</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
</pseudoconstant>
</field>
<foreignKey>
<name>payment_processor_id</name>
<table>civicrm_payment_processor</table>
<key>id</key>
<onDelete>SET NULL</onDelete>
</foreignKey>
<field>
<name>description</name>
<title>Description</title>
<type>varchar</type>
<required>false</required>
<length>255</length>
<comment>Description of this paymentIntent</comment>
</field>
<field>
<name>status</name>
<type>varchar</type>
<length>25</length>
<required>false</required>
<comment>The status of the paymentIntent</comment>
</field>
<field>
<name>identifier</name>
<type>varchar</type>
<length>255</length>
<required>false</required>
<comment>An identifier that we can use in CiviCRM to find the paymentIntent if we do not have the ID (eg. session key)</comment>
</field>
<field>
<name>contact_id</name>
<type>int unsigned</type>
<comment>FK to Contact</comment>
</field>
<foreignKey>
<name>contact_id</name>
<table>civicrm_contact</table>
<key>id</key>
<onDelete>CASCADE</onDelete>
</foreignKey>
<field>
<name>created_date</name>
<title>Created Date</title>
<type>timestamp</type>
<default>CURRENT_TIMESTAMP</default>
<comment>When was paymentIntent created</comment>
</field>
<field>
<name>flags</name>
<type>varchar</type>
<length>100</length>
<required>false</required>
<comment>Flags associated with this PaymentIntent (NC=no contributionID when doPayment called)</comment>
</field>
<field>
<name>referrer</name>
<title>Referrer</title>
<type>varchar</type>
<required>false</required>
<length>255</length>
<comment>HTTP referrer of this paymentIntent</comment>
</field>
<field>
<name>extra_data</name>
<title>Extra Data</title>
<type>varchar</type>
<required>false</required>
<length>255</length>
<comment>Extra data collected to help with diagnostics (such as email, name)</comment>
</field>
</table>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment