$merchant = GoCoin::getMerchant($token, MERCHANT_ID); showObject($merchant, FALSE); //update merchant tests $UPDATE = FALSE; if ($UPDATE) { //create an array of fields to update, NOTE: id is required $name = $merchant->name; $updates = array('id' => $merchant->id, 'name' => $name . ' (UPDATED)'); //update the merchant $updated = GoCoin::updateMerchant($token, $updates); //show the updates echo '<h3 style="color:blue">Updated Merchant</h3>'; showObject($updated, FALSE); //reset the name $updates['name'] = $name; GoCoin::updateMerchant($token, $updates); } echo '<hr/>' . "\n"; echo '<h3 style="color:blue">All Merchant Payouts</h3>'; //get all payouts $payouts = GoCoin::getMerchantPayouts($token, MERCHANT_ID); var_dump($payouts); $DO_PAYOUT = FALSE; if ($DO_PAYOUT) { echo '<hr/>' . "\n"; echo '<h3 style="color:blue">Payout</h3>'; $payout = GoCoin::requestPayout($token, MERCHANT_ID, 1); var_dump($payout); showObject($payout); } //get all conversions
public function testUpdateMerchant() { if (!$this->doTest(__FUNCTION__)) { return; } //perform assertion $this->assertEquals(GoCoin::getApiMode(), 'test'); $this->assertNotEmpty(TOKEN); //get a merchant $merchant = GoCoin::getMerchant(TOKEN, MERCHANT_ID); $this->assertEquals($merchant->id, MERCHANT_ID); //create an array of fields to update, NOTE: id is required $name = $merchant->name; $updates = array('id' => $merchant->id, 'name' => $name . ' (UPDATED)'); //update the merchant $updated = GoCoin::updateMerchant(TOKEN, $updates); //make sure we got a successful response back $this->assertTrue(property_exists($updated, 'name')); //show the results echo '[DEBUG]: Updated name: ' . $updated->name . "\n"; //perform assertion $this->assertEquals($updated->name, $name . ' (UPDATED)'); //reset the name $updates['name'] = $name; $updated = GoCoin::updateMerchant(TOKEN, $updates); //make sure we got a successful response back $this->assertTrue(property_exists($updated, 'name')); //show the results echo '[DEBUG]: Reset name: ' . $updated->name . "\n"; //perform assertion $this->assertEquals($updated->name, $name); echo '[DEBUG]: SUCCESS: ' . "\n"; }