[ 'label' => t('stripe source (payment method)'), 'wrap' => FALSE, 'property info' => mkbh_general_rules_data_stripe_card_info(), ], ]; } /** * Property info callback: stripe_card. * * @return array */ function mkbh_general_rules_data_stripe_card_info() { return [ 'id' => [ 'type' => 'text', 'label' => t('Unique identifier for the object.'), ], 'object' => [ 'type' => 'text', 'label' => t('String representing the object’s type.'), ], 'brand' => [ 'type' => 'text', 'label' => ('Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown.'), ], 'country' => [ 'type' => 'text', 'label' => ('Two-letter ISO code representing the country of the card. '), ], 'exp_month' => [ 'type' => 'text', 'label' => ('Two digit number representing the card’s expiration month.'), ], 'exp_year' => [ 'type' => 'text', 'label' => ('Four digit number representing the card’s expiration year.'), ], 'funding' => [ 'type' => 'text', 'label' => ('Card funding type. Can be credit, debit, prepaid, or unknown.'), ], 'last4' => [ 'type' => 'text', 'label' => ('The last 4 digits of the card.'), ], 'name' => [ 'type' => 'text', 'label' => ('Cardholder name.'), ], ]; } /** * Implements hook_rules_event_info(). */ function mkbh_general_rules_event_info() { $items = [ 'mkbh_stripe_plan_subscribed' => [ 'label' => t('After user subscribed to one of the paid Stripe subscription plans'), 'group' => t('MKBH: Stripe'), 'variables' => [ 'user_email' => [ 'type' => 'text', 'label' => t('User\'s email who has subscribed to a plan'), ], 'plan_name' => [ 'type' => 'text', 'label' => t('Plan name user has subscribed to'), ], ], ], 'mkbh_mobile_pay_plan_subscribed' => [ 'label' => t('After user subscribed to one of the paid MobilePay subscription plans'), 'group' => t('MKBH: MobilePay'), 'variables' => [ 'user_email' => [ 'type' => 'text', 'label' => t('User\'s email who has subscribed to a plan'), ], 'plan_name' => [ 'type' => 'text', 'label' => t('Plan name user has subscribed to'), ], ], ], 'mkbh_stripe_plan_manual_charge' => [ 'label' => t('After user was charged for a manual amount'), 'group' => t('MKBH: Stripe'), 'variables' => [ 'user_email' => [ 'type' => 'text', 'label' => t('User\'s email who made a payment'), ], 'amount' => [ 'type' => 'text', 'label' => t('Amount that was charged'), ], ], ], 'mkbh_stripe_card_expiring' => [ 'label' => t('Customer card will expire in 3 months'), 'group' => t('MKBH: Stripe'), 'variables' => [ 'stripe_customer' => [ 'type' => 'mkbh_stripe_customer', 'label' => t('Local stripe customer representation'), ], 'stripe_card' => [ 'type' => 'stripe_card', 'label' => t('Stripe card representation'), ], 'user' => [ 'type' => 'user', 'label' => t('Drupal account associated with given stripe customer'), ], ], ], 'mkbh_stripe_card_expiring_soon' => [ 'label' => t('Customer card will expire in 1 months'), 'group' => t('MKBH: Stripe'), 'variables' => [ 'stripe_customer' => [ 'type' => 'mkbh_stripe_customer', 'label' => t('Local stripe customer representation'), ], 'stripe_card' => [ 'type' => 'stripe_card', 'label' => t('Stripe card representation'), ], 'user' => [ 'type' => 'user', 'label' => t('Drupal account associated with given stripe customer'), ], ], ], 'mkbh_stripe_card_expired' => [ 'label' => t('Customer card has expired'), 'group' => t('MKBH: Stripe'), 'variables' => [ 'stripe_customer' => [ 'type' => 'mkbh_stripe_customer', 'label' => t('Local stripe customer representation'), ], 'stripe_card' => [ 'type' => 'stripe_card', 'label' => t('Stripe card representation'), ], 'user' => [ 'type' => 'user', 'label' => t('Drupal account associated with given stripe customer'), ], ], ], 'mkbh_stripe_webhook_invoice_payment_failed' => [ 'label' => t('Invoice: Payment Failed (invoice.payment_failed)'), 'group' => t('MKBH: Stripe: Webhooks'), 'variables' => [ 'user' => [ 'type' => 'user', 'label' => t('Drupal account associated with given stripe customer'), ], 'attempt_count' => [ 'type' => 'text', 'label' => t('Number of times invoice has been attempted so far.'), ], 'invoice_amount' => [ 'type' => 'text', 'label' => t('Formatted invoice amount (XXX,YY kr.)'), ], ], ], 'mkbh_stripe_webhook_invoice_payment_succeeded' => [ 'label' => t('Invoice: Payment Succeeded (invoice.payment_succeeded)'), 'group' => t('MKBH: Stripe: Webhooks'), 'variables' => [ 'user' => [ 'type' => 'user', 'label' => t('Drupal account associated with given stripe customer'), ], 'invoice_amount' => [ 'type' => 'text', 'label' => t('Formatted invoice amount (XXX,YY kr.)'), ], ], ], ]; return $items; }