Ejemplo n.º 1
0
 public function testRecipientUpdateMetadataAll()
 {
     $recipient = self::createTestRecipient();
     $recipient->metadata = array('test' => 'foo bar');
     $recipient->save();
     $updatedRecipient = Stripe_Recipient::retrieve($recipient->id);
     $this->assertEqual('foo bar', $updatedRecipient->metadata['test']);
 }
Ejemplo n.º 2
0
 public function testSave()
 {
     $recipient = self::createTestRecipient();
     $recipient->email = '*****@*****.**';
     $recipient->save();
     $this->assertEqual($recipient->email, '*****@*****.**');
     $recipient2 = Stripe_Recipient::retrieve($recipient->id);
     $this->assertEqual($recipient->email, $recipient2->email);
 }
Ejemplo n.º 3
0
 public function testRecipientDeleteCard()
 {
     $token = Stripe_Token::create(array("card" => array("number" => "4000056655665556", "exp_month" => 5, "exp_year" => date('Y') + 3, "cvc" => "314")));
     $recipient = $this->createTestRecipient();
     $createdCard = $recipient->cards->create(array("card" => $token->id));
     $recipient->save();
     $updatedRecipient = Stripe_Recipient::retrieve($recipient->id);
     $updatedCards = $updatedRecipient->cards->all();
     $this->assertEqual(count($updatedCards["data"]), 1);
     $deleteStatus = $updatedRecipient->cards->retrieve($createdCard->id)->delete();
     $this->assertEqual($deleteStatus->deleted, 1);
     $updatedRecipient->save();
     $postDeleteRecipient = Stripe_Recipient::retrieve($recipient->id);
     $postDeleteCards = $postDeleteRecipient->cards->all();
     $this->assertEqual(count($postDeleteCards["data"]), 0);
 }
Ejemplo n.º 4
0
 /**
  * Create a valid test recipient
  */
 protected static function createTestRecipient(array $attributes = array())
 {
     authorizeFromEnv();
     return Stripe_Recipient::create($attributes + array('name' => 'PHP Test', 'type' => 'individual', 'tax_id' => '000000000', 'bank_account' => array('country' => 'US', 'routing_number' => '110000000', 'account_number' => '000123456789')));
 }
Ejemplo n.º 5
0
 public function providerS_bankingSubmit()
 {
     $id = Input::get('id');
     Stripe::setApiKey(Config::get('app.stripe_secret_key'));
     $token_id = Input::get('stripeToken');
     // Create a Recipient
     try {
         $recipient = Stripe_Recipient::create(array("name" => Input::get('first_name') . " " . Input::get('last_name'), "type" => Input::get('type'), "bank_account" => $token_id, "email" => Input::get('email')));
         Log::info('recipient = ' . print_r($recipient, true));
         $pro = Walker::where('id', Input::get('id'))->first();
         $pro->merchant_id = $recipient->id;
         $pro->account_id = $recipient->active_account->id;
         $pro->last_4 = $recipient->active_account->last4;
         $pro->save();
         Log::info('recipient added = ' . print_r($recipient, true));
     } catch (Exception $e) {
         Log::info('Error in Stripe = ' . print_r($e, true));
     }
     return Redirect::to("/admin/providers");
 }
Ejemplo n.º 6
0
 public function stripe_generate_recipient($cashout)
 {
     return Stripe_Recipient::create(array('name' => $cashout->user->name, 'type' => 'individual', 'card' => $cashout->provider_identifier, 'description' => 'Request #' . $this->app->hashids->encrypt($cashout->id), 'metadata' => array('user_id' => $cashout->user_id, 'user_name' => $cashout->user->name, 'cashout_id' => $this->app->hashids->encrypt($cashout->id))));
 }
 public function providerS_bankingSubmit()
 {
     $id = Input::get('id');
     Stripe::setApiKey(Config::get('app.stripe_secret_key'));
     $token_id = Input::get('stripeToken');
     // Create a Recipient
     $recipient = Stripe_Recipient::create(array("name" => Input::get('first_name') . " " . Input::get('last_name'), "type" => Input::get('type'), "card" => $token_id, "email" => Input::get('email')));
     $pro = Walker::where('id', Input::get('id'))->first();
     $pro->merchant_id = $recipient->id;
     $pro->card_id = $recipient->cards->data[0]->id;
     $pro->save();
     Log::info('recipient added = ' . print_r($recipient, true));
     return Redirect::to("/admin/providers");
 }