Changeset 2482991
- Timestamp:
- 02/28/2021 11:54:45 AM (5 years ago)
- Location:
- faizpay-commerce
- Files:
-
- 127 added
- 24 edited
-
tags/1.0.9 (added)
-
tags/1.0.9/.gitignore (added)
-
tags/1.0.9/LICENSE (added)
-
tags/1.0.9/README.md (added)
-
tags/1.0.9/assets (added)
-
tags/1.0.9/assets/barclays.svg (added)
-
tags/1.0.9/assets/hsbc.svg (added)
-
tags/1.0.9/assets/lloyds.svg (added)
-
tags/1.0.9/assets/natwest.svg (added)
-
tags/1.0.9/assets/santander.svg (added)
-
tags/1.0.9/assets/starling.svg (added)
-
tags/1.0.9/composer.json (added)
-
tags/1.0.9/composer.lock (added)
-
tags/1.0.9/faizpay-commerce-gateway.php (added)
-
tags/1.0.9/index.php (added)
-
tags/1.0.9/readme.txt (added)
-
tags/1.0.9/src (added)
-
tags/1.0.9/src/AdminPortalOptions.php (added)
-
tags/1.0.9/src/AdminPortalUI.php (added)
-
tags/1.0.9/src/CheckoutIcon.php (added)
-
tags/1.0.9/src/FaizPayPaymentGateway.php (added)
-
tags/1.0.9/src/OrderComplete.php (added)
-
tags/1.0.9/src/PaymentNotification.php (added)
-
tags/1.0.9/src/PaymentProcess.php (added)
-
tags/1.0.9/src/index.php (added)
-
tags/1.0.9/vendor (added)
-
tags/1.0.9/vendor/autoload.php (added)
-
tags/1.0.9/vendor/composer (added)
-
tags/1.0.9/vendor/composer/ClassLoader.php (added)
-
tags/1.0.9/vendor/composer/InstalledVersions.php (added)
-
tags/1.0.9/vendor/composer/LICENSE (added)
-
tags/1.0.9/vendor/composer/autoload_classmap.php (added)
-
tags/1.0.9/vendor/composer/autoload_namespaces.php (added)
-
tags/1.0.9/vendor/composer/autoload_psr4.php (added)
-
tags/1.0.9/vendor/composer/autoload_real.php (added)
-
tags/1.0.9/vendor/composer/autoload_static.php (added)
-
tags/1.0.9/vendor/composer/installed.json (added)
-
tags/1.0.9/vendor/composer/installed.php (added)
-
tags/1.0.9/vendor/composer/platform_check.php (added)
-
tags/1.0.9/vendor/faizpay (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/HEAD (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/ORIG_HEAD (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/branches (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/config (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/description (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/applypatch-msg.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/commit-msg.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/fsmonitor-watchman.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/post-update.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/pre-applypatch.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/pre-commit.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/pre-push.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/pre-rebase.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/pre-receive.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/prepare-commit-msg.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/hooks/update.sample (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/index (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/info (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/info/exclude (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/info/refs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/HEAD (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs/heads (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs/heads/master (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes/origin (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes/origin/HEAD (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects/info (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects/info/packs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects/pack (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects/pack/pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.idx (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/objects/pack/pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.pack (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/packed-refs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/heads (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/heads/master (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/remotes (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/remotes/origin (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/remotes/origin/HEAD (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.git/refs/tags (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/.gitignore (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/LICENSE (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/composer.json (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/example (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/example/NewPayment.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/example/Notification.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/phpunit.xml (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/readme.md (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Connection.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/DeliveryAddress.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Error.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Errors.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Helper (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Helper/NumberFormatter.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Item.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/NotificationHandler.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Payment.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/Provider.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/src/User.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/ConnectionTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/DeliveryAddressTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/ErrorTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/ItemTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/NotificationHandlerTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/PaymentTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/ProviderTest.php (added)
-
tags/1.0.9/vendor/faizpay/php-payment-sdk/tests/UserTest.php (added)
-
tags/1.0.9/vendor/firebase (added)
-
tags/1.0.9/vendor/firebase/php-jwt (added)
-
tags/1.0.9/vendor/firebase/php-jwt/LICENSE (added)
-
tags/1.0.9/vendor/firebase/php-jwt/README.md (added)
-
tags/1.0.9/vendor/firebase/php-jwt/composer.json (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src/BeforeValidException.php (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src/ExpiredException.php (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src/JWK.php (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src/JWT.php (added)
-
tags/1.0.9/vendor/firebase/php-jwt/src/SignatureInvalidException.php (added)
-
trunk/composer.lock (modified) (2 diffs)
-
trunk/faizpay-commerce-gateway.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/FaizPayPaymentGateway.php (modified) (2 diffs)
-
trunk/src/OrderComplete.php (modified) (3 diffs)
-
trunk/src/PaymentProcess.php (modified) (3 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.json (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/ORIG_HEAD (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/index (modified) (previous)
-
trunk/vendor/faizpay/php-payment-sdk/.git/info/refs (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/logs/HEAD (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/heads/master (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes/origin/HEAD (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/objects/info/packs (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/objects/pack/pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.idx (added)
-
trunk/vendor/faizpay/php-payment-sdk/.git/objects/pack/pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.pack (added)
-
trunk/vendor/faizpay/php-payment-sdk/.git/packed-refs (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/.git/refs/heads/master (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/src/Errors.php (modified) (1 diff)
-
trunk/vendor/faizpay/php-payment-sdk/src/Item.php (modified) (6 diffs)
-
trunk/vendor/faizpay/php-payment-sdk/tests/ItemTest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
faizpay-commerce/trunk/composer.lock
r2482772 r2482991 13 13 "type": "git", 14 14 "url": "https://github.com/FaizRasool/faizpay-php-payment-sdk.git", 15 "reference": " 843c595545b2b7cf92f0ea9087670b4976480456"15 "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb" 16 16 }, 17 17 "dist": { 18 18 "type": "zip", 19 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/ 843c595545b2b7cf92f0ea9087670b4976480456",20 "reference": " 843c595545b2b7cf92f0ea9087670b4976480456",19 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/90c4c50dc41e016654bd6f6e356575abd978fcbb", 20 "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb", 21 21 "shasum": "" 22 22 }, … … 50 50 "source": "https://github.com/FaizRasool/faizpay-php-payment-sdk/tree/master" 51 51 }, 52 "time": "2021-02-2 7T18:43:10+00:00"52 "time": "2021-02-28T11:42:29+00:00" 53 53 }, 54 54 { -
faizpay-commerce/trunk/faizpay-commerce-gateway.php
r2482772 r2482991 4 4 Plugin URI: https://github.com/FaizRasool/faizpay-woocommerce-gateway 5 5 Description: Enables the FaizPay as payment option on the woocommerce. 6 Version: 1.0. 86 Version: 1.0.9 7 7 WC requires at least: 3.0 8 8 WC tested up to: 5.6 -
faizpay-commerce/trunk/readme.txt
r2470506 r2482991 4 4 Tags: faizpay, woo, woocommerce, ecommerce, commerce, bank, HSBC, Barclay, Royal Bank of Scotland, RBS, Lloyds, Santander, Nationwide, Natwest 5 5 Requires at least: 3.0 6 Requires PHP: 5.67 Tested up to: 5.66 Requires PHP: 7.0 7 Tested up to: 8.0 8 8 Stable tag: 1.1.4 9 9 License: GPLv2 or later -
faizpay-commerce/trunk/src/FaizPayPaymentGateway.php
r2482724 r2482991 38 38 39 39 add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); 40 40 41 add_action('woocommerce_api_faizpay', array($this, 'webhook')); 41 42 … … 43 44 // https://rudrastyh.com/woocommerce/thank-you-page.html 44 45 45 add_filter('woocommerce_endpoint_order-received_title', [$this, 'redirect_end_point_title']);46 add_filter('woocommerce_thankyou_order_received_text', [$this, ' redirect_end_point_text']);46 // add_filter('woocommerce_endpoint_order-received_title', [$this, 'redirect_end_point_title']); 47 add_filter('woocommerce_thankyou_order_received_text', [$this, 'order_received_text'], 10, 2); 47 48 } 48 49 49 public function redirect_end_point_title($text) 50 51 public function order_received_text($text) 50 52 { 51 return OrderComplete::title($text); 52 } 53 54 public function redirect_end_point_text($text) 55 { 56 return OrderComplete::title($text); 53 return OrderComplete::title($text, $this); 57 54 } 58 55 -
faizpay-commerce/trunk/src/OrderComplete.php
r2482724 r2482991 7 7 class OrderComplete 8 8 { 9 public static function title($old )9 public static function title($old, FaizPayPaymentGateway $faizPayPaymentGateway) 10 10 { 11 11 global $woocommerce; 12 12 13 13 $orderID = self::getOrderId(); 14 14 15 $order = wc_get_order($orderID); 15 16 16 $orderData = wc_get_order($order); 17 18 if($orderData === false){ 17 if ($order === false) { 19 18 return $old; 20 19 } 21 20 22 $paymentMethod = $order Data->get_payment_method();21 $paymentMethod = $order->get_payment_method(); 23 22 if ($paymentMethod != 'faizpay_payment') { 24 23 return $old; 25 24 } 26 25 26 // if mark as accepted 27 27 if (self::checkOrderStatus()) { 28 // Remove cart items 29 $woocommerce->cart->empty_cart(); 30 return $old; 31 } 32 wc_add_notice('Your payment has been rejected', 'notice'); 33 $url = wc_get_checkout_url(); 34 if (wp_redirect($url)) { 35 exit; 28 // if doesn't need payment 29 if (!$order->needs_payment()) { 30 // Remove cart items 31 $woocommerce->cart->empty_cart(); 32 // only show the final link if order completed in last half an hour 33 $datePaid = $order->get_date_paid(); 34 if ($datePaid instanceof \DateTime) { 35 $now = new \DateTime(); 36 $diff = $now->diff($datePaid); 37 $minutes = 38 ($diff->format('%a') * 1440) + // total days converted to minutes 39 ($diff->format('%h') * 60) + // hours converted to minutes 40 $diff->format('%i'); // minutes 41 if ($minutes <= 30) { // if order with in half an hour 42 $url = $faizPayPaymentGateway->get_return_url($order); 43 if (wp_redirect($url)) { 44 exit; 45 } 46 } 47 } 48 } 49 } else { 50 if ($order->needs_payment()) { 51 $url = $order->get_cancel_order_url_raw(); 52 if (wp_redirect($url)) { 53 exit; 54 } 55 } 36 56 } 37 57 return "Payment Rejected"; 38 58 } 39 59 40 public static function text($old) 60 public 61 static function text($old) 41 62 { 42 63 if (self::checkOrderStatus()) { … … 46 67 } 47 68 48 private static function checkOrderStatus() 69 private 70 static function checkOrderStatus() 49 71 { 50 72 $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : "rejected"; … … 55 77 } 56 78 57 private static function getOrderId() 79 private 80 static function getOrderId() 58 81 { 59 82 return isset($_GET['order']) ? sanitize_text_field($_GET['order']) : "0"; -
faizpay-commerce/trunk/src/PaymentProcess.php
r2482753 r2482991 77 77 $item = Item::createItem( 78 78 $item->get_name(), 79 $item->get_quantity(), 80 NumberFormatter::formatNumber($item->get_total()) 79 $item->get_quantity() 81 80 ); 82 81 if ($item instanceof Item) { … … 88 87 if ($order->get_shipping_address_1() != '') { 89 88 $country = $order->get_billing_country(); 89 90 90 if ($country == 'GB') { 91 91 $country = 'UK'; 92 92 } 93 94 if (strlen($country) != '2') { 95 $country = 'UK'; 96 } 97 93 98 $deliveryAddress = DeliveryAddress::createDeliveryAddress( 94 99 $order->get_shipping_address_1(), … … 100 105 } else { 101 106 $country = $order->get_billing_country(); 107 102 108 if ($country == 'GB') { 103 109 $country = 'UK'; 104 110 } 111 112 if (strlen($country) != '2') { 113 $country = 'UK'; 114 } 115 105 116 $deliveryAddress = DeliveryAddress::createDeliveryAddress( 106 117 $order->get_billing_address_1(), -
faizpay-commerce/trunk/vendor/autoload.php
r2482772 r2482991 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 8f7dbe19d769984dc8905253ccffc513::getLoader();7 return ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416::getLoader(); -
faizpay-commerce/trunk/vendor/composer/InstalledVersions.php
r2482772 r2482991 43 43 0 => '9999999-dev', 44 44 ), 45 'reference' => ' 843c595545b2b7cf92f0ea9087670b4976480456',45 'reference' => '90c4c50dc41e016654bd6f6e356575abd978fcbb', 46 46 ), 47 47 'faizrasool/faizpay-payment-gateway' => -
faizpay-commerce/trunk/vendor/composer/autoload_real.php
r2482772 r2482991 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 8f7dbe19d769984dc8905253ccffc5135 class ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 8f7dbe19d769984dc8905253ccffc513', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 8f7dbe19d769984dc8905253ccffc513', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitd72a5bfbbbdbb8c78864a1f21ed30416', 'loadClassLoader')); 30 30 31 31 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 33 33 require __DIR__ . '/autoload_static.php'; 34 34 35 call_user_func(\Composer\Autoload\ComposerStaticInit 8f7dbe19d769984dc8905253ccffc513::getInitializer($loader));35 call_user_func(\Composer\Autoload\ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::getInitializer($loader)); 36 36 } else { 37 37 $map = require __DIR__ . '/autoload_namespaces.php'; -
faizpay-commerce/trunk/vendor/composer/autoload_static.php
r2482772 r2482991 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 8f7dbe19d769984dc8905253ccffc5137 class ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 38 38 { 39 39 return \Closure::bind(function () use ($loader) { 40 $loader->prefixLengthsPsr4 = ComposerStaticInit 8f7dbe19d769984dc8905253ccffc513::$prefixLengthsPsr4;41 $loader->prefixDirsPsr4 = ComposerStaticInit 8f7dbe19d769984dc8905253ccffc513::$prefixDirsPsr4;42 $loader->classMap = ComposerStaticInit 8f7dbe19d769984dc8905253ccffc513::$classMap;40 $loader->prefixLengthsPsr4 = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$prefixLengthsPsr4; 41 $loader->prefixDirsPsr4 = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$prefixDirsPsr4; 42 $loader->classMap = ComposerStaticInitd72a5bfbbbdbb8c78864a1f21ed30416::$classMap; 43 43 44 44 }, null, ClassLoader::class); -
faizpay-commerce/trunk/vendor/composer/installed.json
r2482772 r2482991 8 8 "type": "git", 9 9 "url": "https://github.com/FaizRasool/faizpay-php-payment-sdk.git", 10 "reference": " 843c595545b2b7cf92f0ea9087670b4976480456"10 "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/ 843c595545b2b7cf92f0ea9087670b4976480456",15 "reference": " 843c595545b2b7cf92f0ea9087670b4976480456",14 "url": "https://api.github.com/repos/FaizRasool/faizpay-php-payment-sdk/zipball/90c4c50dc41e016654bd6f6e356575abd978fcbb", 15 "reference": "90c4c50dc41e016654bd6f6e356575abd978fcbb", 16 16 "shasum": "" 17 17 }, … … 23 23 "phpunit/phpunit": "^8" 24 24 }, 25 "time": "2021-02-2 7T18:43:10+00:00",25 "time": "2021-02-28T11:42:29+00:00", 26 26 "default-branch": true, 27 27 "type": "library", -
faizpay-commerce/trunk/vendor/composer/installed.php
r2482772 r2482991 20 20 0 => '9999999-dev', 21 21 ), 22 'reference' => ' 843c595545b2b7cf92f0ea9087670b4976480456',22 'reference' => '90c4c50dc41e016654bd6f6e356575abd978fcbb', 23 23 ), 24 24 'faizrasool/faizpay-payment-gateway' => -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/ORIG_HEAD
r2482772 r2482991 1 843c595545b2b7cf92f0ea9087670b4976480456 1 90c4c50dc41e016654bd6f6e356575abd978fcbb -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/info/refs
r2482772 r2482991 1 843c595545b2b7cf92f0ea9087670b4976480456refs/heads/master2 843c595545b2b7cf92f0ea9087670b4976480456refs/remotes/origin/HEAD3 843c595545b2b7cf92f0ea9087670b4976480456refs/remotes/origin/master1 90c4c50dc41e016654bd6f6e356575abd978fcbb refs/heads/master 2 90c4c50dc41e016654bd6f6e356575abd978fcbb refs/remotes/origin/HEAD 3 90c4c50dc41e016654bd6f6e356575abd978fcbb refs/remotes/origin/master 4 4 332b9c1ddc35b1b0015a1cc1abc5ac91d1f23c96 refs/tags/v1.0.0 5 5 e18ab51255c37733bd0c2d14dbce3e57cc569663 refs/tags/v1.0.0^{} -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/HEAD
r2482772 r2482991 1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467+0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/2 843c595545b2b7cf92f0ea9087670b4976480456 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467+0000 checkout: moving from master to master3 843c595545b2b7cf92f0ea9087670b4976480456 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467 +0000 reset: moving to 843c595545b2b7cf92f0ea9087670b4976480456 1 0000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/ 2 90c4c50dc41e016654bd6f6e356575abd978fcbb 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000 checkout: moving from master to master 3 90c4c50dc41e016654bd6f6e356575abd978fcbb 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000 reset: moving to 90c4c50dc41e016654bd6f6e356575abd978fcbb -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/heads/master
r2482772 r2482991 1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467+0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/1 0000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/ -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/logs/refs/remotes/origin/HEAD
r2482772 r2482991 1 0000000000000000000000000000000000000000 843c595545b2b7cf92f0ea9087670b4976480456 Faiz Rasool <faiz.rasool@stablelogic.com> 1614451467+0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/1 0000000000000000000000000000000000000000 90c4c50dc41e016654bd6f6e356575abd978fcbb Faiz Rasool <faiz.rasool@stablelogic.com> 1614512669 +0000 clone: from /Users/faizrasool/.composer/cache/vcs/https---github.com-FaizRasool-faizpay-php-payment-sdk.git/ -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/objects/info/packs
r2482772 r2482991 1 P pack- 3cfe2eaa7c003569f48592f053b7e602233cced2.pack1 P pack-b9681e062e74d9dcc11d2dab80dc2e57bad87397.pack 2 2 -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/packed-refs
r2482772 r2482991 1 1 # pack-refs with: peeled fully-peeled sorted 2 843c595545b2b7cf92f0ea9087670b4976480456refs/remotes/origin/master2 90c4c50dc41e016654bd6f6e356575abd978fcbb refs/remotes/origin/master 3 3 332b9c1ddc35b1b0015a1cc1abc5ac91d1f23c96 refs/tags/v1.0.0 4 4 ^e18ab51255c37733bd0c2d14dbce3e57cc569663 -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/.git/refs/heads/master
r2482772 r2482991 1 843c595545b2b7cf92f0ea9087670b4976480456 1 90c4c50dc41e016654bd6f6e356575abd978fcbb -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/src/Errors.php
r2482753 r2482991 24 24 public const CODE_19 = [19, 'Item name need to be less than 255']; 25 25 public const CODE_20 = [20, 'Item quantity need to be more than 1']; 26 public const CODE_21 = [21, 'Item Amount cannot be empty or less than 0.01']; 27 public const CODE_22 = [22, 'Item Amount must be 2 decimal places']; 26 28 27 public const CODE_23 = [23, 'Delivery Address Line 1 cannot be empty or greater than 255 characters']; 29 28 public const CODE_24 = [24, 'Delivery Address Line 2 cannot be greater than 255 characters']; -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/src/Item.php
r2482772 r2482991 2 2 3 3 namespace FaizPay\PaymentSDK; 4 5 use FaizPay\PaymentSDK\Helper\NumberFormatter;6 4 7 5 class Item … … 18 16 19 17 /** 20 * @var string21 */22 private $amount;23 24 /**25 18 * @param string $name 26 19 * @param int $quantity 27 * @param string $amount28 20 * @return Error|Item 29 21 */ 30 22 public static function createItem(string $name, 31 int $quantity, 32 string $amount 23 int $quantity 33 24 ) 34 25 { … … 44 35 return new Error(Errors::CODE_20); 45 36 } 46 47 // validate amount 48 if ($amount == '' || $amount == '0.00' || (float)$amount < 0) { 49 return new Error(Errors::CODE_21); 50 } 51 52 // validate amount 53 if (!NumberFormatter::validateTwoDecimals($amount)) { 54 return new Error(Errors::CODE_22); 55 } 56 return new Item($name, $quantity, $amount); 37 return new Item($name, $quantity); 57 38 } 58 39 … … 61 42 * @param string $name 62 43 * @param int $quantity 63 * @param string $amount64 44 */ 65 private function __construct(string $name, int $quantity , string $amount)45 private function __construct(string $name, int $quantity) 66 46 { 67 47 $this->name = $name; 68 48 $this->quantity = $quantity; 69 $this->amount = $amount;70 49 } 71 50 … … 86 65 } 87 66 88 89 /**90 * @return string91 */92 public function getAmount(): string93 {94 return $this->amount;95 }96 97 67 /** 98 68 * @return string[] … … 103 73 'name' => $this->getName(), 104 74 'quantity' => $this->getQuantity(), 105 'amount' => $this->getAmount()106 75 ]; 107 76 } -
faizpay-commerce/trunk/vendor/faizpay/php-payment-sdk/tests/ItemTest.php
r2482772 r2482991 13 13 public function testErrorOnNameMoreThan255Characters() 14 14 { 15 $item = Item::createItem(str_repeat('a', 256), 1 , '1.00');15 $item = Item::createItem(str_repeat('a', 256), 1); 16 16 $this->assertInstanceOf(Error::class, $item); 17 17 $this->assertEquals($item->getMessage(), Errors::CODE_19[1]); … … 21 21 public function testErrorOnQuantityLessThan1() 22 22 { 23 $item = Item::createItem('Cup', 0 , '1.00');23 $item = Item::createItem('Cup', 0); 24 24 $this->assertInstanceOf(Error::class, $item); 25 25 $this->assertEquals($item->getMessage(), Errors::CODE_20[1]); 26 26 27 $item = Item::createItem('Cup', -10 , '1.00');27 $item = Item::createItem('Cup', -10); 28 28 $this->assertInstanceOf(Error::class, $item); 29 29 $this->assertEquals($item->getMessage(), Errors::CODE_20[1]); 30 30 } 31 31 32 public function testErrorOnZeroAmount()33 {34 $item = Item::createItem('Cup', 1, '0.00');35 $this->assertInstanceOf(Error::class, $item);36 $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);37 38 }39 40 public function testErrorOnEmptyAmount()41 {42 $item = Item::createItem('Cup', 1, '');43 $this->assertInstanceOf(Error::class, $item);44 $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);45 }46 47 public function testErrorOnLessThanZeroAmount()48 {49 $item = Item::createItem('Cup', 1, '-1.00');50 $this->assertInstanceOf(Error::class, $item);51 $this->assertEquals($item->getMessage(), Errors::CODE_21[1]);52 }53 54 public function testErrorOnMoreOrLessThan2DecimalPlacesForAmount()55 {56 $item = Item::createItem('Cup', 1, '0.00000000001');57 $this->assertInstanceOf(Error::class, $item);58 $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);59 60 $item = Item::createItem('Cup', 1, '1');61 $this->assertInstanceOf(Error::class, $item);62 $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);63 }64 65 public function testErrorOnValidAmount()66 {67 $item = Item::createItem('Cup', 1, 'abc');68 $this->assertInstanceOf(Error::class, $item);69 $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);70 71 $item = Item::createItem('Cup', 1, 'abc.00');72 $this->assertInstanceOf(Error::class, $item);73 $this->assertEquals($item->getMessage(), Errors::CODE_22[1]);74 }75 76 32 public function testGetName() 77 33 { 78 $item = Item::createItem('Cup', 1 , '1.00');34 $item = Item::createItem('Cup', 1); 79 35 $this->assertEquals('Cup', $item->getName()); 80 36 } … … 82 38 public function testGetQuantity() 83 39 { 84 $item = Item::createItem('Cup', 1 , '2.00');40 $item = Item::createItem('Cup', 1); 85 41 $this->assertEquals(1, $item->getQuantity()); 86 }87 88 public function testGetAmount()89 {90 $item = Item::createItem('Cup', 1, '1.00');91 $this->assertEquals('1.00', $item->getAmount());92 42 } 93 43 … … 95 45 public function testGetToArray() 96 46 { 97 $item = Item::createItem('Cup', 1 , '1.00');47 $item = Item::createItem('Cup', 1); 98 48 $this->assertEquals( 99 49 [ 100 50 'name' => 'Cup', 101 'quantity' => 1, 102 'amount' => '1.00' 51 'quantity' => 1 103 52 ], $item->toArray()); 104 53 } 105 106 54 }
Note: See TracChangeset
for help on using the changeset viewer.