royal mail price calculator
1.0.0
Perpustakaan ini memungkinkan Anda menghitung biaya pengiriman paket dengan Royal Mail.
Termasuk harga yang berlaku mulai Maret 2017.
Instal versi terbaru dengan composer require justinhook/royal-mail-price-calculator
Melayani | Kelas |
---|---|
Kelas 1 | FirstClassService() |
Kelas 2 | SecondClassService() |
Ditandatangani Untuk Kelas 1 | SignedForFirstClassService() |
Ditandatangani Untuk Kelas 2 | SignedForSecondClassService() |
Dijamin paling lambat jam 9 pagi | GuaranteedByNineAmService() |
Dijamin paling lambat jam 9 pagi dengan Garansi Sabtu | GuaranteedByNineAmWithSaturdayService() |
Dijamin paling lambat jam 1 siang | GuaranteedByOnePmService() |
Dijamin jam 1 siang dengan Garansi Sabtu | GuaranteedByOnePmWithSaturdayService() |
<?php
require ' vendor/autoload.php ' ;
use RoyalMailPriceCalculator Calculator ;
use RoyalMailPriceCalculator Package ;
use RoyalMailPriceCalculator Services GuaranteedByOnePmService ;
use RoyalMailPriceCalculator Services FirstClassService ;
$ calculator = new Calculator ();
$ package = new Package ();
$ package -> setDimensions ( 15 , 15 , 0.4 );
$ package -> setWeight ( 90 );
$ calculator -> setServices ( array ( new FirstClassService (), new GuaranteedByOnePmService ()));
foreach ( $ calculator -> calculatePrice ( $ package ) as $ calculated )
{
echo $ calculated [ ' service ' ]-> getName () . "n" ;
foreach ( $ calculated [ ' prices ' ] as $ price ) {
echo " → £ { $ price [ ' price ' ]} (Compensation: £ { $ price [ ' compensation ' ]} ) n" ;
}
echo "n" ;
}
Akan menghasilkan:
1st Class Service
→ £0.62 (Compensation: £20)
Guaranteed by 1pm
→ £6.40 (Compensation: £500)
→ £7.40 (Compensation: £1000)
→ £9.40 (Compensation: £2500)