plan() публичный Метод

public plan ( ) : braintree\PlanGateway
Результат braintree\PlanGateway
Пример #1
0
 public function testGatewayAll_returnsAllPlans()
 {
     $newId = strval(rand());
     $params = array("id" => $newId, "billingDayOfMonth" => "1", "billingFrequency" => "1", "currencyIsoCode" => "USD", "description" => "some description", "name" => "php test plan", "numberOfBillingCycles" => "1", "price" => "1.00", "trialPeriod" => "false");
     $http = new Braintree\Http(Braintree\Configuration::$global);
     $path = Braintree\Configuration::$global->merchantPath() . '/plans/create_plan_for_tests';
     $http->post($path, array("plan" => $params));
     $gateway = new Braintree\Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key'));
     $plans = $gateway->plan()->all();
     foreach ($plans as $plan) {
         if ($plan->id == $newId) {
             $actualPlan = $plan;
         }
     }
     $this->assertNotNull($actualPlan);
     $this->assertEquals($params["billingDayOfMonth"], $actualPlan->billingDayOfMonth);
     $this->assertEquals($params["billingFrequency"], $actualPlan->billingFrequency);
     $this->assertEquals($params["currencyIsoCode"], $actualPlan->currencyIsoCode);
     $this->assertEquals($params["description"], $actualPlan->description);
     $this->assertEquals($params["name"], $actualPlan->name);
     $this->assertEquals($params["numberOfBillingCycles"], $actualPlan->numberOfBillingCycles);
     $this->assertEquals($params["price"], $actualPlan->price);
 }