/** * @return string The API URL for this Pingpp refund. */ public function instanceUrl() { $id = $this['id']; $charge = $this['charge']; if (!$id) { throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null); } $id = Util\Util::utf8($id); $charge = Util\Util::utf8($charge); $base = Charge::classUrl(); $chargeExtn = urlencode($charge); $extn = urlencode($id); return "{$base}/{$chargeExtn}/refunds/{$extn}"; }
public function testUrls() { $this->assertSame(Charge::classUrl(), '/v1/charges'); $charge = new Charge('abcd/efgh'); $this->assertSame($charge->instanceUrl(), '/v1/charges/abcd%2Fefgh'); }