32 lines
822 B
PHP
32 lines
822 B
PHP
<?php
|
|
|
|
class AmazonAdapter {
|
|
public function fetchProductPrice($productIdOrQuery) {
|
|
// Mock data
|
|
return [
|
|
'original_price' => rand(100, 1000) / 10,
|
|
'discounted_price' => rand(80, 900) / 10,
|
|
'coupon_price' => rand(1, 50) / 10,
|
|
'rating' => rand(10, 50) / 10,
|
|
'url' => 'https://www.amazon.com/s?k=' . urlencode($productIdOrQuery),
|
|
];
|
|
}
|
|
|
|
public function fetchCoupons() {
|
|
// Mock data
|
|
return [
|
|
['code' => 'AMAZON10', 'discount' => 10]
|
|
];
|
|
}
|
|
|
|
public function fetchRatings() {
|
|
// Mock data
|
|
return 4.5;
|
|
}
|
|
|
|
public function resolveProductURL($productIdOrQuery) {
|
|
// Mock data
|
|
return "https://www.amazon.com/s?k=" . urlencode($productIdOrQuery);
|
|
}
|
|
}
|