Example #1
0
 /**
  * Initializes resources (i.e. registers them with Resource::_registry). Note
  * that if you add a Resource then you must initialize it here.
  *
  * @internal
  */
 private static function initializeResources()
 {
     if (self::$initialized) {
         return;
     }
     \infiniteLabs\BalancedPayments\Resource::init();
     \infiniteLabs\BalancedPayments\APIKey::init();
     \infiniteLabs\BalancedPayments\Marketplace::init();
     \infiniteLabs\BalancedPayments\Credit::init();
     \infiniteLabs\BalancedPayments\Debit::init();
     \infiniteLabs\BalancedPayments\Refund::init();
     \infiniteLabs\BalancedPayments\Reversal::init();
     \infiniteLabs\BalancedPayments\Card::init();
     \infiniteLabs\BalancedPayments\BankAccount::init();
     \infiniteLabs\BalancedPayments\BankAccountVerification::init();
     \infiniteLabs\BalancedPayments\CardHold::init();
     \infiniteLabs\BalancedPayments\Callback::init();
     \infiniteLabs\BalancedPayments\Event::init();
     \infiniteLabs\BalancedPayments\Customer::init();
     \infiniteLabs\BalancedPayments\Order::init();
     \infiniteLabs\BalancedPayments\Dispute::init();
     self::$initialized = true;
 }
Example #2
0
 /**
  * Find or create a role-less account by email address. You can later turn
  * this into a buyer by adding a funding source (e.g a card) or a merchant
  * using \infiniteLabs\BalancedPayments\Account->promoteToMerchant.
  *
  * @param string email_address Email address. There can only be one account with this email address.
  *
  * @return \infiniteLabs\BalancedPayments\Account
  */
 function findOrCreateCustomerByEmailAddress($email_address)
 {
     $marketplace = Marketplace::mine();
     $customer = $marketplace->customers->query()->filter(Customer::$f->email->eq($email_address))->first();
     if ($customer) {
         return $customer;
     }
     return $this->createCustomer($email_address);
 }