Ejemplo n.º 1
0
 /**
  * @dataProvider alpha3Provider
  */
 public function testFindByAlpha3MustReturnSameInstance($alpha3, array $expected)
 {
     $iso4217 = new ISO4217();
     $firstCurrency = $iso4217->findByAlpha3($alpha3);
     $secondCurrency = $iso4217->findByAlpha3($alpha3);
     $this->assertInstanceOf('Payum\\ISO4217\\Currency', $firstCurrency);
     $this->assertInstanceOf('Payum\\ISO4217\\Currency', $secondCurrency);
     $this->assertSame($firstCurrency, $secondCurrency);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  *
  * @param GetCurrency $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $currency = is_numeric($request->code) ? $this->iso4217->findByNumeric($request->code) : $this->iso4217->findByAlpha3($request->code);
     $request->alpha3 = $currency->getAlpha3();
     $request->country = $currency->getCountry();
     $request->exp = $currency->getExp();
     $request->name = $currency->getName();
     $request->numeric = $currency->getNumeric();
 }