├── tests
├── .gitignore
├── Bootstrap.php
├── phpunit.xml
├── CurrencyTest.php
├── ConfigurationTest.php
└── ClientTest.php
├── .gitignore
├── src
└── Payu
│ ├── Component
│ ├── ComponentInterface.php
│ ├── Currency.php
│ ├── Card.php
│ ├── Basket.php
│ ├── Product.php
│ ├── Billing.php
│ ├── Delivery.php
│ └── Order.php
│ ├── Exception
│ ├── BadResponseError.php
│ ├── ConnectionError.php
│ └── ValidationError.php
│ ├── Parser
│ ├── ParserInterface.php
│ ├── ResponseParser.php
│ ├── LoyaltyInquiryResponseParser.php
│ └── PaymentResponseParser.php
│ ├── Validator
│ ├── Validator
│ │ ├── DeliveryValidator.php
│ │ ├── BillingValidator.php
│ │ ├── ProductValidator.php
│ │ ├── ValidatorAbstract.php
│ │ ├── BasketValidator.php
│ │ ├── CardValidator.php
│ │ └── OrderValidator.php
│ ├── ValidatorAbstract.php
│ ├── LoyaltyInquiryRequestValidator.php
│ └── PaymentRequestValidator.php
│ ├── Request
│ ├── RequestAbstract.php
│ ├── LoyaltyInquiryRequest.php
│ └── PaymentRequest.php
│ ├── Serializer
│ ├── LoyaltyInquiryRequestSerializer.php
│ ├── SerializerAbstract.php
│ └── PaymentRequestSerializer.php
│ ├── Builder
│ ├── BuilderAbstract.php
│ ├── LoyaltyInquiryRequestBuilder.php
│ └── PaymentRequestBuilder.php
│ ├── Response
│ ├── PaymentResponse.php
│ ├── LoyaltyInquiryResponse.php
│ └── ResponseAbstract.php
│ ├── Client.php
│ └── Configuration.php
├── docs
├── contributors.md
├── index.md
├── birim_testlerin_calistirilmasi.md
├── 3d-secure-ile-satis.md
├── puan_kullanimi.md
├── puan_sorgulama.md
└── satis.md
├── composer.json
├── README.md
└── LICENSE.txt
/tests/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | vendor
3 | *.lock
4 | tests/testresults/
5 | .DS_Store
6 | *.swp
7 |
--------------------------------------------------------------------------------
/src/Payu/Component/ComponentInterface.php:
--------------------------------------------------------------------------------
1 | rawData = $rawData;
19 | return $this;
20 | }
21 |
22 | /**
23 | * @return array
24 | */
25 | public function getRawData()
26 | {
27 | return $this->rawData;
28 | }
29 |
30 | abstract public function getCard();
31 | }
--------------------------------------------------------------------------------
/src/Payu/Validator/ValidatorAbstract.php:
--------------------------------------------------------------------------------
1 | request = $request;
19 | }
20 |
21 |
22 |
23 | /**
24 | * @return void
25 | * @throws \Payu\Exception\ValidationError
26 | */
27 | abstract public function validate();
28 | }
--------------------------------------------------------------------------------
/tests/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
38 | * Return the current element
39 | * @link http://php.net/manual/en/iterator.current.php
40 | * @return mixed Can return any type.
41 | */
42 | public function current()
43 | {
44 | return current($this->collection);
45 | }
46 |
47 | /**
48 | * (PHP 5 >= 5.0.0)
49 | * Move forward to next element
50 | * @link http://php.net/manual/en/iterator.next.php
51 | * @return void Any returned value is ignored.
52 | */
53 | public function next()
54 | {
55 | return next($this->collection);
56 | }
57 |
58 | /**
59 | * (PHP 5 >= 5.0.0)
60 | * Return the key of the current element
61 | * @link http://php.net/manual/en/iterator.key.php
62 | * @return mixed scalar on success, or null on failure.
63 | */
64 | public function key()
65 | {
66 | return key($this->collection);
67 | }
68 |
69 | /**
70 | * (PHP 5 >= 5.0.0)
71 | * Checks if current position is valid
72 | * @link http://php.net/manual/en/iterator.valid.php
73 | * @return boolean The return value will be casted to boolean and then evaluated.
74 | * Returns true on success or false on failure.
75 | */
76 | public function valid()
77 | {
78 | return isset($this->collection[$this->key()]);
79 | }
80 |
81 | /**
82 | * (PHP 5 >= 5.0.0)
83 | * Rewind the Iterator to the first element
84 | * @link http://php.net/manual/en/iterator.rewind.php
85 | * @return void Any returned value is ignored.
86 | */
87 | public function rewind()
88 | {
89 | return reset($this->collection);
90 | }
91 |
92 | /**
93 | * (PHP 5 >= 5.1.0)
94 | * Count elements of an object
95 | * @link http://php.net/manual/en/countable.count.php
96 | * @return int The custom count as an integer.
97 | *
99 | * The return value is cast to an integer. 100 | */ 101 | public function count() 102 | { 103 | return count($this->collection); 104 | } 105 | 106 | /** 107 | * Return Total Price of Basket 108 | * 109 | * @return double 110 | */ 111 | public function getTotalPrice() 112 | { 113 | $sum = 0.0; 114 | /** @var $product \Payu\Component\Product */ 115 | foreach ($this->collection as $product) { 116 | $sum += ((int) $product->getQuantity() * (float) $product->getPrice()); 117 | } 118 | 119 | return $sum; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /docs/puan_sorgulama.md: -------------------------------------------------------------------------------- 1 | # Puan Sorgulama İşlemi 2 | 3 | Puan sorgulama işlemi, kredi kartına ilişkin bilgilerle dolu bir istek nesnesinin istemci üzerinden servis sağlayıcıya iletilmesi şeklinde gerçekleştirilir. 4 | 5 | ## İstemcinin Hazırlanması 6 | 7 | ```php 8 | use Payu\Client; 9 | use Payu\Configuration; 10 | 11 | $configuration = new Configuration(); 12 | 13 | $configuration 14 | ->setMerchantId('MY_MERCHANT_01') 15 | ->setSecretKey('SECRET_KEY') 16 | ->setLoyaltyInquiryEndPointUrl('https://secure.payu.com.tr/api/loyalty-points/check'); 17 | ; 18 | 19 | $client = new Client($configuration); 20 | ``` 21 | 22 | ## Puan Sorgulama İsteğinin Oluşturulması 23 | Puan Sorgulama İsteği, *Client* nesnesi üstündeki kurucu metodlar vasıtasyıla veya isteği oluşturan bileşenlerin ayrı ayrı oluşturulması ile kolayca oluşturulabilir. 24 | 25 | Aşağıdaki kod örneği ödeme isteğini *Client* nesnesi üzerindeki kurucu metodlarla gerçekleştirmektedir. 26 | 27 | ```php 28 | 29 | /** @var $request \Payu\Request\LoyaltyInquiryRequest */ 30 | $client = new Client($configuration); 31 | $request = $client->createLoyaltyInquiryRequestBuilder() 32 | ->buildCard('4282209027132016', '123', '5', '2019') 33 | ->buildCurrency('TRY') 34 | ->build(); 35 | ``` 36 | 37 | Aşağıdaki örnek kod ise istek nesnesini, kendisini oluşturan bileşenlerin manuel olarak oluşturulması ile yaratmaktadır. 38 | 39 | ```php 40 | use Payu\Component\Card; 41 | 42 | $card = new Card(); 43 | $card->setNumber('4282209027132016') 44 | ->setCvv('123') 45 | ->setMonth(5) 46 | ->setYear(2019); 47 | 48 | $currency = new Currency(); 49 | $currency->setCode('TRY'); 50 | 51 | /** @var $request \Payu\Request\LoyaltyInquiryRequest */ 52 | $request = $client->createLoyaltyInquiryRequestBuilder() 53 | ->setCard($card) 54 | ->setCurrency($currency) 55 | ->build(); 56 | ``` 57 | 58 | ## Sorgulama İşleminin Gerçekleştirilmesi 59 | Sorgulama işlemi, client nesnesinin makeLoyaltyInquiry() metodunun çağırılması ile gerçekleştirilir. 60 | 61 | ```php 62 | $response = $client->makeLoyaltyInquiry($request) 63 | ``` 64 | 65 | ## İşlem Sonucunun Kontrol Edilmesi 66 | 67 | ```php 68 | if ($response->getStatus() == ResponseAbstract::STATUS_APPROVED) { 69 | // Puan sorgulama işlemi başarılı bir şekilde gerçekleşti 70 | print_r($response); 71 | } else { 72 | // Puan sorgulama işleminde bir hata oluştu. 73 | echo $response->getMessage(); 74 | } 75 | 76 | ``` 77 | 78 | Son olarak herşeyi bir araya getirelim. 79 | ```php 80 | 81 | 82 | use Payu\Client; 83 | use Payu\Configuration; 84 | use Payu\Component\Card; 85 | use Payu\Component\Currency; 86 | 87 | $configuration = new Configuration(); 88 | $configuration->setMerchantId('MY_MERCHANT_01') 89 | ->setSecretKey('SECRET_KEY') 90 | ->setLoyaltyInquiryEndPointUrl('https://secure.payu.com.tr/api/loyalty-points/check'); 91 | 92 | $client = new Client($configuration); 93 | $request = $client->createLoyaltyInquiryRequestBuilder() 94 | ->buildCard('4282209027132016', '123', '5', '2019') 95 | ->buildCurrency('TRY') 96 | ->build(); 97 | 98 | $curreny = new Currency(); 99 | $curreny->setCode('TRY'); 100 | 101 | $response = $client->makeLoyaltyInquiry($request); 102 | 103 | if ($response->getStatus() == ResponseAbstract::STATUS_APPROVED) { 104 | // Puan sorgulama işlemi başarılı bir şekilde gerçekleşti 105 | print_r($response); 106 | } else { 107 | // Puan sorgulama işleminde bir hata oluştu. 108 | echo $response->getMessage(); 109 | } 110 | ``` 111 | -------------------------------------------------------------------------------- /src/Payu/Component/Product.php: -------------------------------------------------------------------------------- 1 | setName($name); 54 | $this->setCode($code); 55 | $this->setQuantity($quantity); 56 | $this->setInfo($info); 57 | $this->setPrice($price); 58 | $this->setVersion($version); 59 | $this->setVat($vat); 60 | } 61 | 62 | 63 | /** 64 | * @param string $code 65 | * @return $this 66 | */ 67 | public function setCode($code) 68 | { 69 | $this->code = $code; 70 | 71 | return $this; 72 | } 73 | 74 | /** 75 | * @return string 76 | */ 77 | public function getCode() 78 | { 79 | return $this->code; 80 | } 81 | 82 | /** 83 | * @param string $info 84 | * @return $this 85 | */ 86 | public function setInfo($info) 87 | { 88 | $this->info = $info; 89 | 90 | return $this; 91 | } 92 | 93 | /** 94 | * @return string 95 | */ 96 | public function getInfo() 97 | { 98 | return $this->info; 99 | } 100 | 101 | /** 102 | * @param string $name 103 | * @return $this 104 | */ 105 | public function setName($name) 106 | { 107 | $this->name = $name; 108 | 109 | return $this; 110 | } 111 | 112 | /** 113 | * @return string 114 | */ 115 | public function getName() 116 | { 117 | return $this->name; 118 | } 119 | 120 | /** 121 | * @param float $price 122 | * @return $this 123 | */ 124 | public function setPrice($price) 125 | { 126 | $this->price = $price; 127 | 128 | return $this; 129 | } 130 | 131 | /** 132 | * @return float 133 | */ 134 | public function getPrice() 135 | { 136 | return $this->price; 137 | } 138 | 139 | /** 140 | * @param integer $quantity 141 | * @return $this 142 | */ 143 | public function setQuantity($quantity) 144 | { 145 | $this->quantity = $quantity; 146 | 147 | return $this; 148 | } 149 | 150 | /** 151 | * @return integer 152 | */ 153 | public function getQuantity() 154 | { 155 | return $this->quantity; 156 | } 157 | 158 | /** 159 | * @param string $version 160 | * @return $this 161 | */ 162 | public function setVersion($version) 163 | { 164 | $this->version = $version; 165 | 166 | return $this; 167 | } 168 | 169 | /** 170 | * @return string 171 | */ 172 | public function getVersion() 173 | { 174 | return $this->version; 175 | } 176 | 177 | /** 178 | * Gets the value of vat. 179 | * 180 | * @return integer 181 | */ 182 | public function getVat() 183 | { 184 | return $this->vat; 185 | } 186 | 187 | /** 188 | * Sets the value of vat. 189 | * 190 | * @param integer $vat 191 | * 192 | * @return self 193 | */ 194 | public function setVat($vat) 195 | { 196 | $this->vat = $vat; 197 | 198 | return $this; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/Payu/Serializer/PaymentRequestSerializer.php: -------------------------------------------------------------------------------- 1 | request->getOrder(); 18 | 19 | $data = array( 20 | 'ORDER_REF' => $order->getCode(), 21 | 'ORDER_DATE' => $order->getDate(), 22 | 'PAY_METHOD' => $order->getPaymentMethod(), 23 | 'PRICES_CURRENCY' => $order->getCurrency(), 24 | 'SELECTED_INSTALLMENTS_NUMBER' => $order->getInstallment(), 25 | 'ORDER_TIMEOUT' => $order->getTimeout(), 26 | 'BACK_REF' => $this->configuration->getPaymentReturnPointUrl(), 27 | 'CLIENT_IP' => $order->getClientIp() 28 | ); 29 | 30 | if ((float) $order->getLoyaltyAmount() != 0) { 31 | $data['USE_LOYALTY_POINTS'] = 'YES'; 32 | if ((float) $order->getLoyaltyAmount() != (float) $this->request->getBasket()->getTotalPrice()) { 33 | $data['LOYALTY_POINTS_AMOUNT'] = (float) $order->getLoyaltyAmount(); 34 | } 35 | } 36 | 37 | if ($order->isRecurringPayment() === true) { 38 | $data['LU_ENABLE_TOKEN'] = 1; 39 | } 40 | 41 | return $data; 42 | } 43 | 44 | /** 45 | * @return array 46 | */ 47 | private function serializeBilling() 48 | { 49 | /** @var $billing \Payu\Component\Billing */ 50 | $billing = $this->request->getBilling(); 51 | 52 | return array( 53 | 'BILL_LNAME' => $billing->getLastName(), 54 | 'BILL_FNAME' => $billing->getFirstName(), 55 | 'BILL_EMAIL' => $billing->getEmail(), 56 | 'BILL_PHONE' => $billing->getPhone(), 57 | 'BILL_COUNTRYCODE' => $billing->getCountryCode(), 58 | 'BILL_FAX' => $billing->getFax(), 59 | 'BILL_ADDRESS' => $billing->getAddress(), 60 | 'BILL_ZIPCODE' => $billing->getZipCode(), 61 | 'BILL_CITY' => $billing->getCity(), 62 | 'BILL_STATE' => $billing->getState() 63 | ); 64 | } 65 | 66 | /** 67 | * @return array 68 | */ 69 | private function serializeDelivery() 70 | { 71 | /** @var $delivery \Payu\Component\Delivery */ 72 | $delivery = $this->request->getDelivery(); 73 | if (!$delivery) { 74 | return array(); 75 | } 76 | 77 | return array( 78 | 'DELIVERY_FNAME' => $delivery->getFirstName(), 79 | 'DELIVERY_LNAME' => $delivery->getLastName(), 80 | 'DELIVERY_EMAIL' => $delivery->getEmail(), 81 | 'DELIVERY_PHONE' => $delivery->getPhone(), 82 | 'DELIVERY_COMPANY' => $delivery->getCompany(), 83 | 'DELIVERY_ADDRESS' => $delivery->getAddress(), 84 | 'DELIVERY_ZIPCODE' => $delivery->getZipCode(), 85 | 'DELIVERY_CITY' => $delivery->getCity(), 86 | 'DELIVERY_STATE' => $delivery->getState(), 87 | 'DELIVERY_COUNTRYCODE' => $delivery->getCountryCode() 88 | ); 89 | } 90 | 91 | /** 92 | * @return array 93 | */ 94 | private function serializeBasket() 95 | { 96 | $i = 0; 97 | $data = array(); 98 | /** @var $product \Payu\Component\Product */ 99 | foreach ($this->request->getBasket() as $product) { 100 | $data['ORDER_PNAME[' . $i . ']'] = $product->getName(); 101 | $data['ORDER_PCODE[' . $i . ']'] = $product->getCode(); 102 | $data['ORDER_PRICE[' . $i . ']'] = $product->getPrice(); 103 | $data['ORDER_QTY[' . $i . ']'] = $product->getQuantity(); 104 | $data['ORDER_PINFO[' . $i . ']'] = $product->getInfo(); 105 | $data['ORDER_VER[' . $i . ']'] = $product->getVersion(); 106 | $data['ORDER_VAT[' . $i . ']'] = $product->getVat();; 107 | $i++; 108 | } 109 | 110 | return $data; 111 | } 112 | 113 | /** 114 | * @return array 115 | */ 116 | public function serialize() 117 | { 118 | $concatenatedData = array_merge( 119 | $this->serializeCard(), 120 | $this->serializeOrder(), 121 | $this->serializeBilling(), 122 | $this->serializeDelivery(), 123 | $this->serializeBasket() 124 | ); 125 | 126 | $filteredData = array_filter($concatenatedData); 127 | $filteredData['MERCHANT'] = $this->configuration->getMerchantId(); 128 | $filteredData['ORDER_HASH'] = $this->calculateHash($filteredData); 129 | 130 | return $filteredData; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/Payu/Component/Billing.php: -------------------------------------------------------------------------------- 1 | address = $address; 63 | return $this; 64 | } 65 | 66 | /** 67 | * @return string 68 | */ 69 | public function getAddress() 70 | { 71 | return $this->address; 72 | } 73 | 74 | /** 75 | * @param string $city 76 | * @return $this 77 | */ 78 | public function setCity($city) 79 | { 80 | $this->city = $city; 81 | return $this; 82 | } 83 | 84 | /** 85 | * @return string 86 | */ 87 | public function getCity() 88 | { 89 | return $this->city; 90 | } 91 | 92 | /** 93 | * @param string $countryCode 94 | * @return $this 95 | */ 96 | public function setCountryCode($countryCode) 97 | { 98 | $this->countryCode = $countryCode; 99 | return $this; 100 | } 101 | 102 | /** 103 | * @return string 104 | */ 105 | public function getCountryCode() 106 | { 107 | return $this->countryCode; 108 | } 109 | 110 | /** 111 | * @param string $email 112 | * @return $this 113 | */ 114 | public function setEmail($email) 115 | { 116 | $this->email = $email; 117 | return $this; 118 | } 119 | 120 | /** 121 | * @return string 122 | */ 123 | public function getEmail() 124 | { 125 | return $this->email; 126 | } 127 | 128 | /** 129 | * @param string $fax 130 | * @return $this 131 | */ 132 | public function setFax($fax) 133 | { 134 | $this->fax = $fax; 135 | return $this; 136 | } 137 | 138 | /** 139 | * @return string 140 | */ 141 | public function getFax() 142 | { 143 | return $this->fax; 144 | } 145 | 146 | /** 147 | * @param string $firstName 148 | * @return $this 149 | */ 150 | public function setFirstName($firstName) 151 | { 152 | $this->firstName = $firstName; 153 | return $this; 154 | } 155 | 156 | /** 157 | * @return string 158 | */ 159 | public function getFirstName() 160 | { 161 | return $this->firstName; 162 | } 163 | 164 | /** 165 | * @param string $lastName 166 | * @return $this 167 | */ 168 | public function setLastName($lastName) 169 | { 170 | $this->lastName = $lastName; 171 | return $this; 172 | } 173 | 174 | /** 175 | * @return string 176 | */ 177 | public function getLastName() 178 | { 179 | return $this->lastName; 180 | } 181 | 182 | /** 183 | * @param string $phone 184 | * @return $this 185 | */ 186 | public function setPhone($phone) 187 | { 188 | $this->phone = $phone; 189 | return $this; 190 | } 191 | 192 | /** 193 | * @return string 194 | */ 195 | public function getPhone() 196 | { 197 | return $this->phone; 198 | } 199 | 200 | /** 201 | * @param string $state 202 | * @return $this 203 | */ 204 | public function setState($state) 205 | { 206 | $this->state = $state; 207 | return $this; 208 | } 209 | 210 | /** 211 | * @return string 212 | */ 213 | public function getState() 214 | { 215 | return $this->state; 216 | } 217 | 218 | /** 219 | * @param string $zipCode 220 | * @return $this 221 | */ 222 | public function setZipCode($zipCode) 223 | { 224 | $this->zipCode = $zipCode; 225 | return $this; 226 | } 227 | 228 | /** 229 | * @return string 230 | */ 231 | public function getZipCode() 232 | { 233 | return $this->zipCode; 234 | } 235 | 236 | public function __construct( 237 | $firstName = null, 238 | $lastName = null, 239 | $email = null, 240 | $phone = null, 241 | $fax = null, 242 | $address = null, 243 | $zipCode = null, 244 | $city = null, 245 | $state = null, 246 | $countryCode = 'TR' 247 | ) { 248 | $this->setFirstName($firstName); 249 | $this->setLastName($lastName); 250 | $this->setEmail($email); 251 | $this->setPhone($phone); 252 | $this->setFax($fax); 253 | $this->setAddress($address); 254 | $this->setZipCode($zipCode); 255 | $this->setCity($city); 256 | $this->setState($state); 257 | $this->setCountryCode($countryCode); 258 | } 259 | } -------------------------------------------------------------------------------- /src/Payu/Component/Delivery.php: -------------------------------------------------------------------------------- 1 | address = $address; 63 | return $this; 64 | } 65 | 66 | /** 67 | * @return string 68 | */ 69 | public function getAddress() 70 | { 71 | return $this->address; 72 | } 73 | 74 | /** 75 | * @param string $city 76 | * @return $this 77 | */ 78 | public function setCity($city) 79 | { 80 | $this->city = $city; 81 | return $this; 82 | } 83 | 84 | /** 85 | * @return string 86 | */ 87 | public function getCity() 88 | { 89 | return $this->city; 90 | } 91 | 92 | /** 93 | * @param string $company 94 | * @return $this 95 | */ 96 | public function setCompany($company) 97 | { 98 | $this->company = $company; 99 | return $this; 100 | } 101 | 102 | /** 103 | * @return string 104 | */ 105 | public function getCompany() 106 | { 107 | return $this->company; 108 | } 109 | 110 | /** 111 | * @param string $countryCode 112 | * @return $this 113 | */ 114 | public function setCountryCode($countryCode) 115 | { 116 | $this->countryCode = $countryCode; 117 | return $this; 118 | } 119 | 120 | /** 121 | * @return string 122 | */ 123 | public function getCountryCode() 124 | { 125 | return $this->countryCode; 126 | } 127 | 128 | /** 129 | * @param string $email 130 | * @return $this 131 | */ 132 | public function setEmail($email) 133 | { 134 | $this->email = $email; 135 | return $this; 136 | } 137 | 138 | /** 139 | * @return string 140 | */ 141 | public function getEmail() 142 | { 143 | return $this->email; 144 | } 145 | 146 | /** 147 | * @param string $firstName 148 | * @return $this 149 | */ 150 | public function setFirstName($firstName) 151 | { 152 | $this->firstName = $firstName; 153 | return $this; 154 | } 155 | 156 | /** 157 | * @return string 158 | */ 159 | public function getFirstName() 160 | { 161 | return $this->firstName; 162 | } 163 | 164 | /** 165 | * @param string $lastName 166 | * @return $this 167 | */ 168 | public function setLastName($lastName) 169 | { 170 | $this->lastName = $lastName; 171 | return $this; 172 | } 173 | 174 | /** 175 | * @return string 176 | */ 177 | public function getLastName() 178 | { 179 | return $this->lastName; 180 | } 181 | 182 | /** 183 | * @param string $phone 184 | * @return $this 185 | */ 186 | public function setPhone($phone) 187 | { 188 | $this->phone = $phone; 189 | return $this; 190 | } 191 | 192 | /** 193 | * @return string 194 | */ 195 | public function getPhone() 196 | { 197 | return $this->phone; 198 | } 199 | 200 | /** 201 | * @param string $state 202 | * @return $this 203 | */ 204 | public function setState($state) 205 | { 206 | $this->state = $state; 207 | return $this; 208 | } 209 | 210 | /** 211 | * @return string 212 | */ 213 | public function getState() 214 | { 215 | return $this->state; 216 | } 217 | 218 | /** 219 | * @param string $zipCode 220 | * @return $this 221 | */ 222 | public function setZipCode($zipCode) 223 | { 224 | $this->zipCode = $zipCode; 225 | return $this; 226 | } 227 | 228 | /** 229 | * @return string 230 | */ 231 | public function getZipCode() 232 | { 233 | return $this->zipCode; 234 | } 235 | 236 | public function __construct( 237 | $firstName = null, 238 | $lastName = null, 239 | $email = null, 240 | $phone = null, 241 | $company = null, 242 | $address = null, 243 | $zipCode = null, 244 | $city = null, 245 | $state = null, 246 | $countryCode = null 247 | ) { 248 | $this->setFirstName($firstName); 249 | $this->setLastName($lastName); 250 | $this->setEmail($email); 251 | $this->setPhone($phone); 252 | $this->setCompany($company); 253 | $this->setAddress($address); 254 | $this->setZipCode($zipCode); 255 | $this->setCity($city); 256 | $this->setState($state); 257 | $this->setCountryCode($countryCode); 258 | } 259 | } -------------------------------------------------------------------------------- /src/Payu/Component/Order.php: -------------------------------------------------------------------------------- 1 | setCode($code); 64 | $this->setClientIp($clientIp); 65 | $this->setInstallment($installment); 66 | $this->setCurrency($currency); 67 | $this->setLoyaltyAmount($loyaltyAmount); 68 | $this->setPaymentMethod($paymentMethod); 69 | $this->setDate($date); 70 | $this->setTimeout($timeout); 71 | $this->setRecurringPayment($recurringPayment); 72 | } 73 | 74 | /** 75 | * @param string $clientIp 76 | * @return $this 77 | */ 78 | public function setClientIp($clientIp) 79 | { 80 | $this->clientIp = $clientIp; 81 | 82 | return $this; 83 | } 84 | 85 | /** 86 | * @return string 87 | */ 88 | public function getClientIp() 89 | { 90 | return $this->clientIp; 91 | } 92 | 93 | /** 94 | * @param string $code 95 | * @return $this 96 | */ 97 | public function setCode($code) 98 | { 99 | $this->code = $code; 100 | 101 | return $this; 102 | } 103 | 104 | /** 105 | * @return string 106 | */ 107 | public function getCode() 108 | { 109 | return $this->code; 110 | } 111 | 112 | /** 113 | * @param string $currency 114 | * @return $this 115 | */ 116 | public function setCurrency($currency) 117 | { 118 | $this->currency = $currency; 119 | 120 | return $this; 121 | } 122 | 123 | /** 124 | * @return string 125 | */ 126 | public function getCurrency() 127 | { 128 | return $this->currency; 129 | } 130 | 131 | /** 132 | * @param string $date 133 | * @return $this 134 | */ 135 | public function setDate($date) 136 | { 137 | $this->date = $date != null ? $date : gmdate('Y-m-d H:i:s'); 138 | 139 | return $this; 140 | } 141 | 142 | /** 143 | * @return string 144 | */ 145 | public function getDate() 146 | { 147 | return $this->date; 148 | } 149 | 150 | /** 151 | * @param int $installment 152 | * @return $this 153 | */ 154 | public function setInstallment($installment) 155 | { 156 | $this->installment = $installment; 157 | 158 | return $this; 159 | } 160 | 161 | /** 162 | * @return int 163 | */ 164 | public function getInstallment() 165 | { 166 | return $this->installment; 167 | } 168 | 169 | /** 170 | * @param float $loyaltyAmount 171 | * @return $this 172 | */ 173 | public function setLoyaltyAmount($loyaltyAmount) 174 | { 175 | $this->loyaltyAmount = $loyaltyAmount; 176 | 177 | return $this; 178 | } 179 | 180 | /** 181 | * @return float 182 | */ 183 | public function getLoyaltyAmount() 184 | { 185 | return $this->loyaltyAmount; 186 | } 187 | 188 | /** 189 | * @param string $paymentMethod 190 | * @return $this 191 | */ 192 | public function setPaymentMethod($paymentMethod) 193 | { 194 | $this->paymentMethod = $paymentMethod; 195 | 196 | return $this; 197 | } 198 | 199 | /** 200 | * @return string 201 | */ 202 | public function getPaymentMethod() 203 | { 204 | return $this->paymentMethod; 205 | } 206 | 207 | /** 208 | * @param int $timeout 209 | * @return $this 210 | */ 211 | public function setTimeout($timeout) 212 | { 213 | $this->timeout = $timeout; 214 | 215 | return $this; 216 | } 217 | 218 | /** 219 | * @return int 220 | */ 221 | public function getTimeout() 222 | { 223 | return $this->timeout; 224 | } 225 | 226 | 227 | /** 228 | * Gets the value of recurringPayment. 229 | * 230 | * @return bool 231 | */ 232 | public function isRecurringPayment() 233 | { 234 | return $this->recurringPayment; 235 | } 236 | 237 | /** 238 | * Sets the value of recurringPayment. 239 | * 240 | * @param bool $recurringPayment the recurring payment 241 | * 242 | * @return self 243 | */ 244 | public function setRecurringPayment($recurringPayment) 245 | { 246 | $this->recurringPayment = (bool)$recurringPayment; 247 | 248 | return $this; 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /src/Payu/Builder/PaymentRequestBuilder.php: -------------------------------------------------------------------------------- 1 | order = new Order( 59 | $code, 60 | $clientIp, 61 | $installment, 62 | $currency, 63 | $loyaltyAmount, 64 | $paymentMethod, 65 | $date, 66 | $timeout, 67 | $recurringPayment 68 | ); 69 | return $this; 70 | } 71 | 72 | /** 73 | * @param Order $order 74 | * @return $this 75 | */ 76 | public function setOrder(Order $order) 77 | { 78 | $this->order = $order; 79 | return $this; 80 | } 81 | 82 | /** 83 | * @param null $firstName 84 | * @param null $lastName 85 | * @param null $email 86 | * @param null $phone 87 | * @param null $fax 88 | * @param null $address 89 | * @param null $zipCode 90 | * @param null $city 91 | * @param null $state 92 | * @param null $countryCode 93 | * @return $this 94 | */ 95 | public function buildBilling( 96 | $firstName = null, 97 | $lastName = null, 98 | $email = null, 99 | $phone = null, 100 | $fax = null, 101 | $address = null, 102 | $zipCode = null, 103 | $city = null, 104 | $state = null, 105 | $countryCode = null 106 | ) 107 | { 108 | $this->billing = new Billing( 109 | $firstName, 110 | $lastName, 111 | $email, 112 | $phone, 113 | $fax, 114 | $address, 115 | $zipCode, 116 | $city, 117 | $state, 118 | $countryCode 119 | ); 120 | return $this; 121 | } 122 | 123 | /** 124 | * @param Billing $billing 125 | * @return $this 126 | */ 127 | public function setBilling(Billing $billing) 128 | { 129 | $this->billing = $billing; 130 | return $this; 131 | } 132 | 133 | /** 134 | * @param null $firstName 135 | * @param null $lastName 136 | * @param null $email 137 | * @param null $phone 138 | * @param null $company 139 | * @param null $address 140 | * @param null $zipCode 141 | * @param null $city 142 | * @param null $state 143 | * @param null $countryCode 144 | * @return $this 145 | */ 146 | public function buildDeliverys( 147 | $firstName = null, 148 | $lastName = null, 149 | $email = null, 150 | $phone = null, 151 | $company = null, 152 | $address = null, 153 | $zipCode = null, 154 | $city = null, 155 | $state = null, 156 | $countryCode = null 157 | ) 158 | { 159 | $this->delivery = new Delivery( 160 | $firstName, 161 | $lastName, 162 | $email, 163 | $phone, 164 | $company, 165 | $address, 166 | $zipCode, 167 | $city, 168 | $state, 169 | $countryCode 170 | ); 171 | return $this; 172 | } 173 | 174 | /** 175 | * @param Delivery $delivery 176 | * @return $this 177 | */ 178 | public function setDelivery(Delivery $delivery) 179 | { 180 | $this->delivery = $delivery; 181 | return $this; 182 | } 183 | 184 | /** 185 | * @param null $name 186 | * @param null $code 187 | * @param null $quantity 188 | * @param null $info 189 | * @param null $price 190 | * @param null $version 191 | * @return $this 192 | */ 193 | public function buildAndAddProduct( 194 | $name = null, 195 | $code = null, 196 | $quantity = null, 197 | $info = null, 198 | $price = null, 199 | $version = null, 200 | $vat = null 201 | ) { 202 | 203 | $this->basket->add(new Product($name, $code, $quantity, $info, $price, $version, $vat)); 204 | return $this; 205 | } 206 | 207 | /** 208 | * @param Product $product 209 | * @return $this 210 | */ 211 | public function addProduct(Product $product) 212 | { 213 | $this->basket->add($product); 214 | return $this; 215 | } 216 | 217 | public function __construct(Configuration $configuration) 218 | { 219 | parent::__construct($configuration); 220 | $this->basket = new Basket(); 221 | } 222 | 223 | public function build() 224 | { 225 | $request = new PaymentRequest($this->card, $this->order, $this->billing, $this->delivery, $this->basket); 226 | 227 | $validator = new PaymentRequestValidator($request); 228 | $validator->validate(); 229 | 230 | $serializer = new PaymentRequestSerializer($request, $this->configuration); 231 | $rawData = $serializer->serialize(); 232 | 233 | $request->setRawData($rawData); 234 | 235 | return $request; 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /docs/satis.md: -------------------------------------------------------------------------------- 1 | # Satış 2 | 3 | Satılan mal ya da hizmet karşılığında kullanıcının ödeme aracından (Kredi kartı vb.) para tahsilatı yapmak için gerçekleştirilen işlemdir. PayuClient ile satış işlemini gerçekleştirmek için aşağıdaki yönergeleri takip edebilirsiniz. 4 | 5 | ## Konfigürasyon ve İstemciyi Hazırlamak 6 | 7 | PayuClient kullanarak satış işlemi gerçekleştirmek için, payu tarafından sağlanan erişim bilgilerinin kütüphaneye bildirilmesini sağlayacak **Payu\Configuration** tipinde bir nesne oluşturarak istemciye kurulum sırasında argüman olarak göndermelisiniz. 8 | 9 | ```php 10 | use Payu\Client; 11 | use Payu\Configuration; 12 | 13 | $configuration = new Configuration(); 14 | 15 | $configuration->setMerchantId('MY_MERCHANT_01') 16 | ->setSecretKey('SECRET_KEY') 17 | ->setPaymentEndpointUrl('https://secure.payu.com.tr/order/alu/v3'); 18 | 19 | $client = new Client($configuration); 20 | ``` 21 | 22 | ## Satış İsteği Oluşturma 23 | 24 | İstek oluşturma işlemini gerçekleştirmeki için kütüphane ile sağlanan kurucu metodları kullanabilirsiniz. Kurucu metodlar, istekle ilgil bileşenleri doğrudan veya yardımcı kurucu metodlarla alabilirler. 25 | 26 | ### Yardımcı Kurucu Metodlarla Satış İsteğinin Oluşturması 27 | 28 | ```php 29 | /** @var $request \Payu\Request\PaymentRequest */ 30 | $request = $client->createPaymentRequestBuilder() 31 | ->buildCard('4282209027132016', '123', 5, 2019) 32 | ->buildOrder('ORDERNO123456', '127.0.0.1') 33 | ->buildBilling('John', 'Smith', 'test@test.net', '05321231212') 34 | ->buildAndAddProduct('The Product', 'PR1', 1, 10) 35 | ->build(); 36 | ``` 37 | 38 | ### Bileşenlerle Satış İsteğinin Oluşturulması 39 | 40 | ```php 41 | use Payu\Component\Card; 42 | use Payu\Component\Order; 43 | use Payu\Component\Billing; 44 | use Payu\Component\Product; 45 | 46 | $card = new Card(); 47 | $card->setNumber('4282209027132016') 48 | ->setCvv('123') 49 | ->setMonth(5) 50 | ->setYear(2019); 51 | 52 | $order = new Order(); 53 | $order->setCode('ORDERNO123456') 54 | ->setClientIp('127.0.0.1'); 55 | 56 | $billing = new Billing(); 57 | $billing->setFirstName('John') 58 | ->setLastName('Smith') 59 | ->setPhone('05321231212') 60 | ->setEmail('test@test.net'); 61 | 62 | 63 | $product = new Product(); 64 | $product->setCode('PR1') 65 | ->setName('The Product') 66 | ->setQuantity(1) 67 | ->setPrice(10); 68 | 69 | /** @var $request \Payu\Request\PaymentRequest */ 70 | $request = $client->createPaymentRequestBuilder() 71 | ->setCard($card) 72 | ->setOrder($order) 73 | ->setBilling($billing) 74 | ->addProduct($product) 75 | ->build(); 76 | ``` 77 | 78 | ## Satış İşleminin Gerçekleştirilmesi 79 | 80 | ```php 81 | /** 82 | * @var $request \Payu\Request\PaymentRequest 83 | * @var $response \Payu\Response\PaymentResponse 84 | */ 85 | $response = $client->makePayment($request) 86 | 87 | if($response->getStatus() == ResponseAbstract::STATUS_APPROVED) { 88 | /* 89 | // Odeme islemi basariyla gerceklesti. 90 | echo $response->getTransactionId() 91 | */ 92 | } else { 93 | /* 94 | // Odeme islemi hatali oldu 95 | 96 | echo $response->getCode(); 97 | echo $response->getMessage(); 98 | */ 99 | } 100 | ``` 101 | 102 | ## [Peşin Satış İşlemi](#pesin-satis) 103 | ```php 104 | use Payu\Client; 105 | use Payu\Configuration; 106 | use Payu\Component\Card; 107 | use Payu\Component\Order; 108 | use Payu\Component\Billing; 109 | use Payu\Component\Product; 110 | 111 | // Satis islemi icin istemciyi hazirliyoruz. 112 | $configuration = new Configuration(); 113 | 114 | $configuration->setMerchantId('MY_MERCHANT_01') 115 | ->setSecretKey('SECRET_KEY') 116 | ->setPaymentEndpointUrl('https://secure.payu.com.tr/order/alu/v3'); 117 | 118 | $client = new Client($configuration); 119 | 120 | $card = new Card(); 121 | $card->setNumber('4282209027132016') 122 | ->setCvv('123') 123 | ->setMonth(5) 124 | ->setYear(2019); 125 | 126 | $order = new Order(); 127 | $order->setCode('ORDERNO123456') 128 | ->setClientIp('127.0.0.1'); 129 | 130 | $billing = new Billing(); 131 | $billing->setFirstName('John') 132 | ->setLastName('Smith') 133 | ->setPhone('05321231212') 134 | ->setEmail('test@test.net'); 135 | 136 | 137 | $product = new Product(); 138 | $product->setCode('PR1') 139 | ->setName('The Product') 140 | ->setQuantity(1) 141 | ->setPrice(10); 142 | 143 | /** @var $request \Payu\Request\PaymentRequest */ 144 | $request = $client->createPaymentRequestBuilder() 145 | ->setCard($card) 146 | ->setOrder($order) 147 | ->setBilling($billing) 148 | ->addProduct($product) 149 | ->build(); 150 | 151 | /** 152 | * @var $request \Payu\Request\PaymentRequest 153 | * @var $response \Payu\Response\PaymentResponse 154 | */ 155 | $response = $client->makePayment($request) 156 | 157 | if($response->getStatus() == ResponseAbstract::STATUS_APPROVED) { 158 | /* 159 | // Odeme islemi basariyla gerceklesti. 160 | echo $response->getTransactionId() 161 | */ 162 | } else { 163 | /* 164 | // Odeme islemi hatali oldu 165 | 166 | echo $response->getCode(); 167 | echo $response->getMessage(); 168 | */ 169 | } 170 | 171 | ``` 172 | 173 | ## [Taksitli Satış İşlemi](#taksitli-satis) 174 | 175 | Taksitli satış işlemi gerçekleştirilirken, taksit bilgisi, **buildOrder** yardımcı kurucu metodunun 3. parametresi olan $installment parametresi ile veya **Payu\Component\Order** sınıfının **setInstallment** metodu ile gönderileiblir. 176 | 177 | ```php 178 | //... 179 | ->buildOrder('ORDERNO123456', '127.0.0.1', 3) 180 | //... 181 | ``` 182 | veya 183 | ```php 184 | $order = new Order(); 185 | $order->setCode('ORDERNO123456') 186 | ->setClientIp('127.0.0.1') 187 | //... 188 | ->setInstallment(3); 189 | 190 | ``` 191 | 192 | ## [Tekrarlayan Ödeme İşlemi](#tekrarlayan-odeme) 193 | 194 | Tekrarlayan ödeme işlemi gerçekleştirilirken, işlemin tekrarlayan ödeme olup olmadığı bilgisi, **buildOrder** yardımcı kurucu metodununa 9. parametresi olan $recurringPayment parametresi ile veya **Payu\Component\Order** sınıfının **setRecurringPayment** metodu ile gönderileiblir. 195 | 196 | ```php 197 | //... 198 | ->buildOrder('ORDERNO123456', '127.0.0.1', ..., true) 199 | //... 200 | ``` 201 | veya 202 | ```php 203 | $order = new Order(); 204 | $order->setCode('ORDERNO123456') 205 | ->setClientIp('127.0.0.1') 206 | //... 207 | ->setRecurringPayment(true); 208 | ``` 209 | -------------------------------------------------------------------------------- /src/Payu/Validator/Validator/OrderValidator.php: -------------------------------------------------------------------------------- 1 | request->getOrder(); 21 | 22 | // Get currency from order instance 23 | try { 24 | static::filterAndValidateCurrencyCode($object->getCurrency()); 25 | } catch (\Exception $e) { 26 | throw new ValidationError($e->getMessage()); 27 | } 28 | } 29 | 30 | /** 31 | * @return void 32 | * @throws \Payu\Exception\ValidationError 33 | */ 34 | protected function validateObject() 35 | { 36 | /** 37 | * @var $object \Payu\Component\Order 38 | */ 39 | $object = $this->request->getOrder(); 40 | 41 | if (!$object || !$object instanceof Order) { 42 | throw new ValidationError('Order does not be empty.'); 43 | } 44 | } 45 | 46 | /** 47 | * Filters and validates given currency code. 48 | * 49 | * @param string $code Currency code to filter and validate. 50 | * @throws \InvalidArgumentException 51 | * @return string Three letter currency code. 52 | */ 53 | public static function filterAndValidateCurrencyCode($code) 54 | { 55 | $code = strtoupper(preg_replace('/[^a-zA-Z]/', '', $code)); 56 | 57 | if (array_key_exists($code, static::getAvailableCurrencies()) === false) { 58 | throw new \InvalidArgumentException('Currency code "'.$code.'" is not a valid ISO 4217 symbol'); 59 | } 60 | 61 | return $code; 62 | } 63 | 64 | /** 65 | * Returns official list of ISO 4217 currency codes. 66 | * 67 | * @link http://www.iso.org/iso/home/standards/currency_codes.htm 68 | * 69 | * @return array 70 | */ 71 | public static function getAvailableCurrencies() 72 | { 73 | return array( 74 | 'AFN' => 'Afghani', 75 | 'EUR' => 'Euro', 76 | 'ALL' => 'Lek', 77 | 'DZD' => 'Algerian Dinar', 78 | 'USD' => 'US Dollar', 79 | 'AOA' => 'Kwanza', 80 | 'XCD' => 'East Caribbean Dollar', 81 | 'ARS' => 'Argentine Peso', 82 | 'AMD' => 'Armenian Dram', 83 | 'AWG' => 'Aruban Florin', 84 | 'AUD' => 'Australian Dollar', 85 | 'AZN' => 'Azerbaijanian Manat', 86 | 'BSD' => 'Bahamian Dollar', 87 | 'BHD' => 'Bahraini Dinar', 88 | 'BDT' => 'Taka', 89 | 'BBD' => 'Barbados Dollar', 90 | 'BYR' => 'Belarussian Ruble', 91 | 'BZD' => 'Belize Dollar', 92 | 'XOF' => 'CFA Franc BCEAO', 93 | 'BMD' => 'Bermudian Dollar', 94 | 'BTN' => 'Ngultrum', 95 | 'INR' => 'Indian Rupee', 96 | 'BOB' => 'Boliviano', 97 | 'BOV' => 'Mvdol', 98 | 'BAM' => 'Convertible Mark', 99 | 'BWP' => 'Pula', 100 | 'NOK' => 'Norwegian Krone', 101 | 'BRL' => 'Brazilian Real', 102 | 'BND' => 'Brunei Dollar', 103 | 'BGN' => 'Bulgarian Lev', 104 | 'BIF' => 'Burundi Franc', 105 | 'CVE' => 'Cabo Verde Escudo', 106 | 'KHR' => 'Riel', 107 | 'XAF' => 'CFA Franc BEAC', 108 | 'CAD' => 'Canadian Dollar', 109 | 'KYD' => 'Cayman Islands Dollar', 110 | 'CLF' => 'Unidad de Fomento', 111 | 'CLP' => 'Chilean Peso', 112 | 'CNY' => 'Yuan Renminbi', 113 | 'COP' => 'Colombian Peso', 114 | 'COU' => 'Unidad de Valor Real', 115 | 'KMF' => 'Comoro Franc', 116 | 'CDF' => 'Congolese Franc', 117 | 'NZD' => 'New Zealand Dollar', 118 | 'CRC' => 'Costa Rican Colon', 119 | 'HRK' => 'Kuna', 120 | 'CUC' => 'Peso Convertible', 121 | 'CUP' => 'Cuban Peso', 122 | 'ANG' => 'Netherlands Antillean Guilder', 123 | 'CZK' => 'Czech Koruna', 124 | 'DKK' => 'Danish Krone', 125 | 'DJF' => 'Djibouti Franc', 126 | 'DOP' => 'Dominican Peso', 127 | 'EGP' => 'Egyptian Pound', 128 | 'SVC' => 'El Salvador Colon', 129 | 'ERN' => 'Nakfa', 130 | 'ETB' => 'Ethiopian Birr', 131 | 'FKP' => 'Falkland Islands Pound', 132 | 'FJD' => 'Fiji Dollar', 133 | 'XPF' => 'CFP Franc', 134 | 'GMD' => 'Dalasi', 135 | 'GEL' => 'Lari', 136 | 'GHS' => 'Ghana Cedi', 137 | 'GIP' => 'Gibraltar Pound', 138 | 'GTQ' => 'Quetzal', 139 | 'GBP' => 'Pound Sterling', 140 | 'GNF' => 'Guinea Franc', 141 | 'GYD' => 'Guyana Dollar', 142 | 'HTG' => 'Gourde', 143 | 'HNL' => 'Lempira', 144 | 'HKD' => 'Hong Kong Dollar', 145 | 'HUF' => 'Forint', 146 | 'ISK' => 'Iceland Krona', 147 | 'IDR' => 'Rupiah', 148 | 'XDR' => 'SDR Special Drawing Right', 149 | 'IRR' => 'Iranian Rial', 150 | 'IQD' => 'Iraqi Dinar', 151 | 'ILS' => 'New Israeli Sheqel', 152 | 'JMD' => 'Jamaican Dollar', 153 | 'JPY' => 'Yen', 154 | 'JOD' => 'Jordanian Dinar', 155 | 'KZT' => 'Tenge', 156 | 'KES' => 'Kenyan Shilling', 157 | 'KPW' => 'North Korean Won', 158 | 'KRW' => 'Won', 159 | 'KWD' => 'Kuwaiti Dinar', 160 | 'KGS' => 'Som', 161 | 'LAK' => 'Kip', 162 | 'LBP' => 'Lebanese Pound', 163 | 'LSL' => 'Loti', 164 | 'ZAR' => 'Rand', 165 | 'LRD' => 'Liberian Dollar', 166 | 'LYD' => 'Libyan Dinar', 167 | 'CHF' => 'Swiss Franc', 168 | 'MOP' => 'Pataca', 169 | 'MKD' => 'Denar', 170 | 'MGA' => 'Malagasy Ariary', 171 | 'MWK' => 'Kwacha', 172 | 'MYR' => 'Malaysian Ringgit', 173 | 'MVR' => 'Rufiyaa', 174 | 'MRO' => 'Ouguiya', 175 | 'MUR' => 'Mauritius Rupee', 176 | 'XUA' => 'ADB Unit of Account', 177 | 'MXN' => 'Mexican Peso', 178 | 'MXV' => 'Mexican Unidad de Inversion UDI', 179 | 'MDL' => 'Moldovan Leu', 180 | 'MNT' => 'Tugrik', 181 | 'MAD' => 'Moroccan Dirham', 182 | 'MZN' => 'Mozambique Metical', 183 | 'MMK' => 'Kyat', 184 | 'NAD' => 'Namibia Dollar', 185 | 'NPR' => 'Nepalese Rupee', 186 | 'NIO' => 'Cordoba Oro', 187 | 'NGN' => 'Naira', 188 | 'OMR' => 'Rial Omani', 189 | 'PKR' => 'Pakistan Rupee', 190 | 'PAB' => 'Balboa', 191 | 'PGK' => 'Kina', 192 | 'PYG' => 'Guarani', 193 | 'PEN' => 'Nuevo Sol', 194 | 'PHP' => 'Philippine Peso', 195 | 'PLN' => 'Zloty', 196 | 'QAR' => 'Qatari Rial', 197 | 'RON' => 'Romanian Leu', 198 | 'RUB' => 'Russian Ruble', 199 | 'RWF' => 'Rwanda Franc', 200 | 'SHP' => 'Saint Helena Pound', 201 | 'WST' => 'Tala', 202 | 'STD' => 'Dobra', 203 | 'SAR' => 'Saudi Riyal', 204 | 'RSD' => 'Serbian Dinar', 205 | 'SCR' => 'Seychelles Rupee', 206 | 'SLL' => 'Leone', 207 | 'SGD' => 'Singapore Dollar', 208 | 'XSU' => 'Sucre', 209 | 'SBD' => 'Solomon Islands Dollar', 210 | 'SOS' => 'Somali Shilling', 211 | 'SSP' => 'South Sudanese Pound', 212 | 'LKR' => 'Sri Lanka Rupee', 213 | 'SDG' => 'Sudanese Pound', 214 | 'SRD' => 'Surinam Dollar', 215 | 'SZL' => 'Lilangeni', 216 | 'SEK' => 'Swedish Krona', 217 | 'CHE' => 'WIR Euro', 218 | 'CHW' => 'WIR Franc', 219 | 'SYP' => 'Syrian Pound', 220 | 'TWD' => 'New Taiwan Dollar', 221 | 'TJS' => 'Somoni', 222 | 'TZS' => 'Tanzanian Shilling', 223 | 'THB' => 'Baht', 224 | 'TOP' => 'Paanga', 225 | 'TTD' => 'Trinidad and Tobago Dollar', 226 | 'TND' => 'Tunisian Dinar', 227 | 'TRY' => 'Turkish Lira', 228 | 'TMT' => 'Turkmenistan New Manat', 229 | 'UGX' => 'Uganda Shilling', 230 | 'UAH' => 'Hryvnia', 231 | 'AED' => 'UAE Dirham', 232 | 'USN' => 'US Dollar Next day', 233 | 'UYI' => 'Uruguay Peso en Unidades Indexadas URUIURUI', 234 | 'UYU' => 'Peso Uruguayo', 235 | 'UZS' => 'Uzbekistan Sum', 236 | 'VUV' => 'Vatu', 237 | 'VEF' => 'Bolivar', 238 | 'VND' => 'Dong', 239 | 'YER' => 'Yemeni Rial', 240 | 'ZMW' => 'Zambian Kwacha', 241 | 'ZWL' => 'Zimbabwe Dollar', 242 | 'XBA' => 'Bond Markets Unit European Composite Unit EURCO', 243 | 'XBB' => 'Bond Markets Unit European Monetary Unit EMU6', 244 | 'XBC' => 'Bond Markets Unit European Unit of Account 9 EUA9', 245 | 'XBD' => 'Bond Markets Unit European Unit of Account 17 EUA17', 246 | 'XTS' => 'Codes specifically reserved for testing purposes', 247 | 'XAU' => 'Gold', 248 | 'XPD' => 'Palladium', 249 | 'XPT' => 'Platinum', 250 | 'XAG' => 'Silver', 251 | ); 252 | } 253 | } 254 | --------------------------------------------------------------------------------