public static function setUpBeforeClass()
 {
     // TODO: identity must have a merchant account on DUMMY_V1 processor
     self::$identity = Identity::retrieve(SampleData::$identityId);
     // setup card
     $card = json_decode(self::PAYMENT_CARD_PAYLOAD, true);
     $card['identity'] = self::$identity->id;
     $card = new PaymentInstrument($card);
     $card->save();
     self::$card = $card;
 }
 public static function setUpBeforeClass()
 {
     self::$identity = Identity::retrieve(SampleData::$identityId);
     // TODO: identity must have a merchant account on DUMMY_V1 processor
     // TODO: if we're calling the api with wrong credentials, we get 500 instead of 403
     $card = json_decode(self::PAYMENT_CARD_PAYLOAD, true);
     $card['identity'] = self::$identity->id;
     $card = new PaymentInstrument($card);
     $card->save();
     self::$card = $card;
 }
 /**
  * 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;
     }
     Resource::init();
     Resources\Application::init();
     Resources\Identity::init();
     Resources\Processor::init();
     Resources\Merchant::init();
     Resources\PaymentInstrument::init();
     Resources\Authorization::init();
     Resources\Transfer::init();
     Resources\Reversal::init();
     Resources\Dispute::init();
     Resources\Webhook::init();
     Resources\Settlement::init();
     Resources\Verification::init();
     Resources\Evidence::init();
     self::$initialized = true;
 }
    private function createBank($identity)
    {
        $BANK_ACCOUNT_PAYLOAD = <<<TAG
        {
            "name": {
                "first_name": "dwayne",
                "last_name": "Sunkhronos",
                "full_name": "dwayne Sunkhronos"
            },
            "type": "BANK_ACCOUNT",
            "tags": null,
            "account_number": "84012312415",
            "bank_code": "840123124",
            "account_type": "SAVINGS",
            "iban": null,
            "bic": null,
            "company_name": "company name",
            "country": "USA",
            "currency": "USD",
            "available_account_type": null
        }
TAG;
        $state = json_decode($BANK_ACCOUNT_PAYLOAD, true);
        $this->assertEquals(json_last_error(), 0);
        $state['identity'] = $identity->id;
        $bank = new PaymentInstrument($state);
        return $bank->save();
    }
 public static function setUpBeforeClass()
 {
     $identity = json_decode(self::IDENTITY_PAYLOAD, true);
     $identity = new Identity($identity);
     $identity = $identity->save();
     self::$identity = $identity;
     $payload = array("processor" => "DUMMY_V1");
     $identity->provisionMerchantOn($payload);
     $card = json_decode(self::PAYMENT_CARD_PAYLOAD, true);
     $card['identity'] = $identity->id;
     $card = new PaymentInstrument($card);
     $card->save();
     self::$card = $card;
     $transfer = json_decode(self::TRANSFER_PAYLOAD, true);
     $transfer['source'] = self::$card->id;
     $transfer['merchant_identity'] = $identity->id;
     $transfer = new Transfer($transfer);
     $transfer = $transfer->save();
     self::$transfer = $transfer;
 }
 public function test_bankAccountCreate()
 {
     $this->bank['identity'] = self::$identity->id;
     $paymentInstrument = new PaymentInstrument($this->bank);
     $paymentInstrument->save();
     print_r($paymentInstrument);
     $this->assertTrue(isset($paymentInstrument->id));
     // account number comes back as last 4
     // TODO: account number last four should come back
     //$this->assertEquals($paymentInstrument->account_number, substr($this->bank['number'], -4));
     // check fields
     $this->assertEquals($paymentInstrument->bank_code, $this->bank['bank_code']);
     $this->assertEquals($paymentInstrument->currency, $this->bank['currency']);
 }