Пример #1
0
 public function testParseLineItemEmpty()
 {
     $item = \CivicInfoBC\Beanstream\EXact::ParseLineItem('<|><|><|>4<|>5.00<|>no<|>');
     $this->assertTrue($item instanceof \CivicInfoBC\Beanstream\EXactLineItem);
     $this->assertEquals($item->id, null);
     $this->assertEquals($item->name, null);
     $this->assertEquals($item->description, null);
     $this->assertEquals($item->quantity, 4);
     $this->assertEquals($item->price, 5.0);
     $this->assertEquals($item->taxable, false);
 }
 private static function get_line_item(Transaction $trans)
 {
     if (!(isset($trans->metadata) && isset($trans->metadata->x_line_item))) {
         return null;
     }
     try {
         return \CivicInfoBC\Beanstream\EXact::ParseLineItem($trans->metadata->x_line_item);
     } catch (\Exception $e) {
         //	This is sent by the client so this is a bad request
         throw new \CivicInfoBC\HTTP\Status(\CivicInfoBC\HTTP\Status::BAD_REQUEST, $e);
     }
 }