Example #1
0
 public function markAsSafe()
 {
     self::authorizeFromEnv();
     $card = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 1);
     $charge = Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => $card));
     $charge->markAsSafe();
     $updatedCharge = Charge::retrieve($charge->id);
     $this->assertSame('safe', $updatedCharge['fraud_details']['user_report']);
 }
Example #2
0
 public function testUpdateDescription()
 {
     self::authorizeFromEnv();
     $card = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 1);
     $charge = Charge::create(array('amount' => 100, 'currency' => self::CURRENCY, 'card' => $card));
     $charge->description = 'foo bar';
     $charge->save();
     $updatedCharge = Charge::retrieve($charge->id);
     $this->assertSame('foo bar', $updatedCharge->description);
     $this->assertSame('foo bar', $charge->description);
 }
 private function createDisputedCharge()
 {
     $card = array('number' => '4000000000000259', 'exp_month' => 5, 'exp_year' => date('Y') + 1);
     $c = Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => $card));
     $c = Charge::retrieve($c->id);
     $attempts = 0;
     while ($c->dispute === null) {
         if ($attempts > 5) {
             throw new \Exception("Charge is taking too long to be disputed");
         }
         sleep(1);
         $c = Charge::retrieve($c->id);
         $attempts += 1;
     }
     return $c;
 }