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 testGetTransactions() { global $test_site_name, $test_token; Spreedly::configure($test_site_name, $test_token); SpreedlySubscriber::wipe(); // create invoice for existing customer $trial_plan = SpreedlySubscriptionPlan::find_by_name("Free Trial"); $sub1 = SpreedlySubscriber::create(75, null, "able"); $sub1->lifetime_comp("full"); $sub2 = SpreedlySubscriber::create(76, null, "baker"); $sub2->activate_free_trial($trial_plan->id); // !!!! $sub3 = SpreedlySubscriber::create(77, null, "charlie"); $sub3->activate_free_trial($trial_plan->id); $transactions = Spreedly::get_transactions(); $this->assertEquals(3, count($transactions)); $this->assertEquals("free_trial", $transactions[0]->detail->payment_method); // test getting subset of transactions $transactions = Spreedly::get_transactions($transactions[1]->id); $this->assertEquals(1, count($transactions)); $this->assertEquals(77, $transactions[0]->subscriber_customer_id); }