function __construct($that) { $this->spreedlytoken = $that->GetOption('spreedlytoken'); $this->spreedlyname = $that->GetOption('spreedlyname'); if ($this->spreedlytoken && $this->spreedlyname) { Spreedly::configure($this->spreedlyname, $this->spreedlytoken); $plans = SpreedlySubscriptionPlan::get_all(); if (isset($plans['ErrorCode'])) { $this->athenticated = false; } else { $this->athenticated = true; $dum = array(); foreach ($plans as $id => $data) { $dum[$data->id] = $data; } $this->plans = $dum; } } }
$spreedlytoken = $this->GetOption('spreedlytoken'); $spreedlyname = $this->GetOption('spreedlyname'); $for_approval_registration = $this->GetOption('wlm_for_approval_registration'); if (!$for_approval_registration) { $for_approval_registration = array(); } else { $for_approval_registration = unserialize($for_approval_registration); } $regurl = WLMREGISTERURL; // END Initialization } else { // START Interface $r = array(); if ($spreedlytoken && $spreedlyname) { Spreedly::configure($spreedlyname, $spreedlytoken); $r = SpreedlySubscriptionPlan::get_all(); if (isset($r['ErrorCode'])) { if ($r['ErrorCode'] == '401') { echo "<div class='error fade'>" . __('<p>Invalid Pin Payments API Credentials.</p>', 'wishlist-member') . "</div>"; } else { echo "<div class='error fade'>" . __("<p>{$r['Response']}</p>", 'wishlist-member') . "</div>"; } } } ?> <!-- Spreedly --> <p><?php _e('* Pin Payments is formerly known as Spreedly', 'wishlist-member'); ?> </p> <blockquote>
public function testPlans() { global $test_site_name, $test_token; Spreedly::configure($test_site_name, $test_token); $plans = SpreedlySubscriptionPlan::get_all(); $this->assertEquals(4, count($plans)); $this->assertEquals("full", $plans[0]->feature_level); $this->assertEquals("basic", $plans[2]->feature_level); $full = SpreedlySubscriptionPlan::find_by_name("Annual"); $this->assertNotNull($full); $id = $full->id; $full = SpreedlySubscriptionPlan::find($id); $this->assertNotNull($full); }