EMerchantPay_Genesis_Client - Version 1.4.0

Version Notes

1) Added Support for PHP 7.1 and removed Support for PHP < 5.5.9

2) Update Genesis Client Library to 1.7.0

3) Added new Transaction Types
- Citadel
- eZeeWallet
- iDebit
- INPay
- InstaDebit
- P24
- PayPal Express
- Sepa Direct Debit
- Trustly

4) Added new Payment Methods to PPRO
- Mr.Cash
- MyBank

5) Added missing "usage" parameter to backend transactions.

6) Extended backend transactions validations.

Download this release

Release Info

Developer eMerchantPay Ltd.
Extension EMerchantPay_Genesis_Client
Version 1.4.0
Comparing to
See all releases


Code changes from version 1.3.1 to 1.4.0

Files changed (104) hide show
  1. app/code/community/EMerchantPay/Genesis/Helper/Data.php +94 -2
  2. app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Type.php +43 -21
  3. app/code/community/EMerchantPay/Genesis/Model/Checkout.php +113 -66
  4. app/code/community/EMerchantPay/Genesis/Model/Direct.php +17 -3
  5. app/locale/en_GB/EMerchantPay_Genesis.csv +3 -0
  6. app/locale/en_US/EMerchantPay_Genesis.csv +3 -0
  7. lib/Genesis/src/Genesis/API/Constants/Errors.php +8 -0
  8. lib/Genesis/src/Genesis/API/Constants/Payment/Methods.php +17 -10
  9. lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/CardTypes.php +3 -4
  10. lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/RedeemTypes.php +3 -4
  11. lib/Genesis/src/Genesis/API/Constants/Transaction/States.php +3 -27
  12. lib/Genesis/src/Genesis/API/Constants/Transaction/Types.php +136 -50
  13. lib/Genesis/src/Genesis/API/Notification.php +9 -9
  14. lib/Genesis/src/Genesis/API/Request.php +146 -14
  15. lib/Genesis/src/Genesis/API/Request/Base/Financial.php +170 -0
  16. lib/Genesis/src/Genesis/API/Request/Base/Financial/Alternative.php +86 -0
  17. lib/Genesis/src/Genesis/API/Request/Base/Financial/Reference.php +79 -0
  18. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/ABNiDEAL.php +36 -327
  19. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/CashU.php +20 -341
  20. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/INPay.php +228 -0
  21. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/P24.php +64 -0
  22. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/POLi.php +12 -337
  23. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PPRO.php +188 -331
  24. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PaypalExpress.php +64 -0
  25. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Paysafecard.php +18 -341
  26. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Sofort.php +39 -329
  27. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Trustly/Sale.php +108 -0
  28. lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Trustly/Withdrawal.php +67 -0
  29. lib/Genesis/src/Genesis/API/Request/Financial/Cancel.php +72 -0
  30. lib/Genesis/src/Genesis/API/Request/Financial/Capture.php +8 -104
  31. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize.php +52 -393
  32. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize3D.php +68 -450
  33. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Credit.php +8 -104
  34. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Payout.php +43 -271
  35. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale.php +50 -391
  36. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale3D.php +66 -450
  37. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/RecurringSale.php +9 -104
  38. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale.php +52 -391
  39. lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale3D.php +68 -450
  40. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/Citadel/Payin.php +115 -0
  41. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/Citadel/Payout.php +254 -0
  42. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/InstaDebit/Payin.php +60 -0
  43. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/InstaDebit/Payout.php +59 -0
  44. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/iDebit/Payin.php +109 -0
  45. lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/iDebit/Payout.php +66 -0
  46. lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/Sale.php +50 -385
  47. lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/oBeP.php +15 -20
  48. lib/Genesis/src/Genesis/API/Request/Financial/Refund.php +9 -105
  49. lib/Genesis/src/Genesis/API/Request/Financial/SDD/Payout.php +60 -0
  50. lib/Genesis/src/Genesis/API/Request/Financial/SDD/Recurring/InitRecurringSale.php +43 -0
  51. lib/Genesis/src/Genesis/API/Request/Financial/SDD/Recurring/RecurringSale.php +63 -0
  52. lib/Genesis/src/Genesis/API/Request/Financial/SDD/Refund.php +64 -0
  53. lib/Genesis/src/Genesis/API/Request/Financial/SDD/Sale.php +99 -0
  54. lib/Genesis/src/Genesis/API/Request/Financial/Void.php +0 -114
  55. lib/Genesis/src/Genesis/API/Request/Financial/Wallets/Neteller.php +39 -326
  56. lib/Genesis/src/Genesis/API/Request/Financial/Wallets/WebMoney.php +64 -312
  57. lib/Genesis/src/Genesis/API/Request/Financial/Wallets/eZeeWallet.php +31 -95
  58. lib/Genesis/src/Genesis/API/Request/NonFinancial/AVS.php +25 -315
  59. lib/Genesis/src/Genesis/API/Request/NonFinancial/AccountVerification.php +25 -315
  60. lib/Genesis/src/Genesis/API/Request/NonFinancial/Blacklist.php +10 -17
  61. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/DateRange.php +10 -24
  62. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/Transaction.php +9 -16
  63. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/DateRange.php +10 -24
  64. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/Transaction.php +8 -15
  65. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/DateRange.php +10 -24
  66. lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/Transaction.php +9 -16
  67. lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/DateRange.php +10 -17
  68. lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/Transaction.php +10 -17
  69. lib/Genesis/src/Genesis/API/Request/NonFinancial/Retrieve/AbniDealBanks.php +4 -4
  70. lib/Genesis/src/Genesis/API/Request/WPF/Create.php +114 -350
  71. lib/Genesis/src/Genesis/API/Request/WPF/Reconcile.php +9 -16
  72. lib/Genesis/src/Genesis/API/Response.php +12 -17
  73. lib/Genesis/src/Genesis/API/Traits/Request/AddressInfoAttributes.php +37 -0
  74. lib/Genesis/src/Genesis/API/Traits/Request/BaseAttributes.php +59 -0
  75. lib/Genesis/src/Genesis/API/Traits/Request/CreditCardAttributes.php +157 -0
  76. lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/BillingInfoAttributes.php +118 -0
  77. lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/CustomerInfoAttributes.php +48 -0
  78. lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/ShippingInfoAttributes.php +119 -0
  79. lib/Genesis/src/Genesis/API/Traits/Request/Financial/AsyncAttributes.php +48 -0
  80. lib/Genesis/src/Genesis/API/Traits/Request/Financial/DescriptorAttributes.php +64 -0
  81. lib/Genesis/src/Genesis/API/Traits/Request/Financial/GamingAttributes.php +42 -0
  82. lib/Genesis/src/Genesis/API/Traits/Request/Financial/MpiAttributes.php +73 -0
  83. lib/Genesis/src/Genesis/API/Traits/Request/Financial/NotificationAttributes.php +39 -0
  84. lib/Genesis/src/Genesis/API/Traits/Request/Financial/PaymentAttributes.php +51 -0
  85. lib/Genesis/src/Genesis/API/Traits/Request/Financial/ReferenceAttributes.php +43 -0
  86. lib/Genesis/src/Genesis/API/Traits/Request/Financial/SddBankAttributes.php +50 -0
  87. lib/Genesis/src/Genesis/API/Traits/Request/Financial/VoucherAttributes.php +48 -0
  88. lib/Genesis/src/Genesis/API/Traits/Request/MotoAttributes.php +42 -0
  89. lib/Genesis/src/Genesis/API/Traits/Request/RiskAttributes.php +241 -0
  90. lib/Genesis/src/Genesis/API/Validators/Request/Base/Validator.php +116 -0
  91. lib/Genesis/src/Genesis/API/Validators/Request/RegexValidator.php +79 -0
  92. lib/Genesis/src/Genesis/Builder.php +1 -1
  93. lib/Genesis/src/Genesis/Builders/XML.php +7 -1
  94. lib/Genesis/src/Genesis/Config.php +43 -46
  95. lib/Genesis/src/Genesis/Genesis.php +8 -3
  96. lib/Genesis/src/Genesis/Network.php +3 -3
  97. lib/Genesis/src/Genesis/Network/Stream.php +13 -11
  98. lib/Genesis/src/Genesis/Network/cURL.php +7 -7
  99. lib/Genesis/src/Genesis/Parsers/XML.php +4 -0
  100. lib/Genesis/src/Genesis/Utils/Common.php +139 -6
  101. lib/Genesis/src/Genesis/Utils/Country.php +13 -3
  102. lib/Genesis/src/Genesis/Utils/Currency.php +369 -359
  103. lib/Genesis/src/Genesis/Utils/Requirements.php +13 -6
  104. package.xml +27 -7
app/code/community/EMerchantPay/Genesis/Helper/Data.php CHANGED
@@ -172,14 +172,15 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
172
  * and salted to avoid duplication
173
  *
174
  * @param string $prefix Prefix of the orderId
 
175
  *
176
  * @return string
177
  */
178
- public function genTransactionId($prefix = '')
179
  {
180
  $hash = Mage::helper('core')->uniqHash();
181
 
182
- return (string)$prefix . substr($hash, -(strlen($hash) - strlen($prefix)));
183
  }
184
 
185
  /**
@@ -903,4 +904,95 @@ class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
903
 
904
  return $default;
905
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
906
  }
172
  * and salted to avoid duplication
173
  *
174
  * @param string $prefix Prefix of the orderId
175
+ * @param int $length Length of the generated string
176
  *
177
  * @return string
178
  */
179
+ public function genTransactionId($prefix = '', $length = 30)
180
  {
181
  $hash = Mage::helper('core')->uniqHash();
182
 
183
+ return substr($prefix . substr($hash, -(strlen($hash) - strlen($prefix))), 0, $length);
184
  }
185
 
186
  /**
904
 
905
  return $default;
906
  }
907
+
908
+ /**
909
+ * Retrieves the consumer's user id
910
+ *
911
+ * @return int
912
+ */
913
+ public static function getCurrentUserId()
914
+ {
915
+ /** @var Mage_Customer_Helper_Data $helper */
916
+ $helper = Mage::helper('customer');
917
+ if ($helper->isLoggedIn()) {
918
+ return $helper->getCurrentCustomer()->getId();
919
+ }
920
+ return 0;
921
+ }
922
+
923
+ /**
924
+ * @param int $length
925
+ * @return string
926
+ */
927
+ public static function getCurrentUserIdHash($length = 30)
928
+ {
929
+ $userId = self::getCurrentUserId();
930
+
931
+ $userHash = $userId > 0 ? sha1($userId) : self::genTransactionId();
932
+
933
+ return substr($userHash, 0, $length);
934
+ }
935
+
936
+ /**
937
+ * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
938
+ *
939
+ * @return bool
940
+ */
941
+ public function getIsRefundable(Varien_Object $payment)
942
+ {
943
+ $refundableGatewayTransactionTypes = array(
944
+ \Genesis\API\Constants\Transaction\Types::SALE,
945
+ \Genesis\API\Constants\Transaction\Types::SALE_3D,
946
+ \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE,
947
+ \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D,
948
+ \Genesis\API\Constants\Transaction\Types::CASHU,
949
+ \Genesis\API\Constants\Transaction\Types::PPRO,
950
+ \Genesis\API\Constants\Transaction\Types::INPAY,
951
+ \Genesis\API\Constants\Transaction\Types::P24,
952
+ \Genesis\API\Constants\Transaction\Types::PAYPAL_EXPRESS,
953
+ \Genesis\API\Constants\Transaction\Types::TRUSTLY_SALE
954
+ );
955
+
956
+ return in_array(
957
+ $this->getGenesisPaymentTransactionType($payment),
958
+ $refundableGatewayTransactionTypes
959
+ );
960
+ }
961
+
962
+ /**
963
+ * Looks for the capture transaction, checks if it supports refunds and returns it.
964
+ * Adds to Mage::log, if capture transaction is not found or is not refundable.
965
+ *
966
+ * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
967
+ * @return Mage_Sales_Model_Order_Payment_Transaction|null
968
+ */
969
+ public function getCaptureForRefund(Varien_Object $payment) {
970
+ $capture = $payment->lookupTransaction(
971
+ null,
972
+ Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
973
+ );
974
+
975
+ /* Refund Transaction is only possible, when Capture Transaction Exists */
976
+ if ($capture === false) {
977
+ Mage::log(
978
+ 'Refund transaction for order #' .
979
+ $payment->getOrder()->getIncrementId() .
980
+ ' could not be completed! (No Capture Transaction Exists)'
981
+ );
982
+
983
+ return null;
984
+ }
985
+
986
+ if (!$this->getIsRefundable($capture)) {
987
+ Mage::log(
988
+ 'Refund transaction for order #' .
989
+ $payment->getOrder()->getIncrementId() .
990
+ ' could not be completed! (This transaction type does\'t support refund)'
991
+ );
992
+
993
+ return null;
994
+ }
995
+
996
+ return $capture;
997
+ }
998
  }
app/code/community/EMerchantPay/Genesis/Model/Admin/Checkout/Options/Transaction/Type.php CHANGED
@@ -65,45 +65,67 @@ class EMerchantPay_Genesis_Model_Admin_Checkout_Options_Transaction_Type
65
  protected function getTransactionTypes()
66
  {
67
  return array(
68
- \Genesis\API\Constants\Transaction\Types::ABNIDEAL =>
69
  Mage::helper('emerchantpay')->__('ABN iDEAL'),
70
- \Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
71
  Mage::helper('emerchantpay')->__('Authorize'),
72
- \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D =>
73
  Mage::helper('emerchantpay')->__('Authorize (3D-Secure)'),
74
- \Genesis\API\Constants\Transaction\Types::CASHU =>
75
  Mage::helper('emerchantpay')->__('CashU'),
76
- \Genesis\API\Constants\Payment\Methods::EPS =>
 
 
77
  Mage::helper('emerchantpay')->__('eps'),
78
- \Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
 
 
79
  Mage::helper('emerchantpay')->__('GiroPay'),
80
- \Genesis\API\Constants\Transaction\Types::NETELLER =>
 
 
 
 
 
 
 
 
 
 
81
  Mage::helper('emerchantpay')->__('Neteller'),
82
- \Genesis\API\Constants\Payment\Methods::QIWI =>
83
- Mage::helper('emerchantpay')->__('Qiwi'),
84
- \Genesis\API\Constants\Transaction\Types::PAYSAFECARD =>
85
  Mage::helper('emerchantpay')->__('PaySafeCard'),
86
- \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE =>
87
  Mage::helper('emerchantpay')->__('PayByVoucher (Sale)'),
88
  \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY =>
89
  Mage::helper('emerchantpay')->__('PayByVoucher (oBeP)'),
90
- \Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
91
- Mage::helper('emerchantpay')->__('Przelewy24'),
92
- \Genesis\API\Constants\Transaction\Types::POLI =>
93
  Mage::helper('emerchantpay')->__('POLi'),
94
- \Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
 
 
 
 
95
  Mage::helper('emerchantpay')->__('SafetyPay'),
96
- \Genesis\API\Constants\Transaction\Types::SALE =>
97
  Mage::helper('emerchantpay')->__('Sale'),
98
- \Genesis\API\Constants\Transaction\Types::SALE_3D =>
99
  Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
100
- \Genesis\API\Constants\Transaction\Types::SOFORT =>
 
 
101
  Mage::helper('emerchantpay')->__('SOFORT'),
102
- \Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
103
  Mage::helper('emerchantpay')->__('TeleIngreso'),
104
- \Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
 
 
105
  Mage::helper('emerchantpay')->__('TrustPay'),
106
- \Genesis\API\Constants\Transaction\Types::WEBMONEY =>
107
  Mage::helper('emerchantpay')->__('WebMoney'),
108
  );
109
  }
65
  protected function getTransactionTypes()
66
  {
67
  return array(
68
+ \Genesis\API\Constants\Transaction\Types::ABNIDEAL =>
69
  Mage::helper('emerchantpay')->__('ABN iDEAL'),
70
+ \Genesis\API\Constants\Transaction\Types::AUTHORIZE =>
71
  Mage::helper('emerchantpay')->__('Authorize'),
72
+ \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D =>
73
  Mage::helper('emerchantpay')->__('Authorize (3D-Secure)'),
74
+ \Genesis\API\Constants\Transaction\Types::CASHU =>
75
  Mage::helper('emerchantpay')->__('CashU'),
76
+ \Genesis\API\Constants\Transaction\Types::CITADEL_PAYIN =>
77
+ Mage::helper('emerchantpay')->__('Citadel'),
78
+ \Genesis\API\Constants\Payment\Methods::EPS =>
79
  Mage::helper('emerchantpay')->__('eps'),
80
+ \Genesis\API\Constants\Transaction\Types::EZEEWALLET =>
81
+ Mage::helper('emerchantpay')->__('eZeeWallet'),
82
+ \Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
83
  Mage::helper('emerchantpay')->__('GiroPay'),
84
+ \Genesis\API\Constants\Transaction\Types::IDEBIT_PAYIN =>
85
+ Mage::helper('emerchantpay')->__('iDebit'),
86
+ \Genesis\API\Constants\Transaction\Types::INPAY =>
87
+ Mage::helper('emerchantpay')->__('INPay'),
88
+ \Genesis\API\Constants\Transaction\Types::INSTA_DEBIT_PAYIN =>
89
+ Mage::helper('emerchantpay')->__('InstaDebit'),
90
+ \Genesis\API\Constants\Payment\Methods::BCMC =>
91
+ Mage::helper('emerchantpay')->__('Mr.Cash'),
92
+ \Genesis\API\Constants\Payment\Methods::MYBANK =>
93
+ Mage::helper('emerchantpay')->__('MyBank'),
94
+ \Genesis\API\Constants\Transaction\Types::NETELLER =>
95
  Mage::helper('emerchantpay')->__('Neteller'),
96
+ \Genesis\API\Constants\Transaction\Types::P24 =>
97
+ Mage::helper('emerchantpay')->__('P24'),
98
+ \Genesis\API\Constants\Transaction\Types::PAYSAFECARD =>
99
  Mage::helper('emerchantpay')->__('PaySafeCard'),
100
+ \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE =>
101
  Mage::helper('emerchantpay')->__('PayByVoucher (Sale)'),
102
  \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY =>
103
  Mage::helper('emerchantpay')->__('PayByVoucher (oBeP)'),
104
+ \Genesis\API\Constants\Transaction\Types::PAYPAL_EXPRESS =>
105
+ Mage::helper('emerchantpay')->__('PayPal Express'),
106
+ \Genesis\API\Constants\Transaction\Types::POLI =>
107
  Mage::helper('emerchantpay')->__('POLi'),
108
+ \Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
109
+ Mage::helper('emerchantpay')->__('Przelewy24'),
110
+ \Genesis\API\Constants\Payment\Methods::QIWI =>
111
+ Mage::helper('emerchantpay')->__('Qiwi'),
112
+ \Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
113
  Mage::helper('emerchantpay')->__('SafetyPay'),
114
+ \Genesis\API\Constants\Transaction\Types::SALE =>
115
  Mage::helper('emerchantpay')->__('Sale'),
116
+ \Genesis\API\Constants\Transaction\Types::SALE_3D =>
117
  Mage::helper('emerchantpay')->__('Sale (3D-Secure)'),
118
+ \Genesis\API\Constants\Transaction\Types::SDD_SALE =>
119
+ Mage::helper('emerchantpay')->__('Sepa Direct Debit'),
120
+ \Genesis\API\Constants\Transaction\Types::SOFORT =>
121
  Mage::helper('emerchantpay')->__('SOFORT'),
122
+ \Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
123
  Mage::helper('emerchantpay')->__('TeleIngreso'),
124
+ \Genesis\API\Constants\Transaction\Types::TRUSTLY_SALE =>
125
+ Mage::helper('emerchantpay')->__('Trustly'),
126
+ \Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
127
  Mage::helper('emerchantpay')->__('TrustPay'),
128
+ \Genesis\API\Constants\Transaction\Types::WEBMONEY =>
129
  Mage::helper('emerchantpay')->__('WebMoney'),
130
  );
131
  }
app/code/community/EMerchantPay/Genesis/Model/Checkout.php CHANGED
@@ -118,36 +118,7 @@ class EMerchantPay_Genesis_Model_Checkout
118
  ->setShippingCountry($shipping->getCountry())
119
  ->setLanguage($this->getHelper()->getLocale());
120
 
121
-
122
- foreach ($this->getTransactionTypes() as $transactionType) {
123
- if (is_array($transactionType)) {
124
- $genesis->request()->addTransactionType(
125
- $transactionType['name'],
126
- $transactionType['parameters']
127
- );
128
- } else {
129
- if (\Genesis\API\Constants\Transaction\Types::isPayByVoucher($transactionType)) {
130
- $parameters = array(
131
- 'card_type' =>
132
- \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::VIRTUAL,
133
- 'redeem_type' =>
134
- \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::INSTANT
135
- );
136
- if ($transactionType == \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY) {
137
- $parameters['product_name'] = $orderItemsList;
138
- $parameters['product_category'] = $orderItemsList;
139
- }
140
-
141
- $genesis
142
- ->request()
143
- ->addTransactionType($transactionType, $parameters);
144
- } else {
145
- $genesis
146
- ->request()
147
- ->addTransactionType($transactionType);
148
- }
149
- }
150
- }
151
 
152
  $genesis->execute();
153
 
@@ -177,6 +148,70 @@ class EMerchantPay_Genesis_Model_Checkout
177
  return $this;
178
  }
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  /**
181
  * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
182
  * @param float $amount
@@ -227,6 +262,9 @@ class EMerchantPay_Genesis_Model_Checkout
227
  )
228
  ->setAmount(
229
  $amount
 
 
 
230
  );
231
 
232
  $genesis->execute();
@@ -295,23 +333,13 @@ class EMerchantPay_Genesis_Model_Checkout
295
  try {
296
  $this->getHelper()->initClient($this->getCode());
297
 
298
- $this->getHelper()->setTokenByPaymentTransaction($payment);
299
-
300
- $capture = $payment->lookupTransaction(
301
- null,
302
- Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
303
- );
304
-
305
- /* Refund Transaction is only possible, when Capture Transaction Exists */
306
- if (!isset($capture) || $capture === false) {
307
- Mage::log(
308
- 'Refund transaction for order #' .
309
- $payment->getOrder()->getIncrementId() .
310
- ' could not be completed! (No Capture Transaction Exists'
311
- );
312
- return $this;
313
  }
314
 
 
 
315
  $referenceId = $capture->getTxnId();
316
 
317
  $genesis = new \Genesis\Genesis('Financial\Refund');
@@ -332,7 +360,12 @@ class EMerchantPay_Genesis_Model_Checkout
332
  ->setCurrency(
333
  $payment->getOrder()->getOrderCurrencyCode()
334
  )
335
- ->setAmount($amount);
 
 
 
 
 
336
 
337
  $genesis->execute();
338
 
@@ -370,21 +403,19 @@ class EMerchantPay_Genesis_Model_Checkout
370
  $responseObject->message
371
  );
372
 
373
- if (isset($capture) && $capture !== false) {
374
- $canceledProfileReferenceId = $this->getHelper()->checkAndCancelRecurringProfile(
375
- $capture
376
- );
377
 
378
- if (isset($canceledProfileReferenceId)) {
379
- $this->getHelper()->getAdminSession()->addNotice(
380
- $this->getHelper()->__(
381
- sprintf(
382
- "Profile #%s has been canceled!",
383
- $canceledProfileReferenceId
384
- )
385
  )
386
- );
387
- }
388
  }
389
  } else {
390
  $this->getHelper()->getAdminSession()->addError(
@@ -428,7 +459,7 @@ class EMerchantPay_Genesis_Model_Checkout
428
 
429
  $referenceId = $transactions ? reset($transactions)->getTxnId() : null;
430
 
431
- $genesis = new \Genesis\Genesis('Financial\Void');
432
 
433
  $genesis
434
  ->request()
@@ -442,6 +473,9 @@ class EMerchantPay_Genesis_Model_Checkout
442
  )
443
  ->setReferenceId(
444
  $referenceId
 
 
 
445
  );
446
 
447
  $genesis->execute();
@@ -709,12 +743,21 @@ class EMerchantPay_Genesis_Model_Checkout
709
  break;
710
  case \Genesis\API\Constants\Transaction\Types::ABNIDEAL:
711
  case \Genesis\API\Constants\Transaction\Types::CASHU:
 
 
 
 
 
712
  case \Genesis\API\Constants\Transaction\Types::NETELLER:
 
713
  case \Genesis\API\Constants\Transaction\Types::PAYSAFECARD:
 
714
  case \Genesis\API\Constants\Transaction\Types::PPRO:
715
  case \Genesis\API\Constants\Transaction\Types::SALE:
716
  case \Genesis\API\Constants\Transaction\Types::SALE_3D:
 
717
  case \Genesis\API\Constants\Transaction\Types::SOFORT:
 
718
  case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE:
719
  case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D:
720
  $payment->registerCaptureNotification(
@@ -801,19 +844,23 @@ class EMerchantPay_Genesis_Model_Checkout
801
  );
802
 
803
  $aliasMap = array(
804
- \Genesis\API\Constants\Payment\Methods::EPS =>
805
  \Genesis\API\Constants\Transaction\Types::PPRO,
806
- \Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
807
  \Genesis\API\Constants\Transaction\Types::PPRO,
808
- \Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
809
  \Genesis\API\Constants\Transaction\Types::PPRO,
810
- \Genesis\API\Constants\Payment\Methods::QIWI =>
811
  \Genesis\API\Constants\Transaction\Types::PPRO,
812
- \Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
813
  \Genesis\API\Constants\Transaction\Types::PPRO,
814
  \Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
815
  \Genesis\API\Constants\Transaction\Types::PPRO,
816
- \Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
 
 
 
 
817
  \Genesis\API\Constants\Transaction\Types::PPRO,
818
  );
819
 
118
  ->setShippingCountry($shipping->getCountry())
119
  ->setLanguage($this->getHelper()->getLocale());
120
 
121
+ $this->addTransactionTypesToGatewayRequest($genesis, $orderItemsList);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  $genesis->execute();
124
 
148
  return $this;
149
  }
150
 
151
+ /**
152
+ * @param \Genesis\Genesis $genesis
153
+ * @param string $orderItemsList
154
+ * @return void
155
+ */
156
+ public function addTransactionTypesToGatewayRequest(\Genesis\Genesis $genesis, $orderItemsList)
157
+ {
158
+ foreach ($this->getTransactionTypes() as $transactionType) {
159
+ if (is_array($transactionType)) {
160
+ $genesis
161
+ ->request()
162
+ ->addTransactionType(
163
+ $transactionType['name'],
164
+ $transactionType['parameters']
165
+ );
166
+
167
+ continue;
168
+ }
169
+
170
+ switch ($transactionType) {
171
+ case \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE:
172
+ $parameters = array(
173
+ 'card_type' =>
174
+ \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::VIRTUAL,
175
+ 'redeem_type' =>
176
+ \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::INSTANT
177
+ );
178
+ break;
179
+ case \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY:
180
+ $parameters = array(
181
+ 'card_type' =>
182
+ \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::VIRTUAL,
183
+ 'redeem_type' =>
184
+ \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::INSTANT,
185
+ 'product_name' => $orderItemsList,
186
+ 'product_category' => $orderItemsList
187
+ );
188
+ break;
189
+ case \Genesis\API\Constants\Transaction\Types::CITADEL_PAYIN:
190
+ $parameters = array(
191
+ 'merchant_customer_id' => $this->getHelper()->getCurrentUserIdHash()
192
+ );
193
+ break;
194
+ case \Genesis\API\Constants\Transaction\Types::IDEBIT_PAYIN:
195
+ case \Genesis\API\Constants\Transaction\Types::INSTA_DEBIT_PAYIN:
196
+ $parameters = array(
197
+ 'customer_account_id' => $this->getHelper()->getCurrentUserIdHash()
198
+ );
199
+ break;
200
+ }
201
+
202
+ if (!isset($parameters)) {
203
+ $parameters = array();
204
+ }
205
+
206
+ $genesis
207
+ ->request()
208
+ ->addTransactionType(
209
+ $transactionType,
210
+ $parameters
211
+ );
212
+ }
213
+ }
214
+
215
  /**
216
  * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
217
  * @param float $amount
262
  )
263
  ->setAmount(
264
  $amount
265
+ )
266
+ ->setUsage(
267
+ $this->getHelper()->__('Magento Capture')
268
  );
269
 
270
  $genesis->execute();
333
  try {
334
  $this->getHelper()->initClient($this->getCode());
335
 
336
+ $capture = $this->getHelper()->getCaptureForRefund($payment);
337
+ if ($capture === null) {
338
+ throw new Exception('This transaction cannot be refunded.');
 
 
 
 
 
 
 
 
 
 
 
 
339
  }
340
 
341
+ $this->getHelper()->setTokenByPaymentTransaction($payment);
342
+
343
  $referenceId = $capture->getTxnId();
344
 
345
  $genesis = new \Genesis\Genesis('Financial\Refund');
360
  ->setCurrency(
361
  $payment->getOrder()->getOrderCurrencyCode()
362
  )
363
+ ->setAmount(
364
+ $amount
365
+ )
366
+ ->setUsage(
367
+ $this->getHelper()->__('Magento Refund')
368
+ );
369
 
370
  $genesis->execute();
371
 
403
  $responseObject->message
404
  );
405
 
406
+ $canceledProfileReferenceId = $this->getHelper()->checkAndCancelRecurringProfile(
407
+ $capture
408
+ );
 
409
 
410
+ if (isset($canceledProfileReferenceId)) {
411
+ $this->getHelper()->getAdminSession()->addNotice(
412
+ $this->getHelper()->__(
413
+ sprintf(
414
+ "Profile #%s has been canceled!",
415
+ $canceledProfileReferenceId
 
416
  )
417
+ )
418
+ );
419
  }
420
  } else {
421
  $this->getHelper()->getAdminSession()->addError(
459
 
460
  $referenceId = $transactions ? reset($transactions)->getTxnId() : null;
461
 
462
+ $genesis = new \Genesis\Genesis('Financial\Cancel');
463
 
464
  $genesis
465
  ->request()
473
  )
474
  ->setReferenceId(
475
  $referenceId
476
+ )
477
+ ->setUsage(
478
+ $this->getHelper()->__('Magento Void')
479
  );
480
 
481
  $genesis->execute();
743
  break;
744
  case \Genesis\API\Constants\Transaction\Types::ABNIDEAL:
745
  case \Genesis\API\Constants\Transaction\Types::CASHU:
746
+ case \Genesis\API\Constants\Transaction\Types::CITADEL_PAYIN:
747
+ case \Genesis\API\Constants\Transaction\Types::EZEEWALLET:
748
+ case \Genesis\API\Constants\Transaction\Types::IDEBIT_PAYIN:
749
+ case \Genesis\API\Constants\Transaction\Types::INPAY:
750
+ case \Genesis\API\Constants\Transaction\Types::INSTA_DEBIT_PAYIN:
751
  case \Genesis\API\Constants\Transaction\Types::NETELLER:
752
+ case \Genesis\API\Constants\Transaction\Types::P24:
753
  case \Genesis\API\Constants\Transaction\Types::PAYSAFECARD:
754
+ case \Genesis\API\Constants\Transaction\Types::PAYPAL_EXPRESS:
755
  case \Genesis\API\Constants\Transaction\Types::PPRO:
756
  case \Genesis\API\Constants\Transaction\Types::SALE:
757
  case \Genesis\API\Constants\Transaction\Types::SALE_3D:
758
+ case \Genesis\API\Constants\Transaction\Types::SDD_SALE:
759
  case \Genesis\API\Constants\Transaction\Types::SOFORT:
760
+ case \Genesis\API\Constants\Transaction\Types::TRUSTLY_SALE:
761
  case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE:
762
  case \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D:
763
  $payment->registerCaptureNotification(
844
  );
845
 
846
  $aliasMap = array(
847
+ \Genesis\API\Constants\Payment\Methods::EPS =>
848
  \Genesis\API\Constants\Transaction\Types::PPRO,
849
+ \Genesis\API\Constants\Payment\Methods::GIRO_PAY =>
850
  \Genesis\API\Constants\Transaction\Types::PPRO,
851
+ \Genesis\API\Constants\Payment\Methods::PRZELEWY24 =>
852
  \Genesis\API\Constants\Transaction\Types::PPRO,
853
+ \Genesis\API\Constants\Payment\Methods::QIWI =>
854
  \Genesis\API\Constants\Transaction\Types::PPRO,
855
+ \Genesis\API\Constants\Payment\Methods::SAFETY_PAY =>
856
  \Genesis\API\Constants\Transaction\Types::PPRO,
857
  \Genesis\API\Constants\Payment\Methods::TELEINGRESO =>
858
  \Genesis\API\Constants\Transaction\Types::PPRO,
859
+ \Genesis\API\Constants\Payment\Methods::TRUST_PAY =>
860
+ \Genesis\API\Constants\Transaction\Types::PPRO,
861
+ \Genesis\API\Constants\Payment\Methods::BCMC =>
862
+ \Genesis\API\Constants\Transaction\Types::PPRO,
863
+ \Genesis\API\Constants\Payment\Methods::MYBANK =>
864
  \Genesis\API\Constants\Transaction\Types::PPRO,
865
  );
866
 
app/code/community/EMerchantPay/Genesis/Model/Direct.php CHANGED
@@ -489,6 +489,9 @@ class EMerchantPay_Genesis_Model_Direct
489
  )
490
  ->setAmount(
491
  $amount
 
 
 
492
  );
493
 
494
  $genesis->execute();
@@ -560,7 +563,10 @@ class EMerchantPay_Genesis_Model_Direct
560
  try {
561
  $this->getHelper()->initClient($this->getCode());
562
 
563
- $capture = $payment->lookupTransaction(null, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
 
 
 
564
 
565
  $referenceId = $capture->getTxnId();
566
 
@@ -582,7 +588,12 @@ class EMerchantPay_Genesis_Model_Direct
582
  ->setCurrency(
583
  $payment->getOrder()->getOrderCurrencyCode()
584
  )
585
- ->setAmount($amount);
 
 
 
 
 
586
 
587
  $genesis->execute();
588
 
@@ -673,7 +684,7 @@ class EMerchantPay_Genesis_Model_Direct
673
 
674
  $referenceId = $transactions ? reset($transactions)->getTxnId() : null;
675
 
676
- $genesis = new \Genesis\Genesis('Financial\Void');
677
 
678
  $genesis
679
  ->request()
@@ -685,6 +696,9 @@ class EMerchantPay_Genesis_Model_Direct
685
  )
686
  ->setReferenceId(
687
  $referenceId
 
 
 
688
  );
689
 
690
  $genesis->execute();
489
  )
490
  ->setAmount(
491
  $amount
492
+ )
493
+ ->setUsage(
494
+ $this->getHelper()->__('Magento Capture')
495
  );
496
 
497
  $genesis->execute();
563
  try {
564
  $this->getHelper()->initClient($this->getCode());
565
 
566
+ $capture = $this->getHelper()->getCaptureForRefund($payment);
567
+ if ($capture === null) {
568
+ throw new Exception('This transaction cannot be refunded.');
569
+ }
570
 
571
  $referenceId = $capture->getTxnId();
572
 
588
  ->setCurrency(
589
  $payment->getOrder()->getOrderCurrencyCode()
590
  )
591
+ ->setAmount(
592
+ $amount
593
+ )
594
+ ->setUsage(
595
+ $this->getHelper()->__('Magento Refund')
596
+ );
597
 
598
  $genesis->execute();
599
 
684
 
685
  $referenceId = $transactions ? reset($transactions)->getTxnId() : null;
686
 
687
+ $genesis = new \Genesis\Genesis('Financial\Cancel');
688
 
689
  $genesis
690
  ->request()
696
  )
697
  ->setReferenceId(
698
  $referenceId
699
+ )
700
+ ->setUsage(
701
+ $this->getHelper()->__('Magento Void')
702
  );
703
 
704
  $genesis->execute();
app/locale/en_GB/EMerchantPay_Genesis.csv CHANGED
@@ -11,6 +11,9 @@
11
  "Expiration Date","Expiration Date"
12
  "GiroPay","GiroPay"
13
  "Magento Payment","Magento Payment"
 
 
 
14
  "Month","Month"
15
  "More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
16
  "Name on Card","Name on Card"
11
  "Expiration Date","Expiration Date"
12
  "GiroPay","GiroPay"
13
  "Magento Payment","Magento Payment"
14
+ "Magento Capture","Magento Capture"
15
+ "Magento Refund","Magento Refund"
16
+ "Magento Void","Magento Void"
17
  "Month","Month"
18
  "More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
19
  "Name on Card","Name on Card"
app/locale/en_US/EMerchantPay_Genesis.csv CHANGED
@@ -11,6 +11,9 @@
11
  "Expiration Date","Expiration Date"
12
  "GiroPay","GiroPay"
13
  "Magento Payment","Magento Payment"
 
 
 
14
  "Month","Month"
15
  "More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
16
  "Name on Card","Name on Card"
11
  "Expiration Date","Expiration Date"
12
  "GiroPay","GiroPay"
13
  "Magento Payment","Magento Payment"
14
+ "Magento Capture","Magento Capture"
15
+ "Magento Refund","Magento Refund"
16
+ "Magento Void","Magento Void"
17
  "Month","Month"
18
  "More details about the individual transactions can be found under the ""Transactions"" section","More details about the individual transactions can be found under the ""Transactions"" section"
19
  "Name on Card","Name on Card"
lib/Genesis/src/Genesis/API/Constants/Errors.php CHANGED
@@ -27,6 +27,8 @@ namespace Genesis\API\Constants;
27
  *
28
  * @package Genesis
29
  * @subpackage API
 
 
30
  */
31
  final class Errors
32
  {
@@ -341,6 +343,9 @@ final class Errors
341
  * @param int $errorCode
342
  *
343
  * @return string
 
 
 
344
  */
345
  public static function getErrorDescription($errorCode)
346
  {
@@ -468,6 +473,9 @@ final class Errors
468
  * @param $issuerResponseCode
469
  *
470
  * @return bool|string
 
 
 
471
  */
472
  public static function getIssuerResponseCode($issuerResponseCode)
473
  {
27
  *
28
  * @package Genesis
29
  * @subpackage API
30
+ *
31
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
32
  */
33
  final class Errors
34
  {
343
  * @param int $errorCode
344
  *
345
  * @return string
346
+ *
347
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
348
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
349
  */
350
  public static function getErrorDescription($errorCode)
351
  {
473
  * @param $issuerResponseCode
474
  *
475
  * @return bool|string
476
+ *
477
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
478
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
479
  */
480
  public static function getIssuerResponseCode($issuerResponseCode)
481
  {
lib/Genesis/src/Genesis/API/Constants/Payment/Methods.php CHANGED
@@ -87,21 +87,28 @@ class Methods
87
  */
88
  const TRUST_PAY = 'trustpay';
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  /**
91
  * Returns all available payment methods
92
  * @return array
93
  */
94
  public static function getMethods()
95
  {
96
- return array(
97
- self::EPS,
98
- self::GIRO_PAY,
99
- self::IDEAL,
100
- self::PRZELEWY24,
101
- self::QIWI,
102
- self::SAFETY_PAY,
103
- self::TELEINGRESO,
104
- self::TRUST_PAY
105
- );
106
  }
107
  }
87
  */
88
  const TRUST_PAY = 'trustpay';
89
 
90
+ /**
91
+ * Mr.Cash
92
+ *
93
+ * PPRO transaction
94
+ */
95
+ const BCMC = 'bcmc';
96
+
97
+ /**
98
+ * MyBank
99
+ *
100
+ * PPRO transaction
101
+ */
102
+ const MYBANK = 'mybank';
103
+
104
  /**
105
  * Returns all available payment methods
106
  * @return array
107
  */
108
  public static function getMethods()
109
  {
110
+ $methods = \Genesis\Utils\Common::getClassConstants(__CLASS__);
111
+
112
+ return array_values($methods);
 
 
 
 
 
 
 
113
  }
114
  }
lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/CardTypes.php CHANGED
@@ -63,9 +63,8 @@ class CardTypes
63
  */
64
  public static function getCardTypes()
65
  {
66
- return array(
67
- self::VIRTUAL,
68
- self::PHYSICAL
69
- );
70
  }
71
  }
63
  */
64
  public static function getCardTypes()
65
  {
66
+ $methods = \Genesis\Utils\Common::getClassConstants(__CLASS__);
67
+
68
+ return array_values($methods);
 
69
  }
70
  }
lib/Genesis/src/Genesis/API/Constants/Transaction/Parameters/PayByVouchers/RedeemTypes.php CHANGED
@@ -64,9 +64,8 @@ class RedeemTypes
64
  */
65
  public static function getRedeemTypes()
66
  {
67
- return array(
68
- self::STORED,
69
- self::INSTANT
70
- );
71
  }
72
  }
64
  */
65
  public static function getRedeemTypes()
66
  {
67
+ $methods = \Genesis\Utils\Common::getClassConstants(__CLASS__);
68
+
69
+ return array_values($methods);
 
70
  }
71
  }
lib/Genesis/src/Genesis/API/Constants/Transaction/States.php CHANGED
@@ -178,11 +178,7 @@ class States
178
  */
179
  public function compare($subject)
180
  {
181
- if ($this->status == constant('self::' . strtoupper($subject))) {
182
- return true;
183
- }
184
-
185
- return false;
186
  }
187
 
188
  /**
@@ -192,28 +188,8 @@ class States
192
  */
193
  public function isValid()
194
  {
195
- $statusList = array(
196
- self::APPROVED,
197
- self::DECLINED,
198
- self::PENDING,
199
- self::PENDING_ASYNC,
200
- self::REFUNDED,
201
- self::VOIDED,
202
- self::ERROR,
203
- self::UNSUCCESSFUL,
204
- self::IN_PROGRESS,
205
- self::NEW_STATUS,
206
- self::USER,
207
- self::TIMEOUT,
208
- self::CHARGEBACKED,
209
- self::CHARGEBACK_REVERSED,
210
- self::PRE_ARBITRATED,
211
- );
212
-
213
- if (in_array(strtolower($this->status), $statusList)) {
214
- return true;
215
- }
216
 
217
- return false;
218
  }
219
  }
178
  */
179
  public function compare($subject)
180
  {
181
+ return $this->status == constant('self::' . strtoupper($subject));
 
 
 
 
182
  }
183
 
184
  /**
188
  */
189
  public function isValid()
190
  {
191
+ $statusList = \Genesis\Utils\Common::getClassConstants(__CLASS__);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
+ return in_array(strtolower($this->status), $statusList);
194
  }
195
  }
lib/Genesis/src/Genesis/API/Constants/Transaction/Types.php CHANGED
@@ -156,65 +156,149 @@ class Types
156
  */
157
  const SOFORT = 'sofort';
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  /**
160
  * Check whether this is a valid (known) transaction type
161
  *
 
162
  * @return bool
163
  */
164
  public static function isValidTransactionType($type)
165
  {
166
- $transactionTypesList = array(
167
- self::AVS,
168
- self::ACCOUNT_VERIFICATION,
169
- self::AUTHORIZE,
170
- self::AUTHORIZE_3D,
171
- self::SALE,
172
- self::SALE_3D,
173
- self::CAPTURE,
174
- self::REFUND,
175
- self::VOID,
176
- self::CREDIT,
177
- self::PAYOUT,
178
- self::INIT_RECURRING_SALE,
179
- self::INIT_RECURRING_SALE_3D,
180
- self::RECURRING_SALE,
181
- self::ABNIDEAL,
182
- self::CASHU,
183
- self::EZEEWALLET,
184
- self::NETELLER,
185
- self::POLI,
186
- self::WEBMONEY,
187
- self::PAYBYVOUCHER_YEEPAY,
188
- self::PAYBYVOUCHER_SALE,
189
- self::PAYSAFECARD,
190
- self::PPRO,
191
- self::SOFORT
192
- );
193
-
194
- if (in_array($type, $transactionTypesList)) {
195
- return true;
196
- }
197
 
198
- return false;
199
  }
200
 
201
  /**
202
  * Check whether this is a valid (known) transaction type
203
  *
 
204
  * @return bool
205
  */
206
  public static function isPayByVoucher($type)
207
  {
208
- $transactionTypesList = array(
209
  self::PAYBYVOUCHER_YEEPAY,
210
- self::PAYBYVOUCHER_SALE,
211
- );
212
-
213
- if (in_array($type, $transactionTypesList)) {
214
- return true;
215
- }
216
 
217
- return false;
218
  }
219
 
220
  /**
@@ -226,26 +310,28 @@ class Types
226
  {
227
  switch ($type) {
228
  case self::PPRO:
229
- return array(
230
- 'payment_method' =>
231
- \Genesis\API\Constants\Payment\Methods::getMethods()
232
- );
233
  break;
234
 
235
  case self::PAYBYVOUCHER_SALE:
236
  case self::PAYBYVOUCHER_YEEPAY:
237
- $customParameters = array(
238
  'card_type' =>
239
  \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::getCardTypes(),
240
  'redeem_type' =>
241
  \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::getRedeemTypes()
242
- );
243
 
244
  if ($type == self::PAYBYVOUCHER_YEEPAY) {
245
- $customParameters = array_merge($customParameters, array(
246
- 'product_name' => null,
247
- 'product_category' => null
248
- ));
 
 
 
249
  }
250
 
251
  return $customParameters;
156
  */
157
  const SOFORT = 'sofort';
158
 
159
+ /**
160
+ * Global payment system, that makes instant cross-border payments more secure, regulated by Danish and Swiss FSA
161
+ */
162
+ const INPAY = 'inpay';
163
+
164
+ /**
165
+ * P24 is an online banking payment, popular in Poland
166
+ */
167
+ const P24 = 'p24';
168
+
169
+ /**
170
+ * Trustly is a fast and secure oBeP-style alternative payment method. It is free of charge and
171
+ * allows you to deposit money directly from your online bank account.
172
+ */
173
+ const TRUSTLY_SALE = 'trustly_sale';
174
+
175
+ /**
176
+ * Trustly is an oBeP-style alternative payment method that allows you to
177
+ * withdraw money directly from your online bank account using your bank credentials.
178
+ */
179
+ const TRUSTLY_WITHDRAWAL = 'trustly_withdrawal';
180
+
181
+ /**
182
+ * PayPal Express Checkout is a fast, easy way for buyers to pay with PayPal.
183
+ * Express Checkout eliminates one of the major causes of checkout abandonment by giving buyers
184
+ * all the transaction details at once, including order details, shipping options, insurance choices, and tax totals
185
+ */
186
+ const PAYPAL_EXPRESS = 'paypal_express';
187
+
188
+ /**
189
+ * Sepa Direct Debit Payment, popular in Germany.
190
+ * Single Euro Payments Area (SEPA) allows consumers to make cashless Euro payments to
191
+ * any beneficiary located anywhere in the Euro area using only a single bank account
192
+ */
193
+ const SDD_SALE = 'sdd_sale';
194
+
195
+ /**
196
+ * Sepa Direct Debit Payout, popular in Germany.
197
+ * Processed as a SEPA CreditTransfer and can be used for all kind of payout services
198
+ * across the EU with 1 day settlement. Suitable for Gaming, Forex-Binaries, Affiliate Programs or Merchant payouts
199
+ */
200
+ const SDD_PAYOUT = 'sdd_payout';
201
+
202
+ /**
203
+ * Sepa Direct Debit Refund Transaction.
204
+ * Refunds allow to return already billed amounts to customers.
205
+ */
206
+ const SDD_REFUND = 'sdd_refund';
207
+
208
+ /**
209
+ * Sepa Direct Debit initial recurring
210
+ */
211
+ const SDD_INIT_RECURRING_SALE = 'sdd_init_recurring_sale';
212
+
213
+ /**
214
+ * Sepa Direct Debit RecurringSale transaction is a "repeated" transaction,
215
+ * which follows and references an SDD initial transaction
216
+ */
217
+ const SDD_RECURRING_SALE = 'sdd_recurring_sale';
218
+
219
+ /**
220
+ * iDebit connects consumers to their online banking directly from checkout, enabling secure,
221
+ * real-time payments without a credit card.
222
+ * Using iDebit allows consumers to transfer funds to merchants without
223
+ * revealing their personal banking information.
224
+ * iDebit Payin is only asynchronous and uses eCheck.
225
+ */
226
+ const IDEBIT_PAYIN = 'idebit_payin';
227
+
228
+ /**
229
+ * iDebit connects consumers to their online banking directly from checkout, enabling secure,
230
+ * real-time payments without a credit card.
231
+ * Using iDebit allows consumers to transfer funds to merchants without
232
+ * revealing their personal banking information.
233
+ * iDebit Payout is only synchronous and uses eCheck.
234
+ */
235
+ const IDEBIT_PAYOUT = 'idebit_payout';
236
+
237
+ /**
238
+ * InstaDebit connects consumers to their online banking directly from checkout, enabling secure,
239
+ * real- time payments without a credit card.
240
+ * Using InstaDebit allows consumers to transfer funds to merchants without
241
+ * revealing their personal banking information.
242
+ * InstaDebit Payin is only asynchronous and uses online bank transfer.
243
+ */
244
+ const INSTA_DEBIT_PAYIN = 'insta_debit_payin';
245
+
246
+ /**
247
+ * InstaDebit connects consumers to their online banking directly from checkout, enabling secure,
248
+ * real- time payments without a credit card.
249
+ * Using InstaDebit allows consumers to transfer funds to merchants without
250
+ * revealing their personal banking information.
251
+ * InstaDebit Payout is only synchronous and uses online bank transfer.
252
+ */
253
+ const INSTA_DEBIT_PAYOUT = 'insta_debit_payout';
254
+
255
+ /**
256
+ * Citadel is an oBeP-style alternative payment method.
257
+ * It offers merchants the ability to send/receive consumer payments via the use of bank transfer functionality
258
+ * available from the consumer’s online banking website.
259
+ *
260
+ * Payins are only asynchronous. After initiating a transaction the transaction status is set to pending async and
261
+ * the consumer is redirected to Citadel’s Instant Banking website.
262
+ */
263
+ const CITADEL_PAYIN = 'citadel_payin';
264
+
265
+ /**
266
+ * Citadel is an oBeP-style alternative payment method.
267
+ * It offers merchants the ability to send/receive consumer payments via the use of bank transfer functionality
268
+ * available from the consumer’s online banking website.
269
+ *
270
+ * The workflow for Payouts is synchronous, there is no redirect to the Citadel’s Instant Banking website.
271
+ * There are different required fields per country, e.g. IBAN and SWIFT Code or Account Number and Branch Code
272
+ */
273
+ const CITADEL_PAYOUT = 'citadel_payout';
274
+
275
  /**
276
  * Check whether this is a valid (known) transaction type
277
  *
278
+ * @param string $type
279
  * @return bool
280
  */
281
  public static function isValidTransactionType($type)
282
  {
283
+ $transactionTypes = \Genesis\Utils\Common::getClassConstants(__CLASS__);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
 
285
+ return in_array(strtolower($type), $transactionTypes);
286
  }
287
 
288
  /**
289
  * Check whether this is a valid (known) transaction type
290
  *
291
+ * @param string $type
292
  * @return bool
293
  */
294
  public static function isPayByVoucher($type)
295
  {
296
+ $transactionTypesList = [
297
  self::PAYBYVOUCHER_YEEPAY,
298
+ self::PAYBYVOUCHER_SALE
299
+ ];
 
 
 
 
300
 
301
+ return in_array($type, $transactionTypesList);
302
  }
303
 
304
  /**
310
  {
311
  switch ($type) {
312
  case self::PPRO:
313
+ return [
314
+ 'payment_method' => \Genesis\API\Constants\Payment\Methods::getMethods()
315
+ ];
 
316
  break;
317
 
318
  case self::PAYBYVOUCHER_SALE:
319
  case self::PAYBYVOUCHER_YEEPAY:
320
+ $customParameters = [
321
  'card_type' =>
322
  \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes::getCardTypes(),
323
  'redeem_type' =>
324
  \Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes::getRedeemTypes()
325
+ ];
326
 
327
  if ($type == self::PAYBYVOUCHER_YEEPAY) {
328
+ $customParameters = array_merge(
329
+ $customParameters,
330
+ [
331
+ 'product_name' => null,
332
+ 'product_category' => null
333
+ ]
334
+ );
335
  }
336
 
337
  return $customParameters;
lib/Genesis/src/Genesis/API/Notification.php CHANGED
@@ -73,9 +73,9 @@ class Notification
73
  *
74
  * @throws \Genesis\Exceptions\InvalidArgument()
75
  */
76
- public function parseNotification($notification = array(), $authenticate = true)
77
  {
78
- $notificationWalk = array();
79
 
80
  array_walk($notification, function ($val, $key) use (&$notificationWalk) {
81
  $key = trim(rawurldecode($key));
@@ -109,12 +109,12 @@ class Notification
109
  */
110
  public function initReconciliation()
111
  {
 
 
112
  if ($this->isAPINotification()) {
113
  $type = 'NonFinancial\Reconcile\Transaction';
114
  } elseif ($this->isWPFNotification()) {
115
  $type = 'WPF\Reconcile';
116
- } else {
117
- $type = '';
118
  }
119
 
120
  $request = new \Genesis\Genesis($type);
@@ -214,11 +214,11 @@ class Notification
214
  {
215
  $uniqueId = $this->isWPFNotification() ? 'wpf_unique_id' : 'unique_id';
216
 
217
- $structure = array(
218
- 'notification_echo' => array(
219
- $uniqueId => $this->unique_id,
220
- )
221
- );
222
 
223
  $builder = new \Genesis\Builder('xml');
224
  $builder->parseStructure($structure);
73
  *
74
  * @throws \Genesis\Exceptions\InvalidArgument()
75
  */
76
+ public function parseNotification($notification = [], $authenticate = true)
77
  {
78
+ $notificationWalk = [];
79
 
80
  array_walk($notification, function ($val, $key) use (&$notificationWalk) {
81
  $key = trim(rawurldecode($key));
109
  */
110
  public function initReconciliation()
111
  {
112
+ $type = '';
113
+
114
  if ($this->isAPINotification()) {
115
  $type = 'NonFinancial\Reconcile\Transaction';
116
  } elseif ($this->isWPFNotification()) {
117
  $type = 'WPF\Reconcile';
 
 
118
  }
119
 
120
  $request = new \Genesis\Genesis($type);
214
  {
215
  $uniqueId = $this->isWPFNotification() ? 'wpf_unique_id' : 'unique_id';
216
 
217
+ $structure = [
218
+ 'notification_echo' => [
219
+ $uniqueId => $this->unique_id
220
+ ]
221
+ ];
222
 
223
  $builder = new \Genesis\Builder('xml');
224
  $builder->parseStructure($structure);
lib/Genesis/src/Genesis/API/Request.php CHANGED
@@ -20,8 +20,12 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API;
24
 
 
 
 
25
  /**
26
  * Class Request
27
  *
@@ -29,6 +33,8 @@ namespace Genesis\API;
29
  *
30
  * @package Genesis
31
  * @subpackage API
 
 
32
  */
33
  abstract class Request
34
  {
@@ -60,6 +66,13 @@ abstract class Request
60
  */
61
  protected $requiredFields;
62
 
 
 
 
 
 
 
 
63
  /**
64
  * Store the names of "conditionally" Required fields.
65
  *
@@ -113,7 +126,7 @@ abstract class Request
113
  */
114
  public function __call($method, $args)
115
  {
116
- list($action, $target) = \Genesis\Utils\Common::resolveDynamicMethod($method);
117
 
118
  switch ($action) {
119
  case 'get':
@@ -183,7 +196,7 @@ abstract class Request
183
  {
184
  if ($this->treeStructure instanceof \ArrayObject) {
185
  $this->treeStructure->exchangeArray(
186
- \Genesis\Utils\Common::emptyValueRecursiveRemoval(
187
  $this->treeStructure->getArrayCopy()
188
  )
189
  );
@@ -200,6 +213,8 @@ abstract class Request
200
  {
201
  $this->verifyFieldRequirements();
202
 
 
 
203
  $this->verifyGroupRequirements();
204
 
205
  $this->verifyConditionalRequirements();
@@ -229,6 +244,57 @@ abstract class Request
229
  }
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  /**
233
  * Verify that the group fields in the request are populated
234
  *
@@ -240,7 +306,7 @@ abstract class Request
240
  $fields = $this->requiredFieldsGroups->getArrayCopy();
241
 
242
  $emptyFlag = false;
243
- $groupsFormatted = array();
244
 
245
  foreach ($fields as $group => $groupFields) {
246
  $groupsFormatted[] = sprintf(
@@ -276,25 +342,53 @@ abstract class Request
276
  * Verify that all fields (who depend on previously populated fields) are populated
277
  *
278
  * @throws \Genesis\Exceptions\ErrorParameter
 
 
279
  */
280
  protected function verifyConditionalRequirements()
281
  {
282
- if (isset($this->requiredFieldsConditional)) {
283
- $fields = $this->requiredFieldsConditional->getArrayCopy();
 
284
 
285
- foreach ($fields as $fieldName => $fieldDependencies) {
286
- if (isset($this->$fieldName) && !empty($this->$fieldName)) {
287
- foreach ($fieldDependencies as $field) {
 
 
 
 
 
 
 
 
 
 
 
288
  if (empty($this->$field)) {
 
 
 
 
 
289
  throw new \Genesis\Exceptions\ErrorParameter(
290
  sprintf(
291
- '%s is depending on: %s, which is empty (null)!',
292
  $fieldName,
 
293
  $field
294
  )
295
  );
296
  }
297
  }
 
 
 
 
 
 
 
 
298
  }
299
  }
300
  }
@@ -336,10 +430,10 @@ abstract class Request
336
  */
337
  protected function transform($method, $args, $prefix = 'transform')
338
  {
339
- $method = $prefix . \Genesis\Utils\Common::snakeCaseToCamelCase($method);
340
 
341
  if (method_exists($this, $method)) {
342
- $result = call_user_func_array(array($this, $method), $args);
343
 
344
  if ($result) {
345
  return $result;
@@ -401,7 +495,12 @@ abstract class Request
401
  $path = ($token) ? sprintf('%s/%s/', $path, $token) : $path;
402
 
403
  return sprintf(
404
- '%s://%s%s:%s/%s', $protocol, $sub, $domain, $port, $path
 
 
 
 
 
405
  );
406
  }
407
 
@@ -422,7 +521,42 @@ abstract class Request
422
  */
423
  protected function initConfiguration()
424
  {
 
425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  }
427
 
428
  /**
@@ -430,7 +564,6 @@ abstract class Request
430
  */
431
  protected function setRequiredFields()
432
  {
433
-
434
  }
435
 
436
  /**
@@ -439,6 +572,5 @@ abstract class Request
439
  */
440
  protected function populateStructure()
441
  {
442
-
443
  }
444
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API;
25
 
26
+ use Genesis\API\Validators\Request\Base\Validator as RequestValidator;
27
+ use Genesis\Utils\Common as CommonUtils;
28
+
29
  /**
30
  * Class Request
31
  *
33
  *
34
  * @package Genesis
35
  * @subpackage API
36
+ *
37
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
38
  */
39
  abstract class Request
40
  {
66
  */
67
  protected $requiredFields;
68
 
69
+ /**
70
+ * Store the names of the field values that are Required
71
+ *
72
+ * @var \ArrayObject
73
+ */
74
+ protected $requiredFieldValues;
75
+
76
  /**
77
  * Store the names of "conditionally" Required fields.
78
  *
126
  */
127
  public function __call($method, $args)
128
  {
129
+ list($action, $target) = CommonUtils::resolveDynamicMethod($method);
130
 
131
  switch ($action) {
132
  case 'get':
196
  {
197
  if ($this->treeStructure instanceof \ArrayObject) {
198
  $this->treeStructure->exchangeArray(
199
+ CommonUtils::emptyValueRecursiveRemoval(
200
  $this->treeStructure->getArrayCopy()
201
  )
202
  );
213
  {
214
  $this->verifyFieldRequirements();
215
 
216
+ $this->verifyFieldValuesRequirements();
217
+
218
  $this->verifyGroupRequirements();
219
 
220
  $this->verifyConditionalRequirements();
244
  }
245
  }
246
 
247
+ /**
248
+ * Verify that all required fields are populated with expected values
249
+ *
250
+ * @throws \Genesis\Exceptions\ErrorParameter
251
+ */
252
+ protected function verifyFieldValuesRequirements()
253
+ {
254
+ if (!isset($this->requiredFieldValues)) {
255
+ return;
256
+ }
257
+
258
+ $iterator = $this->requiredFieldValues->getArrayCopy();
259
+
260
+ foreach ($iterator as $fieldName => $validator) {
261
+ if ($validator instanceof RequestValidator) {
262
+ $validator->run($this, $fieldName);
263
+
264
+ continue;
265
+ }
266
+
267
+ if (CommonUtils::isValidArray($validator)) {
268
+ if (!in_array($this->$fieldName, $validator)) {
269
+ throw new \Genesis\Exceptions\ErrorParameter(
270
+ sprintf(
271
+ 'Required parameter %s is set to %s, but expected to be one of (%s)',
272
+ $fieldName,
273
+ $this->$fieldName,
274
+ implode(
275
+ ', ',
276
+ CommonUtils::getSortedArrayByValue($validator)
277
+ )
278
+ )
279
+ );
280
+ }
281
+
282
+ continue;
283
+ }
284
+
285
+ if ($this->$fieldName !== $validator) {
286
+ throw new \Genesis\Exceptions\ErrorParameter(
287
+ sprintf(
288
+ 'Required parameter %s is set to %s, but expected to be %s',
289
+ $fieldName,
290
+ $this->$fieldName,
291
+ $validator
292
+ )
293
+ );
294
+ }
295
+ }
296
+ }
297
+
298
  /**
299
  * Verify that the group fields in the request are populated
300
  *
306
  $fields = $this->requiredFieldsGroups->getArrayCopy();
307
 
308
  $emptyFlag = false;
309
+ $groupsFormatted = [];
310
 
311
  foreach ($fields as $group => $groupFields) {
312
  $groupsFormatted[] = sprintf(
342
  * Verify that all fields (who depend on previously populated fields) are populated
343
  *
344
  * @throws \Genesis\Exceptions\ErrorParameter
345
+ *
346
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
347
  */
348
  protected function verifyConditionalRequirements()
349
  {
350
+ if (!isset($this->requiredFieldsConditional)) {
351
+ return;
352
+ }
353
 
354
+ $fields = $this->requiredFieldsConditional->getArrayCopy();
355
+
356
+ foreach ($fields as $fieldName => $fieldDependencies) {
357
+ if (!isset($this->$fieldName)) {
358
+ continue;
359
+ }
360
+
361
+ foreach ($fieldDependencies as $fieldValue => $fieldDependency) {
362
+ if (is_array($fieldDependency)) {
363
+ if ($this->$fieldName != $fieldValue) {
364
+ continue;
365
+ }
366
+
367
+ foreach ($fieldDependency as $field) {
368
  if (empty($this->$field)) {
369
+ $fieldValue =
370
+ is_bool($this->$fieldName)
371
+ ? var_export($this->$fieldName, true)
372
+ : $this->$fieldName;
373
+
374
  throw new \Genesis\Exceptions\ErrorParameter(
375
  sprintf(
376
+ '%s with value %s is depending on: %s, which is empty (null)!',
377
  $fieldName,
378
+ $fieldValue,
379
  $field
380
  )
381
  );
382
  }
383
  }
384
+ } elseif (empty($this->$fieldDependency)) {
385
+ throw new \Genesis\Exceptions\ErrorParameter(
386
+ sprintf(
387
+ '%s is depending on: %s, which is empty (null)!',
388
+ $fieldName,
389
+ $fieldDependency
390
+ )
391
+ );
392
  }
393
  }
394
  }
430
  */
431
  protected function transform($method, $args, $prefix = 'transform')
432
  {
433
+ $method = $prefix . CommonUtils::snakeCaseToCamelCase($method);
434
 
435
  if (method_exists($this, $method)) {
436
+ $result = call_user_func_array([$this, $method], $args);
437
 
438
  if ($result) {
439
  return $result;
495
  $path = ($token) ? sprintf('%s/%s/', $path, $token) : $path;
496
 
497
  return sprintf(
498
+ '%s://%s%s:%s/%s',
499
+ $protocol,
500
+ $sub,
501
+ $domain,
502
+ $port,
503
+ $path
504
  );
505
  }
506
 
521
  */
522
  protected function initConfiguration()
523
  {
524
+ }
525
 
526
+ /**
527
+ * Configures a Secured Post Request with Xml body
528
+ *
529
+ * @return void
530
+ */
531
+ protected function initXmlConfiguration()
532
+ {
533
+ $this->config = CommonUtils::createArrayObject(
534
+ [
535
+ 'protocol' => 'https',
536
+ 'port' => 443,
537
+ 'type' => 'POST',
538
+ 'format' => 'xml'
539
+ ]
540
+ );
541
+ }
542
+
543
+ /**
544
+ * Initializes Api EndPoint Url with request path & terminal token
545
+ *
546
+ * @param string $requestPath
547
+ * @param bool $includeToken
548
+ * @return void
549
+ */
550
+ protected function initApiGatewayConfiguration($requestPath = 'process', $includeToken = true)
551
+ {
552
+ $this->setApiConfig(
553
+ 'url',
554
+ $this->buildRequestURL(
555
+ 'gateway',
556
+ $requestPath,
557
+ ($includeToken ? \Genesis\Config::getToken() : false)
558
+ )
559
+ );
560
  }
561
 
562
  /**
564
  */
565
  protected function setRequiredFields()
566
  {
 
567
  }
568
 
569
  /**
572
  */
573
  protected function populateStructure()
574
  {
 
575
  }
576
  }
lib/Genesis/src/Genesis/API/Request/Base/Financial.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Base;
25
+
26
+ use Genesis\API\Traits\Request\BaseAttributes;
27
+ use Genesis\Utils\Common as CommonUtils;
28
+
29
+ /**
30
+ * Class Financial
31
+ *
32
+ * Base Abstract Class for all Financial Requests
33
+ *
34
+ * @package Genesis\API\Request\Base
35
+ */
36
+ abstract class Financial extends \Genesis\API\Request
37
+ {
38
+ use BaseAttributes;
39
+
40
+ /**
41
+ * Store the names of "conditionally" Required fields with expected values.
42
+ *
43
+ * @var \ArrayObject
44
+ */
45
+ protected $requiredFieldValuesConditional;
46
+
47
+ /**
48
+ * Returns the Request transaction type
49
+ * @return string
50
+ */
51
+ abstract protected function getTransactionType();
52
+
53
+ /**
54
+ * Return additional request attributes
55
+ * @return array
56
+ */
57
+ abstract protected function getPaymentTransactionStructure();
58
+
59
+ /**
60
+ * Initialize per-request configuration
61
+ */
62
+ protected function initConfiguration()
63
+ {
64
+ $this->initXmlConfiguration();
65
+
66
+ $this->initApiGatewayConfiguration();
67
+ }
68
+
69
+ /**
70
+ * Perform field validation
71
+ *
72
+ * @throws \Genesis\Exceptions\ErrorParameter
73
+ * @return void
74
+ */
75
+ protected function checkRequirements()
76
+ {
77
+ parent::checkRequirements();
78
+
79
+ $this->verifyConditionalValuesRequirements();
80
+ }
81
+
82
+ /**
83
+ * Verify that all fields (who depend on previously populated fields)
84
+ * are populated with expected values
85
+ *
86
+ * @throws \Genesis\Exceptions\ErrorParameter
87
+ *
88
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
89
+ * @SuppressWarnings(PHPMD.NPathComplexity)
90
+ */
91
+ protected function verifyConditionalValuesRequirements()
92
+ {
93
+ if (!isset($this->requiredFieldValuesConditional)) {
94
+ return;
95
+ }
96
+
97
+ $fields = $this->requiredFieldValuesConditional->getArrayCopy();
98
+
99
+ foreach ($fields as $parentFieldName => $parentFieldDependencies) {
100
+ if (!isset($this->$parentFieldName)) {
101
+ continue;
102
+ }
103
+
104
+ foreach ($parentFieldDependencies as $parentFieldValue => $childFieldsDependency) {
105
+ if ($this->$parentFieldName !== $parentFieldValue) {
106
+ continue;
107
+ }
108
+
109
+ $childFieldGroupValuesValidated = false;
110
+
111
+ foreach ($childFieldsDependency as $childFieldDependency) {
112
+ $childFieldValuesValidated = true;
113
+
114
+ foreach ($childFieldDependency as $childFieldName => $childFieldValues) {
115
+ if (CommonUtils::isValidArray($childFieldValues)) {
116
+ if (!in_array($this->$childFieldName, $childFieldValues)) {
117
+ $childFieldValuesValidated = false;
118
+ }
119
+
120
+ continue;
121
+ }
122
+
123
+ if ($this->$childFieldName !== $childFieldValues) {
124
+ $childFieldValuesValidated = false;
125
+ }
126
+ }
127
+
128
+ if ($childFieldValuesValidated) {
129
+ $childFieldGroupValuesValidated = true;
130
+
131
+ break;
132
+ }
133
+ }
134
+
135
+ if (!$childFieldGroupValuesValidated) {
136
+ throw new \Genesis\Exceptions\ErrorParameter(
137
+ sprintf(
138
+ '%s with value %s is depending on group of params with specific values. ' .
139
+ 'Please, refer to the official API documentation for %s transaction type.',
140
+ $parentFieldName,
141
+ $parentFieldValue,
142
+ $this->getTransactionType()
143
+ )
144
+ );
145
+ }
146
+ }
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Create the request's Tree structure
152
+ *
153
+ * @return void
154
+ */
155
+ protected function populateStructure()
156
+ {
157
+ $treeStructure = [
158
+ 'payment_transaction' => [
159
+ 'transaction_type' => $this->getTransactionType(),
160
+ 'transaction_id' => $this->transaction_id,
161
+ 'usage' => $this->usage,
162
+ 'remote_ip' => $this->remote_ip
163
+ ]
164
+ ];
165
+
166
+ $treeStructure['payment_transaction'] += $this->getPaymentTransactionStructure();
167
+
168
+ $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
169
+ }
170
+ }
lib/Genesis/src/Genesis/API/Request/Base/Financial/Alternative.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Base\Financial;
25
+
26
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
+ /**
31
+ * Class Alternative
32
+ *
33
+ * Base Class for Alternative Payment Methods
34
+ *
35
+ * @package Genesis\API\Request\Base\Financial
36
+ */
37
+ abstract class Alternative extends \Genesis\API\Request\Base\Financial
38
+ {
39
+ use AsyncAttributes, PaymentAttributes, AddressInfoAttributes;
40
+
41
+ /**
42
+ * Set the required fields
43
+ *
44
+ * @return void
45
+ */
46
+ protected function setRequiredFields()
47
+ {
48
+ $requiredFields = [
49
+ 'transaction_id',
50
+ 'remote_ip',
51
+ 'amount',
52
+ 'currency',
53
+ 'return_success_url',
54
+ 'return_failure_url',
55
+ 'customer_email',
56
+ 'billing_country'
57
+ ];
58
+
59
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
60
+
61
+ $requiredFieldValues = [
62
+ 'billing_country' => \Genesis\Utils\Country::getList(),
63
+ 'currency' => \Genesis\Utils\Currency::getList()
64
+ ];
65
+
66
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
67
+ }
68
+
69
+ /**
70
+ * Return additional request attributes
71
+ * @return array
72
+ */
73
+ protected function getPaymentTransactionStructure()
74
+ {
75
+ return [
76
+ 'return_success_url' => $this->return_success_url,
77
+ 'return_failure_url' => $this->return_failure_url,
78
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
79
+ 'currency' => $this->currency,
80
+ 'customer_email' => $this->customer_email,
81
+ 'customer_phone' => $this->customer_phone,
82
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
83
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
84
+ ];
85
+ }
86
+ }
lib/Genesis/src/Genesis/API/Request/Base/Financial/Reference.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Base\Financial;
25
+
26
+ use Genesis\API\Traits\Request\Financial\ReferenceAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+
29
+ /**
30
+ * Class Reference
31
+ *
32
+ * Base Abstract Class for Reference Transactions
33
+ * - Capture
34
+ * - Refund
35
+ * - Credit
36
+ * - Recurring
37
+ *
38
+ * @package Genesis\API\Request\Base\Financial
39
+ */
40
+ abstract class Reference extends \Genesis\API\Request\Base\Financial
41
+ {
42
+ use ReferenceAttributes, PaymentAttributes;
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ $requiredFields = [
52
+ 'transaction_id',
53
+ 'reference_id',
54
+ 'amount',
55
+ 'currency'
56
+ ];
57
+
58
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
59
+
60
+ $requiredFieldValues = [
61
+ 'currency' => \Genesis\Utils\Currency::getList()
62
+ ];
63
+
64
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
65
+ }
66
+
67
+ /**
68
+ * Return additional request attributes
69
+ * @return array
70
+ */
71
+ protected function getPaymentTransactionStructure()
72
+ {
73
+ return [
74
+ 'reference_id' => $this->reference_id,
75
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
76
+ 'currency' => $this->currency
77
+ ];
78
+ }
79
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/ABNiDEAL.php CHANGED
@@ -20,79 +20,25 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
 
 
 
 
25
  /**
26
  * Class ABNiDEAL
27
  *
28
  * Alternative payment method for The Netherlands
29
  *
30
  * @package Genesis\API\Request\Financial\Alternatives
 
 
31
  */
32
- class ABNiDEAL extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
 
97
  /**
98
  * The bank id of the bank where the customer resides
@@ -104,212 +50,12 @@ class ABNiDEAL extends \Genesis\API\Request
104
  protected $customer_bank_id;
105
 
106
  /**
107
- *Customer's Billing Address: First name
108
- *
109
- * @var string
110
- */
111
- protected $billing_first_name;
112
-
113
- /**
114
- * Customer's Billing Address: Last name
115
- *
116
- * @var string
117
- */
118
- protected $billing_last_name;
119
-
120
- /**
121
- * Customer's Billing Address: Part 1
122
- *
123
- * @var string
124
- */
125
- protected $billing_address1;
126
-
127
- /**
128
- * Customer's Billing Address: Part 2
129
- * @var string
130
- */
131
- protected $billing_address2;
132
-
133
- /**
134
- * Customer's Billing Address: ZIP
135
- *
136
- * @var string
137
- */
138
- protected $billing_zip_code;
139
-
140
- /**
141
- * Customer's Billing Address: City
142
- *
143
- * @var string
144
- */
145
- protected $billing_city;
146
-
147
- /**
148
- * Customer's Billing Address: State
149
- *
150
- * format: ISO-3166-2
151
- *
152
- * @var string
153
  */
154
- protected $billing_state;
155
-
156
- /**
157
- * Customer's Billing Address: Country
158
- *
159
- * format: ISO-3166
160
- *
161
- * @var string
162
- */
163
- protected $billing_country;
164
-
165
- /**
166
- * Customer's Shipping Address: First name
167
- *
168
- * @var string
169
- */
170
- protected $shipping_first_name;
171
-
172
- /**
173
- * Customer's Shipping Address: Last name
174
- *
175
- * @var string
176
- */
177
- protected $shipping_last_name;
178
-
179
- /**
180
- * Customer's Shipping Address: Part 1
181
- *
182
- * @var string
183
- */
184
- protected $shipping_address1;
185
-
186
- /**
187
- * Customer's Shipping Address: Part 2
188
- *
189
- * @var string
190
- */
191
- protected $shipping_address2;
192
-
193
- /**
194
- * Customer's Shipping Address: ZIP
195
- *
196
- * @var string
197
- */
198
- protected $shipping_zip_code;
199
-
200
- /**
201
- * Customer's Shipping Address: City
202
- *
203
- * @var string
204
- */
205
- protected $shipping_city;
206
-
207
- /**
208
- * Customer's Shipping Address: State
209
- *
210
- * format: ISO-3166-2
211
- *
212
- * @var string
213
- */
214
- protected $shipping_state;
215
-
216
- /**
217
- * Customer's Shipping Address
218
- *
219
- * format: ISO-3166
220
- *
221
- * @var string
222
- */
223
- protected $shipping_country;
224
-
225
- /**
226
- * Social Security number or equivalent value for non US customers.
227
- *
228
- * @var string
229
- */
230
- protected $risk_ssn;
231
-
232
- /**
233
- * Customer's MAC address
234
- *
235
- * @var string
236
- */
237
- protected $risk_mac_address;
238
-
239
- /**
240
- * Customer's Session Id
241
- *
242
- * @var string
243
- */
244
- protected $risk_session_id;
245
-
246
- /**
247
- * Customer's User Id
248
- *
249
- * @var string
250
- */
251
- protected $risk_user_id;
252
-
253
- /**
254
- * Customer's User Level
255
- *
256
- * @var string
257
- */
258
- protected $risk_user_level;
259
-
260
- /**
261
- * Customer's Email address
262
- *
263
- * @note Set here if different from
264
- * shipping / billing
265
- *
266
- * @var string
267
- */
268
- protected $risk_email;
269
-
270
- /**
271
- * Customer's Phone number
272
- *
273
- * @note Set here if different from
274
- * shipping / billing
275
- *
276
- * @var string
277
- */
278
- protected $risk_phone;
279
-
280
- /**
281
- * Customer's IP address
282
- *
283
- * @note Set here if different from remote_ip
284
- *
285
- * @var string
286
- */
287
- protected $risk_remote_ip;
288
-
289
- /**
290
- * Customer's Serial Number
291
- *
292
- * @var string
293
- */
294
- protected $risk_serial_number;
295
-
296
- /**
297
- * Set the per-request configuration
298
- *
299
- * @return void
300
- */
301
- protected function initConfiguration()
302
  {
303
- $this->config = \Genesis\Utils\Common::createArrayObject(
304
- array(
305
- 'protocol' => 'https',
306
- 'port' => 443,
307
- 'type' => 'POST',
308
- 'format' => 'xml',
309
- )
310
- );
311
-
312
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
313
  }
314
 
315
  /**
@@ -319,7 +65,7 @@ class ABNiDEAL extends \Genesis\API\Request
319
  */
320
  protected function setRequiredFields()
321
  {
322
- $requiredFields = array(
323
  'transaction_id',
324
  'remote_ip',
325
  'amount',
@@ -329,71 +75,34 @@ class ABNiDEAL extends \Genesis\API\Request
329
  'customer_email',
330
  'customer_bank_id',
331
  'billing_country'
332
- );
333
 
334
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
335
  }
336
 
337
  /**
338
- * Create the request's Tree structure
339
- *
340
- * @return void
341
  */
342
- protected function populateStructure()
343
  {
344
- $treeStructure = array(
345
- 'payment_transaction' => array(
346
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::ABNIDEAL,
347
- 'transaction_id' => $this->transaction_id,
348
- 'usage' => $this->usage,
349
- 'remote_ip' => $this->remote_ip,
350
- 'return_success_url' => $this->return_success_url,
351
- 'return_failure_url' => $this->return_failure_url,
352
- 'amount' => $this->transform(
353
- 'amount',
354
- array(
355
- $this->amount,
356
- $this->currency,
357
- )
358
- ),
359
- 'currency' => $this->currency,
360
- 'customer_email' => $this->customer_email,
361
- 'customer_phone' => $this->customer_phone,
362
- 'customer_bank_id' => $this->customer_bank_id,
363
- 'billing_address' => array(
364
- 'first_name' => $this->billing_first_name,
365
- 'last_name' => $this->billing_last_name,
366
- 'address1' => $this->billing_address1,
367
- 'address2' => $this->billing_address2,
368
- 'zip_code' => $this->billing_zip_code,
369
- 'city' => $this->billing_city,
370
- 'state' => $this->billing_state,
371
- 'country' => $this->billing_country,
372
- ),
373
- 'shipping_address' => array(
374
- 'first_name' => $this->shipping_first_name,
375
- 'last_name' => $this->shipping_last_name,
376
- 'address1' => $this->shipping_address1,
377
- 'address2' => $this->shipping_address2,
378
- 'zip_code' => $this->shipping_zip_code,
379
- 'city' => $this->shipping_city,
380
- 'state' => $this->shipping_state,
381
- 'country' => $this->shipping_country,
382
- ),
383
- 'risk_params' => array(
384
- 'ssn' => $this->risk_ssn,
385
- 'mac_address' => $this->risk_mac_address,
386
- 'session_id' => $this->risk_session_id,
387
- 'user_id' => $this->risk_user_id,
388
- 'user_level' => $this->risk_user_level,
389
- 'email' => $this->risk_email,
390
- 'phone' => $this->risk_phone,
391
- 'remote_ip' => $this->risk_remote_ip,
392
- 'serial_number' => $this->risk_serial_number,
393
- ),
394
- )
395
- );
396
-
397
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
398
  }
399
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
  /**
31
  * Class ABNiDEAL
32
  *
33
  * Alternative payment method for The Netherlands
34
  *
35
  * @package Genesis\API\Request\Financial\Alternatives
36
+ *
37
+ * @method ABNiDEAL setCustomerBankId($value) Set the bank id of the bank where the customer resides
38
  */
39
+ class ABNiDEAL extends \Genesis\API\Request\Base\Financial
40
  {
41
+ use AsyncAttributes, PaymentAttributes, AddressInfoAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  /**
44
  * The bank id of the bank where the customer resides
50
  protected $customer_bank_id;
51
 
52
  /**
53
+ * Returns the Request transaction type
54
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  */
56
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  {
58
+ return \Genesis\API\Constants\Transaction\Types::ABNIDEAL;
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
  /**
65
  */
66
  protected function setRequiredFields()
67
  {
68
+ $requiredFields = [
69
  'transaction_id',
70
  'remote_ip',
71
  'amount',
75
  'customer_email',
76
  'customer_bank_id',
77
  'billing_country'
78
+ ];
79
 
80
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
81
+
82
+ $requiredFieldValues = [
83
+ 'billing_country' => \Genesis\Utils\Country::getList(),
84
+ 'currency' => \Genesis\Utils\Currency::getList()
85
+ ];
86
+
87
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
88
  }
89
 
90
  /**
91
+ * Return additional request attributes
92
+ * @return array
 
93
  */
94
+ protected function getPaymentTransactionStructure()
95
  {
96
+ return [
97
+ 'return_success_url' => $this->return_success_url,
98
+ 'return_failure_url' => $this->return_failure_url,
99
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
100
+ 'currency' => $this->currency,
101
+ 'customer_email' => $this->customer_email,
102
+ 'customer_phone' => $this->customer_phone,
103
+ 'customer_bank_id' => $this->customer_bank_id,
104
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
105
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
106
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/CashU.php CHANGED
@@ -20,6 +20,7 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
25
  /**
@@ -29,278 +30,15 @@ namespace Genesis\API\Request\Financial\Alternatives;
29
  *
30
  * @package Genesis\API\Request\Financial\Alternatives
31
  */
32
- class CashU extends \Genesis\API\Request
33
  {
34
  /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
-
97
- /**
98
- *Customer's Billing Address: First name
99
- *
100
- * @var string
101
- */
102
- protected $billing_first_name;
103
-
104
- /**
105
- * Customer's Billing Address: Last name
106
- *
107
- * @var string
108
- */
109
- protected $billing_last_name;
110
-
111
- /**
112
- * Customer's Billing Address: Part 1
113
- *
114
- * @var string
115
- */
116
- protected $billing_address1;
117
-
118
- /**
119
- * Customer's Billing Address: Part 2
120
- * @var string
121
  */
122
- protected $billing_address2;
123
-
124
- /**
125
- * Customer's Billing Address: ZIP
126
- *
127
- * @var string
128
- */
129
- protected $billing_zip_code;
130
-
131
- /**
132
- * Customer's Billing Address: City
133
- *
134
- * @var string
135
- */
136
- protected $billing_city;
137
-
138
- /**
139
- * Customer's Billing Address: State
140
- *
141
- * format: ISO-3166-2
142
- *
143
- * @var string
144
- */
145
- protected $billing_state;
146
-
147
- /**
148
- * Customer's Billing Address: Country
149
- *
150
- * format: ISO-3166
151
- *
152
- * @var string
153
- */
154
- protected $billing_country;
155
-
156
- /**
157
- * Customer's Shipping Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $shipping_first_name;
162
-
163
- /**
164
- * Customer's Shipping Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $shipping_last_name;
169
-
170
- /**
171
- * Customer's Shipping Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $shipping_address1;
176
-
177
- /**
178
- * Customer's Shipping Address: Part 2
179
- *
180
- * @var string
181
- */
182
- protected $shipping_address2;
183
-
184
- /**
185
- * Customer's Shipping Address: ZIP
186
- *
187
- * @var string
188
- */
189
- protected $shipping_zip_code;
190
-
191
- /**
192
- * Customer's Shipping Address: City
193
- *
194
- * @var string
195
- */
196
- protected $shipping_city;
197
-
198
- /**
199
- * Customer's Shipping Address: State
200
- *
201
- * format: ISO-3166-2
202
- *
203
- * @var string
204
- */
205
- protected $shipping_state;
206
-
207
- /**
208
- * Customer's Shipping Address
209
- *
210
- * format: ISO-3166
211
- *
212
- * @var string
213
- */
214
- protected $shipping_country;
215
-
216
- /**
217
- * Social Security number or equivalent value for non US customers.
218
- *
219
- * @var string
220
- */
221
- protected $risk_ssn;
222
-
223
- /**
224
- * Customer's MAC address
225
- *
226
- * @var string
227
- */
228
- protected $risk_mac_address;
229
-
230
- /**
231
- * Customer's Session Id
232
- *
233
- * @var string
234
- */
235
- protected $risk_session_id;
236
-
237
- /**
238
- * Customer's User Id
239
- *
240
- * @var string
241
- */
242
- protected $risk_user_id;
243
-
244
- /**
245
- * Customer's User Level
246
- *
247
- * @var string
248
- */
249
- protected $risk_user_level;
250
-
251
- /**
252
- * Customer's Email address
253
- *
254
- * @note Set here if different from
255
- * shipping / billing
256
- *
257
- * @var string
258
- */
259
- protected $risk_email;
260
-
261
- /**
262
- * Customer's Phone number
263
- *
264
- * @note Set here if different from
265
- * shipping / billing
266
- *
267
- * @var string
268
- */
269
- protected $risk_phone;
270
-
271
- /**
272
- * Customer's IP address
273
- *
274
- * @note Set here if different from remote_ip
275
- *
276
- * @var string
277
- */
278
- protected $risk_remote_ip;
279
-
280
- /**
281
- * Customer's Serial Number
282
- *
283
- * @var string
284
- */
285
- protected $risk_serial_number;
286
-
287
- /**
288
- * Set the per-request configuration
289
- *
290
- * @return void
291
- */
292
- protected function initConfiguration()
293
  {
294
- $this->config = \Genesis\Utils\Common::createArrayObject(
295
- array(
296
- 'protocol' => 'https',
297
- 'port' => 443,
298
- 'type' => 'POST',
299
- 'format' => 'xml',
300
- )
301
- );
302
-
303
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
304
  }
305
 
306
  /**
@@ -310,78 +48,19 @@ class CashU extends \Genesis\API\Request
310
  */
311
  protected function setRequiredFields()
312
  {
313
- $requiredFields = array(
314
- 'transaction_id',
315
- 'remote_ip',
316
- 'amount',
317
- 'currency',
318
- 'return_success_url',
319
- 'return_failure_url',
320
- 'customer_email',
321
- );
322
-
323
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
324
- }
325
-
326
- /**
327
- * Create the request's Tree structure
328
- *
329
- * @return void
330
- */
331
- protected function populateStructure()
332
- {
333
- $treeStructure = array(
334
- 'payment_transaction' => array(
335
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::CASHU,
336
- 'transaction_id' => $this->transaction_id,
337
- 'usage' => $this->usage,
338
- 'remote_ip' => $this->remote_ip,
339
- 'return_success_url' => $this->return_success_url,
340
- 'return_failure_url' => $this->return_failure_url,
341
- 'amount' => $this->transform(
342
- 'amount',
343
- array(
344
- $this->amount,
345
- $this->currency,
346
- )
347
- ),
348
- 'currency' => $this->currency,
349
- 'customer_email' => $this->customer_email,
350
- 'customer_phone' => $this->customer_phone,
351
- 'billing_address' => array(
352
- 'first_name' => $this->billing_first_name,
353
- 'last_name' => $this->billing_last_name,
354
- 'address1' => $this->billing_address1,
355
- 'address2' => $this->billing_address2,
356
- 'zip_code' => $this->billing_zip_code,
357
- 'city' => $this->billing_city,
358
- 'state' => $this->billing_state,
359
- 'country' => $this->billing_country,
360
- ),
361
- 'shipping_address' => array(
362
- 'first_name' => $this->shipping_first_name,
363
- 'last_name' => $this->shipping_last_name,
364
- 'address1' => $this->shipping_address1,
365
- 'address2' => $this->shipping_address2,
366
- 'zip_code' => $this->shipping_zip_code,
367
- 'city' => $this->shipping_city,
368
- 'state' => $this->shipping_state,
369
- 'country' => $this->shipping_country,
370
- ),
371
- 'risk_params' => array(
372
- 'ssn' => $this->risk_ssn,
373
- 'mac_address' => $this->risk_mac_address,
374
- 'session_id' => $this->risk_session_id,
375
- 'user_id' => $this->risk_user_id,
376
- 'user_level' => $this->risk_user_level,
377
- 'email' => $this->risk_email,
378
- 'phone' => $this->risk_phone,
379
- 'remote_ip' => $this->risk_remote_ip,
380
- 'serial_number' => $this->risk_serial_number,
381
- ),
382
- )
383
- );
384
-
385
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
386
  }
387
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
  /**
30
  *
31
  * @package Genesis\API\Request\Financial\Alternatives
32
  */
33
+ class CashU extends \Genesis\API\Request\Base\Financial\Alternative
34
  {
35
  /**
36
+ * Returns the Request transaction type
37
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  {
41
+ return \Genesis\API\Constants\Transaction\Types::CASHU;
 
 
 
 
 
 
 
 
 
42
  }
43
 
44
  /**
48
  */
49
  protected function setRequiredFields()
50
  {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFieldValues = [
54
+ 'billing_country' => [
55
+ 'DZ', 'BH', 'EG', 'GM', 'GH', 'IN', 'IR', 'IQ', 'IL', 'JO', 'KE',
56
+ 'KR', 'KW', 'LB', 'LY', 'MY', 'MR', 'MA', 'NG', 'OM', 'PK', 'PS',
57
+ 'QA', 'SA', 'SL', 'SD', 'SY', 'TZ', 'TN', 'TR', 'AE', 'US', 'YE'
58
+ ],
59
+ 'currency' => [
60
+ 'USD', 'AED', 'EUR', 'JOD', 'EGP', 'SAR', 'DZD', 'LBP', 'MAD', 'QAR', 'TRY'
61
+ ]
62
+ ];
63
+
64
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/INPay.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\Alternatives;
25
+
26
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
+ /**
31
+ * Class INPay
32
+ *
33
+ * Alternative payment method
34
+ *
35
+ * @package Genesis\API\Request\Financial\Alternatives
36
+ *
37
+ * @method INPay setCustomerBankId($value) The Bank ID of the selected bank from the Getbanks Request
38
+ * @method INPay setOrderDescription($value) The a short description of the order
39
+ * @method INPay setPayoutOrderId($value) Set an Order ID to relate this Payout to an Order
40
+ * @method INPay setPayoutBankCountry($value) Set Country of the refund targets Bank Account 2-letter country code
41
+ * @method INPay setPayoutBankName($value) Set Refund targets Bank Name
42
+ * @method INPay setPayoutSwift($value) Set SWIFT/BIC Code
43
+ * @method INPay setPayoutAccNumber($value) Set Account number or IBAN
44
+ * @method INPay setPayoutBankAddress($value) Set Bank address
45
+ * @method INPay setPayoutOwnerName($value) Set Bank account owner name
46
+ * @method INPay setPayoutOwnerAddress($value) Set Bank account owner address
47
+ */
48
+ class INPay extends \Genesis\API\Request\Base\Financial
49
+ {
50
+ use AsyncAttributes, PaymentAttributes, AddressInfoAttributes;
51
+
52
+ /**
53
+ * Flag for payout transaction
54
+ *
55
+ * @var string
56
+ */
57
+ protected $is_payout;
58
+
59
+ /**
60
+ * The Bank ID of the selected bank from the Getbanks Request
61
+ * @var string
62
+ */
63
+ protected $customer_bank_id;
64
+
65
+ /**
66
+ * A short description of the order
67
+ * @var string
68
+ */
69
+ protected $order_description;
70
+
71
+ /**
72
+ * Order ID to relate this Payout to an Order
73
+ * @var string
74
+ */
75
+ protected $payout_order_id;
76
+
77
+ /**
78
+ * Country of the refund targets Bank Ac- count 2-letter country code
79
+ * ISO 3166-1
80
+ * @var string
81
+ */
82
+ protected $payout_bank_country;
83
+
84
+ /**
85
+ * Refund targets Bank Name
86
+ * @var string
87
+ */
88
+ protected $payout_bank_name;
89
+
90
+ /**
91
+ * SWIFT/BIC Code
92
+ * @var string
93
+ */
94
+ protected $payout_swift;
95
+
96
+ /**
97
+ * Account number or IBAN
98
+ * @var string
99
+ */
100
+ protected $payout_acc_number;
101
+
102
+ /**
103
+ * Bank address
104
+ * @var string
105
+ */
106
+ protected $payout_bank_address;
107
+
108
+ /**
109
+ * Bank account owner name
110
+ * @var string
111
+ */
112
+ protected $payout_owner_name;
113
+
114
+ /**
115
+ * Bank account owner address
116
+ * @var string
117
+ */
118
+ protected $payout_owner_address;
119
+
120
+ /**
121
+ * INPay constructor
122
+ */
123
+ public function __construct()
124
+ {
125
+ parent::__construct();
126
+
127
+ $this->setIsPayout(false);
128
+ }
129
+
130
+ /**
131
+ * Returns the Request transaction type
132
+ * @return string
133
+ */
134
+ protected function getTransactionType()
135
+ {
136
+ return \Genesis\API\Constants\Transaction\Types::INPAY;
137
+ }
138
+
139
+ /**
140
+ * Set Flag for payout transaction
141
+ * @param bool|int|string $value
142
+ * @return $this
143
+ */
144
+ public function setIsPayout($value)
145
+ {
146
+ $this->is_payout = filter_var($value, FILTER_VALIDATE_BOOLEAN);
147
+
148
+ return $this;
149
+ }
150
+
151
+ /**
152
+ * Set the required fields
153
+ *
154
+ * @return void
155
+ */
156
+ protected function setRequiredFields()
157
+ {
158
+ $requiredFields = [
159
+ 'transaction_id',
160
+ 'remote_ip',
161
+ 'amount',
162
+ 'currency',
163
+ 'return_success_url',
164
+ 'return_failure_url',
165
+ 'customer_email',
166
+ 'billing_country'
167
+ ];
168
+
169
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
170
+
171
+ $requiredFieldValues = [
172
+ 'billing_country' => \Genesis\Utils\Country::getList(),
173
+ 'currency' => \Genesis\Utils\Currency::getList()
174
+ ];
175
+
176
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
177
+
178
+ $requiredFieldsConditional = [
179
+ 'is_payout' => [
180
+ false => [
181
+ 'customer_bank_id',
182
+ 'order_description'
183
+ ],
184
+ true => [
185
+ 'payout_order_id',
186
+ 'payout_bank_country',
187
+ 'payout_bank_name',
188
+ 'payout_swift',
189
+ 'payout_acc_number',
190
+ 'payout_bank_address',
191
+ 'payout_owner_name',
192
+ 'payout_owner_address'
193
+ ]
194
+ ]
195
+ ];
196
+
197
+ $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
198
+ }
199
+
200
+ /**
201
+ * Return additional request attributes
202
+ * @return array
203
+ */
204
+ protected function getPaymentTransactionStructure()
205
+ {
206
+ return [
207
+ 'return_success_url' => $this->return_success_url,
208
+ 'return_failure_url' => $this->return_failure_url,
209
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
210
+ 'currency' => $this->currency,
211
+ 'is_payout' => var_export($this->is_payout, true),
212
+ 'customer_bank_id' => $this->customer_bank_id,
213
+ 'order_description' => $this->order_description,
214
+ 'payout_order_id' => $this->payout_order_id,
215
+ 'payout_bank_country' => $this->payout_bank_country,
216
+ 'payout_bank_name' => $this->payout_bank_name,
217
+ 'payout_swift' => $this->payout_swift,
218
+ 'payout_acc_number' => $this->payout_acc_number,
219
+ 'payout_bank_address' => $this->payout_bank_address,
220
+ 'payout_owner_name' => $this->payout_owner_name,
221
+ 'payout_owner_address' => $this->payout_owner_address,
222
+ 'customer_email' => $this->customer_email,
223
+ 'customer_phone' => $this->customer_phone,
224
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
225
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
226
+ ];
227
+ }
228
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/P24.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\Alternatives;
25
+
26
+ /**
27
+ * Class P24
28
+ *
29
+ * Alternative payment method
30
+ *
31
+ * @package Genesis\API\Request\Financial\Alternatives
32
+ */
33
+ class P24 extends \Genesis\API\Request\Base\Financial\Alternative
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::P24;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFieldValues = [
54
+ 'billing_country' => [
55
+ 'AD', 'AT', 'BE', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'EL', 'ES', 'NL',
56
+ 'IE', 'IS', 'LT', 'LV', 'LU', 'MT', 'DE', 'NO', 'PL', 'PT', 'SM', 'SK',
57
+ 'SI', 'CH', 'SE', 'HU', 'GB', 'IT', 'US', 'CA', 'JP', 'UA', 'BY', 'RU'
58
+ ],
59
+ 'currency' => \Genesis\Utils\Currency::getList()
60
+ ];
61
+
62
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
63
+ }
64
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/POLi.php CHANGED
@@ -20,6 +20,7 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
25
  /**
@@ -29,276 +30,15 @@ namespace Genesis\API\Request\Financial\Alternatives;
29
  *
30
  * @package Genesis\API\Request\Financial\Wallets
31
  */
32
- class POLi extends \Genesis\API\Request
33
  {
34
  /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
  */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
-
97
- /**
98
- *Customer's Billing Address: First name
99
- *
100
- * @var string
101
- */
102
- protected $billing_first_name;
103
-
104
- /**
105
- * Customer's Billing Address: Last name
106
- *
107
- * @var string
108
- */
109
- protected $billing_last_name;
110
-
111
- /**
112
- * Customer's Billing Address: Part 1
113
- *
114
- * @var string
115
- */
116
- protected $billing_address1;
117
-
118
- /**
119
- * Customer's Billing Address: Part 2
120
- * @var string
121
- */
122
- protected $billing_address2;
123
-
124
- /**
125
- * Customer's Billing Address: ZIP
126
- *
127
- * @var string
128
- */
129
- protected $billing_zip_code;
130
-
131
- /**
132
- * Customer's Billing Address: City
133
- *
134
- * @var string
135
- */
136
- protected $billing_city;
137
-
138
- /**
139
- * Customer's Billing Address: State
140
- *
141
- * format: ISO-3166-2
142
- *
143
- * @var string
144
- */
145
- protected $billing_state;
146
-
147
- /**
148
- * Customer's Billing Address: Country
149
- *
150
- * format: ISO-3166
151
- *
152
- * @var string
153
- */
154
- protected $billing_country;
155
-
156
- /**
157
- * Customer's Shipping Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $shipping_first_name;
162
-
163
- /**
164
- * Customer's Shipping Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $shipping_last_name;
169
-
170
- /**
171
- * Customer's Shipping Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $shipping_address1;
176
-
177
- /**
178
- * Customer's Shipping Address: Part 2
179
- *
180
- * @var string
181
- */
182
- protected $shipping_address2;
183
-
184
- /**
185
- * Customer's Shipping Address: ZIP
186
- *
187
- * @var string
188
- */
189
- protected $shipping_zip_code;
190
-
191
- /**
192
- * Customer's Shipping Address: City
193
- *
194
- * @var string
195
- */
196
- protected $shipping_city;
197
-
198
- /**
199
- * Customer's Shipping Address: State
200
- *
201
- * format: ISO-3166-2
202
- *
203
- * @var string
204
- */
205
- protected $shipping_state;
206
-
207
- /**
208
- * Customer's Shipping Address
209
- *
210
- * format: ISO-3166
211
- *
212
- * @var string
213
- */
214
- protected $shipping_country;
215
-
216
- /**
217
- * Social Security number or equivalent value for non US customers.
218
- *
219
- * @var string
220
- */
221
- protected $risk_ssn;
222
-
223
- /**
224
- * Customer's MAC address
225
- *
226
- * @var string
227
- */
228
- protected $risk_mac_address;
229
-
230
- /**
231
- * Customer's Session Id
232
- *
233
- * @var string
234
- */
235
- protected $risk_session_id;
236
-
237
- /**
238
- * Customer's User Id
239
- *
240
- * @var string
241
- */
242
- protected $risk_user_id;
243
-
244
- /**
245
- * Customer's User Level
246
- *
247
- * @var string
248
- */
249
- protected $risk_user_level;
250
-
251
- /**
252
- * Customer's Email address
253
- *
254
- * @note Set here if different from
255
- * shipping / billing
256
- *
257
- * @var string
258
- */
259
- protected $risk_email;
260
-
261
- /**
262
- * Customer's Phone number
263
- *
264
- * @note Set here if different from
265
- * shipping / billing
266
- *
267
- * @var string
268
- */
269
- protected $risk_phone;
270
-
271
- /**
272
- * Customer's IP address
273
- *
274
- * @note Set here if different from remote_ip
275
- *
276
- * @var string
277
- */
278
- protected $risk_remote_ip;
279
-
280
- /**
281
- * Customer's Serial Number
282
- *
283
- * @var string
284
- */
285
- protected $risk_serial_number;
286
-
287
- /**
288
- * Set the per-request configuration
289
- *
290
- * @return void
291
- */
292
- protected function initConfiguration()
293
  {
294
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
295
- 'protocol' => 'https',
296
- 'port' => 443,
297
- 'type' => 'POST',
298
- 'format' => 'xml',
299
- ));
300
-
301
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
302
  }
303
 
304
  /**
@@ -308,78 +48,13 @@ class POLi extends \Genesis\API\Request
308
  */
309
  protected function setRequiredFields()
310
  {
311
- $requiredFields = array(
312
- 'transaction_id',
313
- 'remote_ip',
314
- 'amount',
315
- 'currency',
316
- 'return_success_url',
317
- 'return_failure_url',
318
- 'customer_email',
319
- );
320
 
321
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
322
- }
323
-
324
- /**
325
- * Create the request's Tree structure
326
- *
327
- * @return void
328
- */
329
- protected function populateStructure()
330
- {
331
- $treeStructure = array(
332
- 'payment_transaction' => array(
333
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::POLI,
334
- 'transaction_id' => $this->transaction_id,
335
- 'usage' => $this->usage,
336
- 'remote_ip' => $this->remote_ip,
337
- 'return_success_url' => $this->return_success_url,
338
- 'return_failure_url' => $this->return_failure_url,
339
- 'amount' => $this->transform(
340
- 'amount',
341
- array(
342
- $this->amount,
343
- $this->currency,
344
- )
345
- ),
346
- 'currency' => $this->currency,
347
- 'customer_email' => $this->customer_email,
348
- 'customer_phone' => $this->customer_phone,
349
- 'billing_address' => array(
350
- 'first_name' => $this->billing_first_name,
351
- 'last_name' => $this->billing_last_name,
352
- 'address1' => $this->billing_address1,
353
- 'address2' => $this->billing_address2,
354
- 'zip_code' => $this->billing_zip_code,
355
- 'city' => $this->billing_city,
356
- 'state' => $this->billing_state,
357
- 'country' => $this->billing_country,
358
- ),
359
- 'shipping_address' => array(
360
- 'first_name' => $this->shipping_first_name,
361
- 'last_name' => $this->shipping_last_name,
362
- 'address1' => $this->shipping_address1,
363
- 'address2' => $this->shipping_address2,
364
- 'zip_code' => $this->shipping_zip_code,
365
- 'city' => $this->shipping_city,
366
- 'state' => $this->shipping_state,
367
- 'country' => $this->shipping_country,
368
- ),
369
- 'risk_params' => array(
370
- 'ssn' => $this->risk_ssn,
371
- 'mac_address' => $this->risk_mac_address,
372
- 'session_id' => $this->risk_session_id,
373
- 'user_id' => $this->risk_user_id,
374
- 'user_level' => $this->risk_user_level,
375
- 'email' => $this->risk_email,
376
- 'phone' => $this->risk_phone,
377
- 'remote_ip' => $this->risk_remote_ip,
378
- 'serial_number' => $this->risk_serial_number,
379
- ),
380
- )
381
- );
382
 
383
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
384
  }
385
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
  /**
30
  *
31
  * @package Genesis\API\Request\Financial\Wallets
32
  */
33
+ class POLi extends \Genesis\API\Request\Base\Financial\Alternative
34
  {
35
  /**
36
+ * Returns the Request transaction type
37
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  {
41
+ return \Genesis\API\Constants\Transaction\Types::POLI;
 
 
 
 
 
 
 
42
  }
43
 
44
  /**
48
  */
49
  protected function setRequiredFields()
50
  {
51
+ parent::setRequiredFields();
 
 
 
 
 
 
 
 
52
 
53
+ $requiredFieldValues = [
54
+ 'billing_country' => ['AU', 'NZ'],
55
+ 'currency' => ['AUD', 'NZD']
56
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
59
  }
60
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PPRO.php CHANGED
@@ -20,23 +20,32 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
 
 
 
 
 
 
25
  /**
26
  * Class PPRO
27
  *
28
  * Alternative payment method
29
  *
30
  * @package Genesis\API\Request\Financial\Alternatives
 
 
 
 
 
 
 
31
  */
32
- class PPRO extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by merchant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
 
41
  /**
42
  * Used payment method
@@ -45,62 +54,6 @@ class PPRO extends \Genesis\API\Request
45
  */
46
  protected $payment_type;
47
 
48
- /**
49
- * Description of the transaction for later use
50
- *
51
- * @var string
52
- */
53
- protected $usage;
54
-
55
- /**
56
- * IPv4 address of customer
57
- *
58
- * @var string
59
- */
60
- protected $remote_ip;
61
-
62
- /**
63
- * Amount of transaction in minor currency unit
64
- *
65
- * @var int
66
- */
67
- protected $amount;
68
-
69
- /**
70
- * Currency code in ISO-4217
71
- *
72
- * @var string
73
- */
74
- protected $currency;
75
-
76
- /**
77
- * URL where customer is sent to after successful payment
78
- *
79
- * @var string
80
- */
81
- protected $return_success_url;
82
-
83
- /**
84
- * URL where customer is sent to after un-successful payment
85
- *
86
- * @var string
87
- */
88
- protected $return_failure_url;
89
-
90
- /**
91
- * Email address of the Customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_email;
96
-
97
- /**
98
- * Phone number of the customer
99
- *
100
- * @var string
101
- */
102
- protected $customer_phone;
103
-
104
  /**
105
  * Must contain valid account number, check:
106
  *
@@ -157,212 +110,12 @@ class PPRO extends \Genesis\API\Request
157
  protected $account_phone;
158
 
159
  /**
160
- *Customer's Billing Address: First name
161
- *
162
- * @var string
163
- */
164
- protected $billing_first_name;
165
-
166
- /**
167
- * Customer's Billing Address: Last name
168
- *
169
- * @var string
170
- */
171
- protected $billing_last_name;
172
-
173
- /**
174
- * Customer's Billing Address: Part 1
175
- *
176
- * @var string
177
- */
178
- protected $billing_address1;
179
-
180
- /**
181
- * Customer's Billing Address: Part 2
182
- * @var string
183
- */
184
- protected $billing_address2;
185
-
186
- /**
187
- * Customer's Billing Address: ZIP
188
- *
189
- * @var string
190
- */
191
- protected $billing_zip_code;
192
-
193
- /**
194
- * Customer's Billing Address: City
195
- *
196
- * @var string
197
- */
198
- protected $billing_city;
199
-
200
- /**
201
- * Customer's Billing Address: State
202
- *
203
- * format: ISO-3166-2
204
- *
205
- * @var string
206
- */
207
- protected $billing_state;
208
-
209
- /**
210
- * Customer's Billing Address: Country
211
- *
212
- * format: ISO-3166
213
- *
214
- * @var string
215
- */
216
- protected $billing_country;
217
-
218
- /**
219
- * Customer's Shipping Address: First name
220
- *
221
- * @var string
222
- */
223
- protected $shipping_first_name;
224
-
225
- /**
226
- * Customer's Shipping Address: Last name
227
- *
228
- * @var string
229
- */
230
- protected $shipping_last_name;
231
-
232
- /**
233
- * Customer's Shipping Address: Part 1
234
- *
235
- * @var string
236
- */
237
- protected $shipping_address1;
238
-
239
- /**
240
- * Customer's Shipping Address: Part 2
241
- *
242
- * @var string
243
- */
244
- protected $shipping_address2;
245
-
246
- /**
247
- * Customer's Shipping Address: ZIP
248
- *
249
- * @var string
250
- */
251
- protected $shipping_zip_code;
252
-
253
- /**
254
- * Customer's Shipping Address: City
255
- *
256
- * @var string
257
  */
258
- protected $shipping_city;
259
-
260
- /**
261
- * Customer's Shipping Address: State
262
- *
263
- * format: ISO-3166-2
264
- *
265
- * @var string
266
- */
267
- protected $shipping_state;
268
-
269
- /**
270
- * Customer's Shipping Address
271
- *
272
- * format: ISO-3166
273
- *
274
- * @var string
275
- */
276
- protected $shipping_country;
277
-
278
- /**
279
- * Social Security number or equivalent value for non US customers.
280
- *
281
- * @var string
282
- */
283
- protected $risk_ssn;
284
-
285
- /**
286
- * Customer's MAC address
287
- *
288
- * @var string
289
- */
290
- protected $risk_mac_address;
291
-
292
- /**
293
- * Customer's Session Id
294
- *
295
- * @var string
296
- */
297
- protected $risk_session_id;
298
-
299
- /**
300
- * Customer's User Id
301
- *
302
- * @var string
303
- */
304
- protected $risk_user_id;
305
-
306
- /**
307
- * Customer's User Level
308
- *
309
- * @var string
310
- */
311
- protected $risk_user_level;
312
-
313
- /**
314
- * Customer's Email address
315
- *
316
- * @note Set here if different from
317
- * shipping / billing
318
- *
319
- * @var string
320
- */
321
- protected $risk_email;
322
-
323
- /**
324
- * Customer's Phone number
325
- *
326
- * @note Set here if different from
327
- * shipping / billing
328
- *
329
- * @var string
330
- */
331
- protected $risk_phone;
332
-
333
- /**
334
- * Customer's IP address
335
- *
336
- * @note Set here if different from remote_ip
337
- *
338
- * @var string
339
- */
340
- protected $risk_remote_ip;
341
-
342
- /**
343
- * Customer's Serial Number
344
- *
345
- * @var string
346
- */
347
- protected $risk_serial_number;
348
-
349
- /**
350
- * Set the per-request configuration
351
- *
352
- * @return void
353
- */
354
- protected function initConfiguration()
355
  {
356
- $this->config = \Genesis\Utils\Common::createArrayObject(
357
- array(
358
- 'protocol' => 'https',
359
- 'port' => 443,
360
- 'type' => 'POST',
361
- 'format' => 'xml',
362
- )
363
- );
364
-
365
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
366
  }
367
 
368
  /**
@@ -372,7 +125,7 @@ class PPRO extends \Genesis\API\Request
372
  */
373
  protected function setRequiredFields()
374
  {
375
- $requiredFields = array(
376
  'transaction_id',
377
  'payment_type',
378
  'remote_ip',
@@ -382,76 +135,180 @@ class PPRO extends \Genesis\API\Request
382
  'return_failure_url',
383
  'customer_email',
384
  'billing_country'
385
- );
386
-
387
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  }
389
 
390
  /**
391
- * Create the request's Tree structure
392
  *
393
  * @return void
 
 
394
  */
395
- protected function populateStructure()
396
  {
397
- $treeStructure = array(
398
- 'payment_transaction' => array(
399
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::PPRO,
400
- 'transaction_id' => $this->transaction_id,
401
- 'payment_type' => $this->payment_type,
402
- 'usage' => $this->usage,
403
- 'remote_ip' => $this->remote_ip,
404
- 'amount' => $this->transform(
405
- 'amount',
406
- array(
407
- $this->amount,
408
- $this->currency,
409
- )
410
- ),
411
- 'currency' => $this->currency,
412
- 'return_success_url' => $this->return_success_url,
413
- 'return_failure_url' => $this->return_failure_url,
414
- 'customer_email' => $this->customer_email,
415
- 'customer_phone' => $this->customer_phone,
416
- 'account_number' => $this->account_number,
417
- 'bank_code' => $this->bank_code,
418
- 'bic' => $this->bic,
419
- 'iban' => $this->iban,
420
- 'account_phone' => $this->account_phone,
421
- 'billing_address' => array(
422
- 'first_name' => $this->billing_first_name,
423
- 'last_name' => $this->billing_last_name,
424
- 'address1' => $this->billing_address1,
425
- 'address2' => $this->billing_address2,
426
- 'zip_code' => $this->billing_zip_code,
427
- 'city' => $this->billing_city,
428
- 'state' => $this->billing_state,
429
- 'country' => $this->billing_country,
430
- ),
431
- 'shipping_address' => array(
432
- 'first_name' => $this->shipping_first_name,
433
- 'last_name' => $this->shipping_last_name,
434
- 'address1' => $this->shipping_address1,
435
- 'address2' => $this->shipping_address2,
436
- 'zip_code' => $this->shipping_zip_code,
437
- 'city' => $this->shipping_city,
438
- 'state' => $this->shipping_state,
439
- 'country' => $this->shipping_country,
440
- ),
441
- 'risk_params' => array(
442
- 'ssn' => $this->risk_ssn,
443
- 'mac_address' => $this->risk_mac_address,
444
- 'session_id' => $this->risk_session_id,
445
- 'user_id' => $this->risk_user_id,
446
- 'user_level' => $this->risk_user_level,
447
- 'email' => $this->risk_email,
448
- 'phone' => $this->risk_phone,
449
- 'remote_ip' => $this->risk_remote_ip,
450
- 'serial_number' => $this->risk_serial_number,
451
- ),
452
- )
453
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  }
457
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+ use Genesis\API\Constants\Payment\Methods as PaymentMethods;
30
+ use Genesis\Utils\Common as CommonUtils;
31
+
32
  /**
33
  * Class PPRO
34
  *
35
  * Alternative payment method
36
  *
37
  * @package Genesis\API\Request\Financial\Alternatives
38
+ *
39
+ * @method PPRO setPaymentType($value) Set used payment type
40
+ * @method PPRO setAccountNumber($value) Set valid account number
41
+ * @method PPRO setBankCode($value) Set a valid bank code
42
+ * @method PPRO setBic($value) Set a valid BIC
43
+ * @method PPRO setIban($value) Set a valid IBAN bank account
44
+ * @method PPRO setAccountPhone($value) Set phone number for destination account to pay out
45
  */
46
+ class PPRO extends \Genesis\API\Request\Base\Financial
47
  {
48
+ use PaymentAttributes, AsyncAttributes, AddressInfoAttributes;
 
 
 
 
 
49
 
50
  /**
51
  * Used payment method
54
  */
55
  protected $payment_type;
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * Must contain valid account number, check:
59
  *
110
  protected $account_phone;
111
 
112
  /**
113
+ * Returns the Request transaction type
114
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  */
116
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  {
118
+ return \Genesis\API\Constants\Transaction\Types::PPRO;
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
  /**
125
  */
126
  protected function setRequiredFields()
127
  {
128
+ $requiredFields = [
129
  'transaction_id',
130
  'payment_type',
131
  'remote_ip',
135
  'return_failure_url',
136
  'customer_email',
137
  'billing_country'
138
+ ];
139
+
140
+ $this->requiredFields = CommonUtils::createArrayObject($requiredFields);
141
+
142
+ $requiredFieldValues = [
143
+ 'payment_type' => PaymentMethods::getMethods(),
144
+ 'billing_country' => \Genesis\Utils\Country::getList(),
145
+ 'currency' => \Genesis\Utils\Currency::getList()
146
+ ];
147
+
148
+ $this->requiredFieldValues = CommonUtils::createArrayObject($requiredFieldValues);
149
+
150
+ $requiredFieldsConditional = [
151
+ 'payment_type' => [
152
+ PaymentMethods::GIRO_PAY => [
153
+ 'bic',
154
+ 'iban'
155
+ ],
156
+ PaymentMethods::PRZELEWY24 => [
157
+ 'customer_email'
158
+ ],
159
+ PaymentMethods::QIWI => [
160
+ 'account_phone'
161
+ ]
162
+ ]
163
+ ];
164
+
165
+ $this->requiredFieldsConditional = CommonUtils::createArrayObject($requiredFieldsConditional);
166
+
167
+ $this->setRequiredFieldValuesConditional();
168
  }
169
 
170
  /**
171
+ * Set the required fields - conditionally depending on other fields
172
  *
173
  * @return void
174
+ *
175
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
176
  */
177
+ protected function setRequiredFieldValuesConditional()
178
  {
179
+ $requiredFieldValuesConditional = [
180
+ 'payment_type' => [
181
+ PaymentMethods::EPS => [
182
+ [
183
+ 'billing_country' => 'AT',
184
+ 'currency' => 'EUR'
185
+ ]
186
+ ],
187
+ PaymentMethods::TELEINGRESO => [
188
+ [
189
+ 'billing_country' => 'ES',
190
+ 'currency' => 'EUR'
191
+ ]
192
+ ],
193
+ PaymentMethods::SAFETY_PAY => [
194
+ [
195
+ 'billing_country' => ['AT', 'DE', 'CA', 'MX', 'NI', 'CR', 'PA', 'CO', 'PE', 'BR', 'NL'],
196
+ 'currency' => ['EUR', 'USD']
197
+ ]
198
+ ],
199
+ PaymentMethods::TRUST_PAY => [
200
+ [
201
+ 'billing_country' => 'BA',
202
+ 'currency' => 'BAM'
203
+ ],
204
+ [
205
+ 'billing_country' => 'BG',
206
+ 'currency' => 'BGN'
207
+ ],
208
+ [
209
+ 'billing_country' => 'CZ',
210
+ 'currency' => 'CZK'
211
+ ],
212
+ [
213
+ 'billing_country' => 'EE',
214
+ 'currency' => 'EEK'
215
+ ],
216
+ [
217
+ 'billing_country' => ['EE', 'SL', 'SK'],
218
+ 'currency' => 'EUR'
219
+ ],
220
+ [
221
+ 'billing_country' => 'GB',
222
+ 'currency' => 'GBP'
223
+ ],
224
+ [
225
+ 'billing_country' => 'HR',
226
+ 'currency' => 'HRK'
227
+ ],
228
+ [
229
+ 'billing_country' => 'HU',
230
+ 'currency' => 'HUF'
231
+ ],
232
+ [
233
+ 'billing_country' => 'LT',
234
+ 'currency' => 'LTL'
235
+ ],
236
+ [
237
+ 'billing_country' => 'LV',
238
+ 'currency' => 'LVL'
239
+ ],
240
+ [
241
+ 'billing_country' => 'PL',
242
+ 'currency' => 'PLN'
243
+ ],
244
+ [
245
+ 'billing_country' => 'RO',
246
+ 'currency' => 'RON'
247
+ ]
248
+ ],
249
+ PaymentMethods::PRZELEWY24 => [
250
+ [
251
+ 'billing_country' => 'PL',
252
+ 'currency' => 'PLN'
253
+ ]
254
+ ],
255
+ PaymentMethods::IDEAL => [
256
+ [
257
+ 'billing_country' => 'NL',
258
+ 'currency' => 'EUR'
259
+ ]
260
+ ],
261
+ PaymentMethods::QIWI => [
262
+ [
263
+ 'billing_country' => 'RU',
264
+ 'currency' => ['EUR', 'RUB']
265
+ ]
266
+ ],
267
+ PaymentMethods::GIRO_PAY => [
268
+ [
269
+ 'billing_country' => 'DE',
270
+ 'currency' => 'EUR'
271
+ ]
272
+ ],
273
+ PaymentMethods::BCMC => [
274
+ [
275
+ 'billing_country' => 'BE',
276
+ 'currency' => 'EUR'
277
+ ]
278
+ ],
279
+ PaymentMethods::MYBANK => [
280
+ [
281
+ 'billing_country' => ['BE', 'FR', 'IT', 'LU'],
282
+ 'currency' => 'EUR'
283
+ ]
284
+ ]
285
+ ]
286
+ ];
287
+
288
+ $this->requiredFieldValuesConditional = CommonUtils::createArrayObject($requiredFieldValuesConditional);
289
+ }
290
 
291
+ /**
292
+ * Return additional request attributes
293
+ * @return array
294
+ */
295
+ protected function getPaymentTransactionStructure()
296
+ {
297
+ return [
298
+ 'payment_type' => $this->payment_type,
299
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
300
+ 'currency' => $this->currency,
301
+ 'return_success_url' => $this->return_success_url,
302
+ 'return_failure_url' => $this->return_failure_url,
303
+ 'customer_email' => $this->customer_email,
304
+ 'customer_phone' => $this->customer_phone,
305
+ 'account_number' => $this->account_number,
306
+ 'bank_code' => $this->bank_code,
307
+ 'bic' => $this->bic,
308
+ 'iban' => $this->iban,
309
+ 'account_phone' => $this->account_phone,
310
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
311
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
312
+ ];
313
  }
314
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/PaypalExpress.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\Alternatives;
25
+
26
+ /**
27
+ * Class PaypalExpress
28
+ *
29
+ * Alternative payment method
30
+ *
31
+ * @package Genesis\API\Request\Financial\Alternatives
32
+ */
33
+ class PaypalExpress extends \Genesis\API\Request\Base\Financial\Alternative
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::PAYPAL_EXPRESS;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFields = [
54
+ 'transaction_id',
55
+ 'amount',
56
+ 'currency',
57
+ 'return_success_url',
58
+ 'return_failure_url',
59
+ 'billing_country'
60
+ ];
61
+
62
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
63
+ }
64
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Paysafecard.php CHANGED
@@ -20,6 +20,7 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
25
  /**
@@ -29,278 +30,15 @@ namespace Genesis\API\Request\Financial\Alternatives;
29
  *
30
  * @package Genesis\API\Request\Financial\Alternatives
31
  */
32
- class Paysafecard extends \Genesis\API\Request
33
  {
34
  /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
-
97
- /**
98
- *Customer's Billing Address: First name
99
- *
100
- * @var string
101
- */
102
- protected $billing_first_name;
103
-
104
- /**
105
- * Customer's Billing Address: Last name
106
- *
107
- * @var string
108
- */
109
- protected $billing_last_name;
110
-
111
- /**
112
- * Customer's Billing Address: Part 1
113
- *
114
- * @var string
115
- */
116
- protected $billing_address1;
117
-
118
- /**
119
- * Customer's Billing Address: Part 2
120
- * @var string
121
  */
122
- protected $billing_address2;
123
-
124
- /**
125
- * Customer's Billing Address: ZIP
126
- *
127
- * @var string
128
- */
129
- protected $billing_zip_code;
130
-
131
- /**
132
- * Customer's Billing Address: City
133
- *
134
- * @var string
135
- */
136
- protected $billing_city;
137
-
138
- /**
139
- * Customer's Billing Address: State
140
- *
141
- * format: ISO-3166-2
142
- *
143
- * @var string
144
- */
145
- protected $billing_state;
146
-
147
- /**
148
- * Customer's Billing Address: Country
149
- *
150
- * format: ISO-3166
151
- *
152
- * @var string
153
- */
154
- protected $billing_country;
155
-
156
- /**
157
- * Customer's Shipping Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $shipping_first_name;
162
-
163
- /**
164
- * Customer's Shipping Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $shipping_last_name;
169
-
170
- /**
171
- * Customer's Shipping Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $shipping_address1;
176
-
177
- /**
178
- * Customer's Shipping Address: Part 2
179
- *
180
- * @var string
181
- */
182
- protected $shipping_address2;
183
-
184
- /**
185
- * Customer's Shipping Address: ZIP
186
- *
187
- * @var string
188
- */
189
- protected $shipping_zip_code;
190
-
191
- /**
192
- * Customer's Shipping Address: City
193
- *
194
- * @var string
195
- */
196
- protected $shipping_city;
197
-
198
- /**
199
- * Customer's Shipping Address: State
200
- *
201
- * format: ISO-3166-2
202
- *
203
- * @var string
204
- */
205
- protected $shipping_state;
206
-
207
- /**
208
- * Customer's Shipping Address
209
- *
210
- * format: ISO-3166
211
- *
212
- * @var string
213
- */
214
- protected $shipping_country;
215
-
216
- /**
217
- * Social Security number or equivalent value for non US customers.
218
- *
219
- * @var string
220
- */
221
- protected $risk_ssn;
222
-
223
- /**
224
- * Customer's MAC address
225
- *
226
- * @var string
227
- */
228
- protected $risk_mac_address;
229
-
230
- /**
231
- * Customer's Session Id
232
- *
233
- * @var string
234
- */
235
- protected $risk_session_id;
236
-
237
- /**
238
- * Customer's User Id
239
- *
240
- * @var string
241
- */
242
- protected $risk_user_id;
243
-
244
- /**
245
- * Customer's User Level
246
- *
247
- * @var string
248
- */
249
- protected $risk_user_level;
250
-
251
- /**
252
- * Customer's Email address
253
- *
254
- * @note Set here if different from
255
- * shipping / billing
256
- *
257
- * @var string
258
- */
259
- protected $risk_email;
260
-
261
- /**
262
- * Customer's Phone number
263
- *
264
- * @note Set here if different from
265
- * shipping / billing
266
- *
267
- * @var string
268
- */
269
- protected $risk_phone;
270
-
271
- /**
272
- * Customer's IP address
273
- *
274
- * @note Set here if different from remote_ip
275
- *
276
- * @var string
277
- */
278
- protected $risk_remote_ip;
279
-
280
- /**
281
- * Customer's Serial Number
282
- *
283
- * @var string
284
- */
285
- protected $risk_serial_number;
286
-
287
- /**
288
- * Set the per-request configuration
289
- *
290
- * @return void
291
- */
292
- protected function initConfiguration()
293
  {
294
- $this->config = \Genesis\Utils\Common::createArrayObject(
295
- array(
296
- 'protocol' => 'https',
297
- 'port' => 443,
298
- 'type' => 'POST',
299
- 'format' => 'xml',
300
- )
301
- );
302
-
303
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
304
  }
305
 
306
  /**
@@ -310,78 +48,17 @@ class Paysafecard extends \Genesis\API\Request
310
  */
311
  protected function setRequiredFields()
312
  {
313
- $requiredFields = array(
314
- 'transaction_id',
315
- 'remote_ip',
316
- 'amount',
317
- 'currency',
318
- 'return_success_url',
319
- 'return_failure_url',
320
- 'customer_email',
321
- );
322
-
323
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
324
- }
325
-
326
- /**
327
- * Create the request's Tree structure
328
- *
329
- * @return void
330
- */
331
- protected function populateStructure()
332
- {
333
- $treeStructure = array(
334
- 'payment_transaction' => array(
335
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYSAFECARD,
336
- 'transaction_id' => $this->transaction_id,
337
- 'usage' => $this->usage,
338
- 'remote_ip' => $this->remote_ip,
339
- 'return_success_url' => $this->return_success_url,
340
- 'return_failure_url' => $this->return_failure_url,
341
- 'amount' => $this->transform(
342
- 'amount',
343
- array(
344
- $this->amount,
345
- $this->currency,
346
- )
347
- ),
348
- 'currency' => $this->currency,
349
- 'customer_email' => $this->customer_email,
350
- 'customer_phone' => $this->customer_phone,
351
- 'billing_address' => array(
352
- 'first_name' => $this->billing_first_name,
353
- 'last_name' => $this->billing_last_name,
354
- 'address1' => $this->billing_address1,
355
- 'address2' => $this->billing_address2,
356
- 'zip_code' => $this->billing_zip_code,
357
- 'city' => $this->billing_city,
358
- 'state' => $this->billing_state,
359
- 'country' => $this->billing_country,
360
- ),
361
- 'shipping_address' => array(
362
- 'first_name' => $this->shipping_first_name,
363
- 'last_name' => $this->shipping_last_name,
364
- 'address1' => $this->shipping_address1,
365
- 'address2' => $this->shipping_address2,
366
- 'zip_code' => $this->shipping_zip_code,
367
- 'city' => $this->shipping_city,
368
- 'state' => $this->shipping_state,
369
- 'country' => $this->shipping_country,
370
- ),
371
- 'risk_params' => array(
372
- 'ssn' => $this->risk_ssn,
373
- 'mac_address' => $this->risk_mac_address,
374
- 'session_id' => $this->risk_session_id,
375
- 'user_id' => $this->risk_user_id,
376
- 'user_level' => $this->risk_user_level,
377
- 'email' => $this->risk_email,
378
- 'phone' => $this->risk_phone,
379
- 'remote_ip' => $this->risk_remote_ip,
380
- 'serial_number' => $this->risk_serial_number,
381
- ),
382
- )
383
- );
384
-
385
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
386
  }
387
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
  /**
30
  *
31
  * @package Genesis\API\Request\Financial\Alternatives
32
  */
33
+ class Paysafecard extends \Genesis\API\Request\Base\Financial\Alternative
34
  {
35
  /**
36
+ * Returns the Request transaction type
37
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  {
41
+ return \Genesis\API\Constants\Transaction\Types::PAYSAFECARD;
 
 
 
 
 
 
 
 
 
42
  }
43
 
44
  /**
48
  */
49
  protected function setRequiredFields()
50
  {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFieldValues = [
54
+ 'billing_country' => [
55
+ 'AT', 'BE', 'CY', 'CZ', 'DK', 'FI', 'FR', 'DE', 'GR', 'IE',
56
+ 'IT', 'LU', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES',
57
+ 'SE', 'CH', 'UK', 'HU', 'HR', 'MT', 'US', 'CA', 'MX', 'TR'
58
+ ],
59
+ 'currency' => \Genesis\Utils\Currency::getList()
60
+ ];
61
+
62
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Sofort.php CHANGED
@@ -20,79 +20,26 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Alternatives;
24
 
 
 
 
 
25
  /**
26
  * Class Sofort
27
  *
28
  * Alternative payment method
29
  *
30
  * @package Genesis\API\Request\Financial\Alternatives
 
 
 
31
  */
32
- class Sofort extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
 
97
  /**
98
  * The bank id of the bank where the customer resides
@@ -100,7 +47,6 @@ class Sofort extends \Genesis\API\Request
100
  * @var string
101
  */
102
  protected $customer_bank_id;
103
-
104
  /**
105
  * Bank identification number of the customer
106
  *
@@ -109,212 +55,12 @@ class Sofort extends \Genesis\API\Request
109
  protected $bank_account_number;
110
 
111
  /**
112
- *Customer's Billing Address: First name
113
- *
114
- * @var string
115
- */
116
- protected $billing_first_name;
117
-
118
- /**
119
- * Customer's Billing Address: Last name
120
- *
121
- * @var string
122
- */
123
- protected $billing_last_name;
124
-
125
- /**
126
- * Customer's Billing Address: Part 1
127
- *
128
- * @var string
129
- */
130
- protected $billing_address1;
131
-
132
- /**
133
- * Customer's Billing Address: Part 2
134
- * @var string
135
- */
136
- protected $billing_address2;
137
-
138
- /**
139
- * Customer's Billing Address: ZIP
140
- *
141
- * @var string
142
- */
143
- protected $billing_zip_code;
144
-
145
- /**
146
- * Customer's Billing Address: City
147
- *
148
- * @var string
149
- */
150
- protected $billing_city;
151
-
152
- /**
153
- * Customer's Billing Address: State
154
- *
155
- * format: ISO-3166-2
156
- *
157
- * @var string
158
- */
159
- protected $billing_state;
160
-
161
- /**
162
- * Customer's Billing Address: Country
163
- *
164
- * format: ISO-3166
165
- *
166
- * @var string
167
- */
168
- protected $billing_country;
169
-
170
- /**
171
- * Customer's Shipping Address: First name
172
- *
173
- * @var string
174
- */
175
- protected $shipping_first_name;
176
-
177
- /**
178
- * Customer's Shipping Address: Last name
179
- *
180
- * @var string
181
- */
182
- protected $shipping_last_name;
183
-
184
- /**
185
- * Customer's Shipping Address: Part 1
186
- *
187
- * @var string
188
- */
189
- protected $shipping_address1;
190
-
191
- /**
192
- * Customer's Shipping Address: Part 2
193
- *
194
- * @var string
195
  */
196
- protected $shipping_address2;
197
-
198
- /**
199
- * Customer's Shipping Address: ZIP
200
- *
201
- * @var string
202
- */
203
- protected $shipping_zip_code;
204
-
205
- /**
206
- * Customer's Shipping Address: City
207
- *
208
- * @var string
209
- */
210
- protected $shipping_city;
211
-
212
- /**
213
- * Customer's Shipping Address: State
214
- *
215
- * format: ISO-3166-2
216
- *
217
- * @var string
218
- */
219
- protected $shipping_state;
220
-
221
- /**
222
- * Customer's Shipping Address
223
- *
224
- * format: ISO-3166
225
- *
226
- * @var string
227
- */
228
- protected $shipping_country;
229
-
230
- /**
231
- * Social Security number or equivalent value for non US customers.
232
- *
233
- * @var string
234
- */
235
- protected $risk_ssn;
236
-
237
- /**
238
- * Customer's MAC address
239
- *
240
- * @var string
241
- */
242
- protected $risk_mac_address;
243
-
244
- /**
245
- * Customer's Session Id
246
- *
247
- * @var string
248
- */
249
- protected $risk_session_id;
250
-
251
- /**
252
- * Customer's User Id
253
- *
254
- * @var string
255
- */
256
- protected $risk_user_id;
257
-
258
- /**
259
- * Customer's User Level
260
- *
261
- * @var string
262
- */
263
- protected $risk_user_level;
264
-
265
- /**
266
- * Customer's Email address
267
- *
268
- * @note Set here if different from
269
- * shipping / billing
270
- *
271
- * @var string
272
- */
273
- protected $risk_email;
274
-
275
- /**
276
- * Customer's Phone number
277
- *
278
- * @note Set here if different from
279
- * shipping / billing
280
- *
281
- * @var string
282
- */
283
- protected $risk_phone;
284
-
285
- /**
286
- * Customer's IP address
287
- *
288
- * @note Set here if different from remote_ip
289
- *
290
- * @var string
291
- */
292
- protected $risk_remote_ip;
293
-
294
- /**
295
- * Customer's Serial Number
296
- *
297
- * @var string
298
- */
299
- protected $risk_serial_number;
300
-
301
- /**
302
- * Set the per-request configuration
303
- *
304
- * @return void
305
- */
306
- protected function initConfiguration()
307
  {
308
- $this->config = \Genesis\Utils\Common::createArrayObject(
309
- array(
310
- 'protocol' => 'https',
311
- 'port' => 443,
312
- 'type' => 'POST',
313
- 'format' => 'xml',
314
- )
315
- );
316
-
317
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
318
  }
319
 
320
  /**
@@ -324,7 +70,7 @@ class Sofort extends \Genesis\API\Request
324
  */
325
  protected function setRequiredFields()
326
  {
327
- $requiredFields = array(
328
  'transaction_id',
329
  'remote_ip',
330
  'amount',
@@ -332,72 +78,36 @@ class Sofort extends \Genesis\API\Request
332
  'return_success_url',
333
  'return_failure_url',
334
  'customer_email',
335
- );
 
336
 
337
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
338
  }
339
 
340
  /**
341
- * Create the request's Tree structure
342
- *
343
- * @return void
344
  */
345
- protected function populateStructure()
346
  {
347
- $treeStructure = array(
348
- 'payment_transaction' => array(
349
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::SOFORT,
350
- 'transaction_id' => $this->transaction_id,
351
- 'usage' => $this->usage,
352
- 'remote_ip' => $this->remote_ip,
353
- 'return_success_url' => $this->return_success_url,
354
- 'return_failure_url' => $this->return_failure_url,
355
- 'amount' => $this->transform(
356
- 'amount',
357
- array(
358
- $this->amount,
359
- $this->currency,
360
- )
361
- ),
362
- 'currency' => $this->currency,
363
- 'customer_email' => $this->customer_email,
364
- 'customer_phone' => $this->customer_phone,
365
- 'customer_bank_id' => $this->customer_bank_id,
366
- 'bank_account_number' => $this->bank_account_number,
367
- 'billing_address' => array(
368
- 'first_name' => $this->billing_first_name,
369
- 'last_name' => $this->billing_last_name,
370
- 'address1' => $this->billing_address1,
371
- 'address2' => $this->billing_address2,
372
- 'zip_code' => $this->billing_zip_code,
373
- 'city' => $this->billing_city,
374
- 'state' => $this->billing_state,
375
- 'country' => $this->billing_country,
376
- ),
377
- 'shipping_address' => array(
378
- 'first_name' => $this->shipping_first_name,
379
- 'last_name' => $this->shipping_last_name,
380
- 'address1' => $this->shipping_address1,
381
- 'address2' => $this->shipping_address2,
382
- 'zip_code' => $this->shipping_zip_code,
383
- 'city' => $this->shipping_city,
384
- 'state' => $this->shipping_state,
385
- 'country' => $this->shipping_country,
386
- ),
387
- 'risk_params' => array(
388
- 'ssn' => $this->risk_ssn,
389
- 'mac_address' => $this->risk_mac_address,
390
- 'session_id' => $this->risk_session_id,
391
- 'user_id' => $this->risk_user_id,
392
- 'user_level' => $this->risk_user_level,
393
- 'email' => $this->risk_email,
394
- 'phone' => $this->risk_phone,
395
- 'remote_ip' => $this->risk_remote_ip,
396
- 'serial_number' => $this->risk_serial_number,
397
- ),
398
- )
399
- );
400
-
401
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
402
  }
403
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Alternatives;
25
 
26
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
  /**
31
  * Class Sofort
32
  *
33
  * Alternative payment method
34
  *
35
  * @package Genesis\API\Request\Financial\Alternatives
36
+ *
37
+ * @method Sofort setCustomerBankId($value) Set the bank id of the bank where the customer resides
38
+ * @method Sofort setBankAccountNumber($value) Set the Bank identification number of the customer
39
  */
40
+ class Sofort extends \Genesis\API\Request\Base\Financial
41
  {
42
+ use AsyncAttributes, PaymentAttributes, AddressInfoAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  /**
45
  * The bank id of the bank where the customer resides
47
  * @var string
48
  */
49
  protected $customer_bank_id;
 
50
  /**
51
  * Bank identification number of the customer
52
  *
55
  protected $bank_account_number;
56
 
57
  /**
58
+ * Returns the Request transaction type
59
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  */
61
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  {
63
+ return \Genesis\API\Constants\Transaction\Types::SOFORT;
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  /**
70
  */
71
  protected function setRequiredFields()
72
  {
73
+ $requiredFields = [
74
  'transaction_id',
75
  'remote_ip',
76
  'amount',
78
  'return_success_url',
79
  'return_failure_url',
80
  'customer_email',
81
+ 'billing_country'
82
+ ];
83
 
84
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
85
+
86
+ $requiredFieldValues = [
87
+ 'billing_country' => ['AT', 'BE', 'DE', 'ES', 'FR', 'GB', 'IT', 'NL'],
88
+ 'currency' => \Genesis\Utils\Currency::getList()
89
+ ];
90
+
91
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
92
  }
93
 
94
  /**
95
+ * Return additional request attributes
96
+ * @return array
 
97
  */
98
+ protected function getPaymentTransactionStructure()
99
  {
100
+ return [
101
+ 'return_success_url' => $this->return_success_url,
102
+ 'return_failure_url' => $this->return_failure_url,
103
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
104
+ 'currency' => $this->currency,
105
+ 'customer_email' => $this->customer_email,
106
+ 'customer_phone' => $this->customer_phone,
107
+ 'customer_bank_id' => $this->customer_bank_id,
108
+ 'bank_account_number' => $this->bank_account_number,
109
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
110
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
111
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
  }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Trustly/Sale.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\Alternatives\Trustly;
25
+
26
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
+ /**
31
+ * Class Sale
32
+ *
33
+ * Trustly Sale Alternative payment method
34
+ *
35
+ * @package Genesis\API\Request\Financial\Alternatives\Trustly
36
+ *
37
+ * @method $this setBirthDate($value) Set Birth date of the customer
38
+ */
39
+ class Sale extends \Genesis\API\Request\Base\Financial
40
+ {
41
+ use AsyncAttributes, PaymentAttributes, AddressInfoAttributes;
42
+
43
+ /**
44
+ * Birth date of the customer
45
+ *
46
+ * @var string
47
+ */
48
+ protected $birth_date;
49
+
50
+ /**
51
+ * Returns the Request transaction type
52
+ * @return string
53
+ */
54
+ protected function getTransactionType()
55
+ {
56
+ return \Genesis\API\Constants\Transaction\Types::TRUSTLY_SALE;
57
+ }
58
+
59
+ /**
60
+ * Set the required fields
61
+ *
62
+ * @return void
63
+ */
64
+ protected function setRequiredFields()
65
+ {
66
+ $requiredFields = [
67
+ 'transaction_id',
68
+ 'remote_ip',
69
+ 'amount',
70
+ 'currency',
71
+ 'return_success_url',
72
+ 'return_failure_url',
73
+ 'customer_email',
74
+ 'billing_country'
75
+ ];
76
+
77
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
78
+
79
+ $requiredFieldValues = [
80
+ 'billing_country' => [
81
+ 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU',
82
+ 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK'
83
+ ],
84
+ 'currency' => \Genesis\Utils\Currency::getList()
85
+ ];
86
+
87
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
88
+ }
89
+
90
+ /**
91
+ * Return additional request attributes
92
+ * @return array
93
+ */
94
+ protected function getPaymentTransactionStructure()
95
+ {
96
+ return [
97
+ 'return_success_url' => $this->return_success_url,
98
+ 'return_failure_url' => $this->return_failure_url,
99
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
100
+ 'currency' => $this->currency,
101
+ 'customer_email' => $this->customer_email,
102
+ 'customer_phone' => $this->customer_phone,
103
+ 'birth_date' => $this->birth_date,
104
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
105
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
106
+ ];
107
+ }
108
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Alternatives/Trustly/Withdrawal.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\Alternatives\Trustly;
25
+
26
+ /**
27
+ * Class Withdrawal
28
+ *
29
+ * Trustly Withdrawal Alternative payment method
30
+ *
31
+ * @package Genesis\API\Request\Financial\Alternatives\Trustly
32
+ */
33
+ class Withdrawal extends \Genesis\API\Request\Financial\Alternatives\Trustly\Sale
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::TRUSTLY_WITHDRAWAL;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFields = [
54
+ 'transaction_id',
55
+ 'remote_ip',
56
+ 'amount',
57
+ 'currency',
58
+ 'return_success_url',
59
+ 'return_failure_url',
60
+ 'customer_email',
61
+ 'birth_date',
62
+ 'billing_country'
63
+ ];
64
+
65
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
66
+ }
67
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Cancel.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+ namespace Genesis\API\Request\Financial;
24
+
25
+ use Genesis\API\Traits\Request\Financial\ReferenceAttributes;
26
+
27
+ /**
28
+ * Class Cancel
29
+ *
30
+ * Cancel / Void Request
31
+ *
32
+ * @package Genesis\API\Request\Financial
33
+ */
34
+ class Cancel extends \Genesis\API\Request\Base\Financial
35
+ {
36
+ use ReferenceAttributes;
37
+
38
+ /**
39
+ * Returns the Request transaction type
40
+ * @return string
41
+ */
42
+ protected function getTransactionType()
43
+ {
44
+ return \Genesis\API\Constants\Transaction\Types::VOID;
45
+ }
46
+
47
+ /**
48
+ * Set the required fields
49
+ *
50
+ * @return void
51
+ */
52
+ protected function setRequiredFields()
53
+ {
54
+ $requiredFields = [
55
+ 'transaction_id',
56
+ 'reference_id'
57
+ ];
58
+
59
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
60
+ }
61
+
62
+ /**
63
+ * Return additional request attributes
64
+ * @return array
65
+ */
66
+ protected function getPaymentTransactionStructure()
67
+ {
68
+ return [
69
+ 'reference_id' => $this->reference_id
70
+ ];
71
+ }
72
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Capture.php CHANGED
@@ -23,116 +23,20 @@
23
  namespace Genesis\API\Request\Financial;
24
 
25
  /**
 
 
26
  * Capture Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Capture extends \Genesis\API\Request
32
  {
33
  /**
34
- * Unique transaction id defined by mer-chant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Amount of transaction in minor currency unit
56
- *
57
- * @var int
58
- */
59
- protected $amount;
60
-
61
- /**
62
- * Currency code in ISO-4217
63
- *
64
- * @var string
65
- */
66
- protected $currency;
67
-
68
- /**
69
- * Unique id of the existing (target) transaction
70
- *
71
- * @var string
72
  */
73
- protected $reference_id;
74
-
75
- /**
76
- * Set the per-request configuration
77
- *
78
- * @return void
79
- */
80
- protected function initConfiguration()
81
- {
82
- $this->config = \Genesis\Utils\Common::createArrayObject(
83
- array(
84
- 'protocol' => 'https',
85
- 'port' => 443,
86
- 'type' => 'POST',
87
- 'format' => 'xml',
88
- )
89
- );
90
-
91
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
92
- }
93
-
94
- /**
95
- * Set the required fields
96
- *
97
- * @return void
98
- */
99
- protected function setRequiredFields()
100
- {
101
- $requiredFields = array(
102
- 'transaction_id',
103
- 'reference_id',
104
- 'amount',
105
- 'currency'
106
- );
107
-
108
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
109
- }
110
-
111
- /**
112
- * Create the request's Tree structure
113
- *
114
- * @return void
115
- */
116
- protected function populateStructure()
117
  {
118
- $treeStructure = array(
119
- 'payment_transaction' => array(
120
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::CAPTURE,
121
- 'transaction_id' => $this->transaction_id,
122
- 'usage' => $this->usage,
123
- 'remote_ip' => $this->remote_ip,
124
- 'reference_id' => $this->reference_id,
125
- 'amount' => $this->transform(
126
- 'amount',
127
- array(
128
- $this->amount,
129
- $this->currency,
130
- )
131
- ),
132
- 'currency' => $this->currency
133
- )
134
- );
135
-
136
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
137
  }
138
  }
23
  namespace Genesis\API\Request\Financial;
24
 
25
  /**
26
+ * Class Capture
27
+ *
28
  * Capture Request
29
  *
30
+ * @package Genesis\API\Request\Financial
 
31
  */
32
+ class Capture extends \Genesis\API\Request\Base\Financial\Reference
33
  {
34
  /**
35
+ * Returns the Request transaction type
36
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  */
38
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  {
40
+ return \Genesis\API\Constants\Transaction\Types::CAPTURE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize.php CHANGED
@@ -20,341 +20,36 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Class Authorize
27
  *
 
28
  *
29
- *
30
- * @package Genesis
31
- * @subpackage Request
32
  */
33
- class Authorize extends \Genesis\API\Request
34
  {
35
- /**
36
- * Unique transaction id defined by merchant
37
- *
38
- * @var string
39
- */
40
- protected $transaction_id;
41
-
42
- /**
43
- * Description of the transaction for later use
44
- *
45
- * @var string
46
- */
47
- protected $usage;
48
-
49
- /**
50
- * Signifies whether a gaming transaction is performed.
51
- *
52
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
53
- *
54
- * @var bool
55
- */
56
- protected $gaming;
57
-
58
- /**
59
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
60
- *
61
- * Contact tech support for more details.
62
- *
63
- * @var bool
64
- */
65
- protected $moto;
66
-
67
- /**
68
- * IPv4 address of customer
69
- *
70
- * @var string
71
- */
72
- protected $remote_ip;
73
-
74
- /**
75
- * Amount of transaction in minor currency unit
76
- *
77
- * @var int|float|double
78
- */
79
- protected $amount;
80
-
81
- /**
82
- * Currency code in ISO-4217
83
- *
84
- * @var string
85
- */
86
- protected $currency;
87
-
88
- /**
89
- * Full name of customer as printed on credit card (first name and last name at least)
90
- *
91
- * @var string
92
- */
93
- protected $card_holder;
94
-
95
- /**
96
- * Complete CC number of customer
97
- *
98
- * @var int
99
- */
100
- protected $card_number;
101
-
102
- /**
103
- * CVV of CC, requirement is based on terminal configuration
104
- *
105
- * @var int
106
- */
107
- protected $cvv;
108
-
109
- /**
110
- * Expiration month as printed on credit card
111
- *
112
- * @var string (mm)
113
- */
114
- protected $expiration_month;
115
-
116
- /**
117
- * Expiration year as printed on credit card
118
- *
119
- * @var string (yyyy)
120
- */
121
- protected $expiration_year;
122
-
123
- /**
124
- * Email address of the Customer
125
- *
126
- * @var string
127
- */
128
- protected $customer_email;
129
-
130
- /**
131
- * Phone number of the customer
132
- *
133
- * @var string
134
- */
135
- protected $customer_phone;
136
-
137
- /**
138
- *Customer's Billing Address: First name
139
- *
140
- * @var string
141
- */
142
- protected $billing_first_name;
143
-
144
- /**
145
- * Customer's Billing Address: Last name
146
- *
147
- * @var string
148
- */
149
- protected $billing_last_name;
150
-
151
- /**
152
- * Customer's Billing Address: Part 1
153
- *
154
- * @var string
155
- */
156
- protected $billing_address1;
157
-
158
- /**
159
- * Customer's Billing Address: Part 2
160
- * @var string
161
- */
162
- protected $billing_address2;
163
-
164
- /**
165
- * Customer's Billing Address: ZIP
166
- *
167
- * @var string
168
- */
169
- protected $billing_zip_code;
170
-
171
- /**
172
- * Customer's Billing Address: City
173
- *
174
- * @var string
175
- */
176
- protected $billing_city;
177
-
178
- /**
179
- * Customer's Billing Address: State
180
- *
181
- * format: ISO-3166-2
182
- *
183
- * @var string
184
- */
185
- protected $billing_state;
186
-
187
- /**
188
- * Customer's Billing Address: Country
189
- *
190
- * format: ISO-3166
191
- *
192
- * @var string
193
- */
194
- protected $billing_country;
195
-
196
- /**
197
- * Customer's Shipping Address: First name
198
- *
199
- * @var string
200
- */
201
- protected $shipping_first_name;
202
-
203
- /**
204
- * Customer's Shipping Address: Last name
205
- *
206
- * @var string
207
- */
208
- protected $shipping_last_name;
209
-
210
- /**
211
- * Customer's Shipping Address: Part 1
212
- *
213
- * @var string
214
- */
215
- protected $shipping_address1;
216
-
217
- /**
218
- * Customer's Shipping Address: Part 2
219
- *
220
- * @var string
221
- */
222
- protected $shipping_address2;
223
-
224
- /**
225
- * Customer's Shipping Address: ZIP
226
- *
227
- * @var string
228
- */
229
- protected $shipping_zip_code;
230
-
231
- /**
232
- * Customer's Shipping Address: City
233
- *
234
- * @var string
235
- */
236
- protected $shipping_city;
237
-
238
- /**
239
- * Customer's Shipping Address: State
240
- *
241
- * format: ISO-3166-2
242
- *
243
- * @var string
244
- */
245
- protected $shipping_state;
246
-
247
- /**
248
- * Customer's Shipping Address
249
- *
250
- * format: ISO-3166
251
- *
252
- * @var string
253
- */
254
- protected $shipping_country;
255
-
256
- /**
257
- * Social Security number or equivalent value for non US customers.
258
- *
259
- * @var string
260
- */
261
- protected $risk_ssn;
262
-
263
- /**
264
- * Customer's MAC address
265
- *
266
- * @var string
267
- */
268
- protected $risk_mac_address;
269
-
270
- /**
271
- * Customer's Session Id
272
- *
273
- * @var string
274
- */
275
- protected $risk_session_id;
276
-
277
- /**
278
- * Customer's User Id
279
- *
280
- * @var string
281
- */
282
- protected $risk_user_id;
283
-
284
- /**
285
- * Customer's User Level
286
- *
287
- * @var string
288
- */
289
- protected $risk_user_level;
290
-
291
- /**
292
- * Customer's Email address
293
- *
294
- * @note Set here if different from
295
- * shipping / billing
296
- *
297
- * @var string
298
- */
299
- protected $risk_email;
300
-
301
- /**
302
- * Customer's Phone number
303
- *
304
- * @note Set here if different from
305
- * shipping / billing
306
- *
307
- * @var string
308
- */
309
- protected $risk_phone;
310
-
311
- /**
312
- * Customer's IP address
313
- *
314
- * @note Set here if different from remote_ip
315
- *
316
- * @var string
317
- */
318
- protected $risk_remote_ip;
319
 
320
  /**
321
- * Customer's Serial Number
322
- *
323
- * @var string
324
  */
325
- protected $risk_serial_number;
326
-
327
- /**
328
- * Allows to dynamically override the charge descriptor
329
- *
330
- * @var string
331
- */
332
- protected $dynamic_merchant_name;
333
-
334
- /**
335
- * Allows to dynamically override the mer- chant phone number
336
- *
337
- * @var string
338
- */
339
- protected $dynamic_merchant_city;
340
-
341
- /**
342
- * Set the per-request configuration
343
- *
344
- * @return void
345
- */
346
- protected function initConfiguration()
347
  {
348
- $this->config = \Genesis\Utils\Common::createArrayObject(
349
- array(
350
- 'protocol' => 'https',
351
- 'port' => 443,
352
- 'type' => 'POST',
353
- 'format' => 'xml',
354
- )
355
- );
356
-
357
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
358
  }
359
 
360
  /**
@@ -364,87 +59,51 @@ class Authorize extends \Genesis\API\Request
364
  */
365
  protected function setRequiredFields()
366
  {
367
- $requiredFields = array(
368
  'transaction_id',
369
  'amount',
370
  'currency',
371
  'card_holder',
372
- 'expiration_month',
373
- 'expiration_year',
374
  'card_number',
375
- );
 
 
376
 
377
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
378
  }
379
 
380
  /**
381
- * Create the request's Tree structure
382
- *
383
- * @return void
384
  */
385
- protected function populateStructure()
386
  {
387
- $treeStructure = array(
388
- 'payment_transaction' => array(
389
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::AUTHORIZE,
390
- 'transaction_id' => $this->transaction_id,
391
- 'usage' => $this->usage,
392
- 'gaming' => $this->gaming,
393
- 'moto' => $this->moto,
394
- 'remote_ip' => $this->remote_ip,
395
- 'amount' => $this->transform(
396
- 'amount',
397
- array(
398
- $this->amount,
399
- $this->currency,
400
- )
401
- ),
402
- 'currency' => $this->currency,
403
- 'card_holder' => $this->card_holder,
404
- 'card_number' => $this->card_number,
405
- 'cvv' => $this->cvv,
406
- 'expiration_month' => $this->expiration_month,
407
- 'expiration_year' => $this->expiration_year,
408
- 'customer_email' => $this->customer_email,
409
- 'customer_phone' => $this->customer_phone,
410
- 'billing_address' => array(
411
- 'first_name' => $this->billing_first_name,
412
- 'last_name' => $this->billing_last_name,
413
- 'address1' => $this->billing_address1,
414
- 'address2' => $this->billing_address2,
415
- 'zip_code' => $this->billing_zip_code,
416
- 'city' => $this->billing_city,
417
- 'state' => $this->billing_state,
418
- 'country' => $this->billing_country,
419
- ),
420
- 'shipping_address' => array(
421
- 'first_name' => $this->shipping_first_name,
422
- 'last_name' => $this->shipping_last_name,
423
- 'address1' => $this->shipping_address1,
424
- 'address2' => $this->shipping_address2,
425
- 'zip_code' => $this->shipping_zip_code,
426
- 'city' => $this->shipping_city,
427
- 'state' => $this->shipping_state,
428
- 'country' => $this->shipping_country,
429
- ),
430
- 'risk_params' => array(
431
- 'ssn' => $this->risk_ssn,
432
- 'mac_address' => $this->risk_mac_address,
433
- 'session_id' => $this->risk_session_id,
434
- 'user_id' => $this->risk_user_id,
435
- 'user_level' => $this->risk_user_level,
436
- 'email' => $this->risk_email,
437
- 'phone' => $this->risk_phone,
438
- 'remote_ip' => $this->risk_remote_ip,
439
- 'serial_number' => $this->risk_serial_number,
440
- ),
441
- 'dynamic_descriptor_params' => array(
442
- 'merchant_name' => $this->dynamic_merchant_name,
443
- 'merchant_city' => $this->dynamic_merchant_city,
444
- )
445
- )
446
- );
447
-
448
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
449
  }
450
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards;
25
 
26
+ use Genesis\API\Traits\Request\Financial\GamingAttributes;
27
+ use Genesis\API\Traits\Request\MotoAttributes;
28
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
29
+ use Genesis\API\Traits\Request\CreditCardAttributes;
30
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
31
+ use Genesis\API\Traits\Request\RiskAttributes;
32
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
33
+
34
  /**
35
  * Class Authorize
36
  *
37
+ * Authorize Request
38
  *
39
+ * @package Genesis\API\Request\Financial\Cards
 
 
40
  */
41
+ class Authorize extends \Genesis\API\Request\Base\Financial
42
  {
43
+ use GamingAttributes, MotoAttributes, PaymentAttributes, CreditCardAttributes,
44
+ AddressInfoAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  /**
47
+ * Returns the Request transaction type
48
+ * @return string
 
49
  */
50
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
+ return \Genesis\API\Constants\Transaction\Types::AUTHORIZE;
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
59
  */
60
  protected function setRequiredFields()
61
  {
62
+ $requiredFields = [
63
  'transaction_id',
64
  'amount',
65
  'currency',
66
  'card_holder',
 
 
67
  'card_number',
68
+ 'expiration_month',
69
+ 'expiration_year'
70
+ ];
71
 
72
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
73
+
74
+ $requiredFieldValues = array_merge(
75
+ [
76
+ 'currency' => \Genesis\Utils\Currency::getList()
77
+ ],
78
+ $this->getCCFieldValueFormatValidators()
79
+ );
80
+
81
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
82
  }
83
 
84
  /**
85
+ * Return additional request attributes
86
+ * @return array
 
87
  */
88
+ protected function getPaymentTransactionStructure()
89
  {
90
+ return [
91
+ 'gaming' => $this->gaming,
92
+ 'moto' => $this->moto,
93
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
94
+ 'currency' => $this->currency,
95
+ 'card_holder' => $this->card_holder,
96
+ 'card_number' => $this->card_number,
97
+ 'cvv' => $this->cvv,
98
+ 'expiration_month' => $this->expiration_month,
99
+ 'expiration_year' => $this->expiration_year,
100
+ 'customer_email' => $this->customer_email,
101
+ 'customer_phone' => $this->customer_phone,
102
+ 'birth_date' => $this->birth_date,
103
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
104
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
105
+ 'risk_params' => $this->getRiskParamsStructure(),
106
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
107
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Authorize3D.php CHANGED
@@ -20,382 +20,40 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
 
 
 
 
 
 
 
 
 
 
 
25
  /**
 
 
26
  * Authorize 3D Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Authorize3D extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a gaming transaction is performed.
49
- *
50
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $gaming;
55
-
56
- /**
57
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
58
- *
59
- * Contact tech support for more details.
60
- *
61
- * @var bool
62
- */
63
- protected $moto;
64
-
65
- /**
66
- * IPv4 address of customer
67
- *
68
- * @var string
69
- */
70
- protected $remote_ip;
71
-
72
- /**
73
- * URL endpoint for Genesis Notifications
74
- *
75
- * @var string
76
- */
77
- protected $notification_url;
78
-
79
- /**
80
- * URL where customer is sent to after successful payment
81
- *
82
- * @var string
83
- */
84
- protected $return_success_url;
85
-
86
- /**
87
- * URL where customer is sent to after un-successful payment
88
- *
89
- * @var string
90
- */
91
- protected $return_failure_url;
92
-
93
- /**
94
- * Amount of transaction in minor currency unit
95
- *
96
- * @var int|float|double
97
- */
98
- protected $amount;
99
-
100
- /**
101
- * Currency code in ISO-4217
102
- *
103
- * @var string
104
- */
105
- protected $currency;
106
-
107
- /**
108
- * Full name of customer as printed on credit card (first name and last name at least)
109
- *
110
- * @var string
111
- */
112
- protected $card_holder;
113
-
114
- /**
115
- * Complete CC number of customer
116
- *
117
- * @var int
118
- */
119
- protected $card_number;
120
-
121
- /**
122
- * CVV of CC, requirement is based on terminal configuration
123
- *
124
- * @var int
125
- */
126
- protected $cvv;
127
-
128
- /**
129
- * Expiration month as printed on credit card
130
- *
131
- * @var string (mm)
132
- */
133
- protected $expiration_month;
134
-
135
- /**
136
- * Expiration year as printed on credit card
137
- *
138
- * @var string (yyyy)
139
- */
140
- protected $expiration_year;
141
-
142
- /**
143
- * Email address of the Customer
144
- *
145
- * @var string
146
- */
147
- protected $customer_email;
148
-
149
- /**
150
- * Phone number of the customer
151
- *
152
- * @var string
153
- */
154
- protected $customer_phone;
155
-
156
- /**
157
- *Customer's Billing Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $billing_first_name;
162
-
163
- /**
164
- * Customer's Billing Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $billing_last_name;
169
-
170
- /**
171
- * Customer's Billing Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $billing_address1;
176
-
177
- /**
178
- * Customer's Billing Address: Part 2
179
- * @var string
180
- */
181
- protected $billing_address2;
182
-
183
- /**
184
- * Customer's Billing Address: ZIP
185
- *
186
- * @var string
187
- */
188
- protected $billing_zip_code;
189
-
190
- /**
191
- * Customer's Billing Address: City
192
- *
193
- * @var string
194
- */
195
- protected $billing_city;
196
-
197
- /**
198
- * Customer's Billing Address: State
199
- *
200
- * format: ISO-3166-2
201
- *
202
- * @var string
203
- */
204
- protected $billing_state;
205
-
206
- /**
207
- * Customer's Billing Address: Country
208
- *
209
- * format: ISO-3166
210
- *
211
- * @var string
212
- */
213
- protected $billing_country;
214
 
215
  /**
216
- * Customer's Shipping Address: First name
217
- *
218
- * @var string
219
- */
220
- protected $shipping_first_name;
221
-
222
- /**
223
- * Customer's Shipping Address: Last name
224
- *
225
- * @var string
226
- */
227
- protected $shipping_last_name;
228
-
229
- /**
230
- * Customer's Shipping Address: Part 1
231
- *
232
- * @var string
233
  */
234
- protected $shipping_address1;
235
-
236
- /**
237
- * Customer's Shipping Address: Part 2
238
- *
239
- * @var string
240
- */
241
- protected $shipping_address2;
242
-
243
- /**
244
- * Customer's Shipping Address: ZIP
245
- *
246
- * @var string
247
- */
248
- protected $shipping_zip_code;
249
-
250
- /**
251
- * Customer's Shipping Address: City
252
- *
253
- * @var string
254
- */
255
- protected $shipping_city;
256
-
257
- /**
258
- * Customer's Shipping Address: State
259
- *
260
- * format: ISO-3166-2
261
- *
262
- * @var string
263
- */
264
- protected $shipping_state;
265
-
266
- /**
267
- * Customer's Shipping Address
268
- *
269
- * format: ISO-3166
270
- *
271
- * @var string
272
- */
273
- protected $shipping_country;
274
-
275
- /**
276
- * Social Security number or equivalent value for non US customers.
277
- *
278
- * @var string
279
- */
280
- protected $risk_ssn;
281
-
282
- /**
283
- * Customer's MAC address
284
- *
285
- * @var string
286
- */
287
- protected $risk_mac_address;
288
-
289
- /**
290
- * Customer's Session Id
291
- *
292
- * @var string
293
- */
294
- protected $risk_session_id;
295
-
296
- /**
297
- * Customer's User Id
298
- *
299
- * @var string
300
- */
301
- protected $risk_user_id;
302
-
303
- /**
304
- * Customer's User Level
305
- *
306
- * @var string
307
- */
308
- protected $risk_user_level;
309
-
310
- /**
311
- * Customer's Email address
312
- *
313
- * @note Set here if different from
314
- * shipping / billing
315
- *
316
- * @var string
317
- */
318
- protected $risk_email;
319
-
320
- /**
321
- * Customer's Phone number
322
- *
323
- * @note Set here if different from
324
- * shipping / billing
325
- *
326
- * @var string
327
- */
328
- protected $risk_phone;
329
-
330
- /**
331
- * Customer's IP address
332
- *
333
- * @note Set here if different from remote_ip
334
- *
335
- * @var string
336
- */
337
- protected $risk_remote_ip;
338
-
339
- /**
340
- * Customer's Serial Number
341
- *
342
- * @var string
343
- */
344
- protected $risk_serial_number;
345
-
346
- /**
347
- * Verification Id of the authentication.
348
- *
349
- * Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
350
- *
351
- * @var string
352
- */
353
- protected $mpi_cavv;
354
-
355
- /**
356
- * Electric Commerce Indicator as returned from the MPI.
357
- *
358
- * @var string
359
- */
360
- protected $mpi_eci;
361
-
362
- /**
363
- * Transaction ID generated by the 3D Secure service
364
- * that uniquely identifies a 3D Secure check request
365
- *
366
- * @var string
367
- */
368
- protected $mpi_xid;
369
-
370
- /**
371
- * Allows to dynamically override the charge descriptor
372
- *
373
- * @var string
374
- */
375
- protected $dynamic_merchant_name;
376
-
377
- /**
378
- * Allows to dynamically override the mer- chant phone number
379
- *
380
- * @var string
381
- */
382
- protected $dynamic_merchant_city;
383
-
384
- /**
385
- * Set the per-request configuration
386
- *
387
- * @return void
388
- */
389
- protected function initConfiguration()
390
  {
391
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
392
- 'protocol' => 'https',
393
- 'port' => 443,
394
- 'type' => 'POST',
395
- 'format' => 'xml',
396
- ));
397
-
398
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
399
  }
400
 
401
  /**
@@ -405,110 +63,70 @@ class Authorize3D extends \Genesis\API\Request
405
  */
406
  protected function setRequiredFields()
407
  {
408
- $requiredFields = array(
409
  'transaction_id',
410
  'amount',
411
  'currency',
412
  'card_holder',
413
  'card_number',
414
  'expiration_month',
415
- 'expiration_year',
416
- );
417
 
418
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
419
 
420
- $requiredFieldsConditional = array(
421
- 'notification_url' => array('return_success_url', 'return_failure_url'),
422
- 'return_success_url' => array('notification_url', 'return_failure_url'),
423
- 'return_failure_url' => array('notification_url', 'return_success_url'),
 
424
  );
425
 
 
 
 
 
 
 
 
 
426
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
427
 
428
- $requiredFieldsGroups = array(
429
- 'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
430
- 'asynchronous' => array( 'mpi_eci'),
431
- );
432
 
433
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
434
  }
435
 
436
  /**
437
- * Create the request's Tree structure
438
- *
439
- * @return void
440
  */
441
- protected function populateStructure()
442
  {
443
- $treeStructure = array(
444
- 'payment_transaction' => array(
445
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D,
446
- 'transaction_id' => $this->transaction_id,
447
- 'usage' => $this->usage,
448
- 'gaming' => $this->gaming,
449
- 'moto' => $this->moto,
450
- 'remote_ip' => $this->remote_ip,
451
- 'notification_url' => $this->notification_url,
452
- 'return_success_url' => $this->return_success_url,
453
- 'return_failure_url' => $this->return_failure_url,
454
- 'amount' => $this->transform(
455
- 'amount',
456
- array(
457
- $this->amount,
458
- $this->currency,
459
- )
460
- ),
461
- 'currency' => $this->currency,
462
- 'card_holder' => $this->card_holder,
463
- 'card_number' => $this->card_number,
464
- 'cvv' => $this->cvv,
465
- 'expiration_month' => $this->expiration_month,
466
- 'expiration_year' => $this->expiration_year,
467
- 'customer_email' => $this->customer_email,
468
- 'customer_phone' => $this->customer_phone,
469
- 'billing_address' => array(
470
- 'first_name' => $this->billing_first_name,
471
- 'last_name' => $this->billing_last_name,
472
- 'address1' => $this->billing_address1,
473
- 'address2' => $this->billing_address2,
474
- 'zip_code' => $this->billing_zip_code,
475
- 'city' => $this->billing_city,
476
- 'state' => $this->billing_state,
477
- 'country' => $this->billing_country,
478
- ),
479
- 'shipping_address' => array(
480
- 'first_name' => $this->shipping_first_name,
481
- 'last_name' => $this->shipping_last_name,
482
- 'address1' => $this->shipping_address1,
483
- 'address2' => $this->shipping_address2,
484
- 'zip_code' => $this->shipping_zip_code,
485
- 'city' => $this->shipping_city,
486
- 'state' => $this->shipping_state,
487
- 'country' => $this->shipping_country,
488
- ),
489
- 'mpi_params' => array(
490
- 'cavv' => $this->mpi_cavv,
491
- 'eci' => $this->mpi_eci,
492
- 'xid' => $this->mpi_xid,
493
- ),
494
- 'risk_params' => array(
495
- 'ssn' => $this->risk_ssn,
496
- 'mac_address' => $this->risk_mac_address,
497
- 'session_id' => $this->risk_session_id,
498
- 'user_id' => $this->risk_user_id,
499
- 'user_level' => $this->risk_user_level,
500
- 'email' => $this->risk_email,
501
- 'phone' => $this->risk_phone,
502
- 'remote_ip' => $this->risk_remote_ip,
503
- 'serial_number' => $this->risk_serial_number,
504
- ),
505
- 'dynamic_descriptor_params' => array(
506
- 'merchant_name' => $this->dynamic_merchant_name,
507
- 'merchant_city' => $this->dynamic_merchant_city,
508
- )
509
- )
510
- );
511
-
512
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
513
  }
514
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards;
25
 
26
+ use Genesis\API\Traits\Request\Financial\GamingAttributes;
27
+ use Genesis\API\Traits\Request\MotoAttributes;
28
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
29
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
30
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
31
+ use Genesis\API\Traits\Request\CreditCardAttributes;
32
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
33
+ use Genesis\API\Traits\Request\Financial\MpiAttributes;
34
+ use Genesis\API\Traits\Request\RiskAttributes;
35
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
36
+
37
  /**
38
+ * Class Authorize3D
39
+ *
40
  * Authorize 3D Request
41
  *
42
+ * @package Genesis\API\Request\Financial\Cards
 
43
  */
44
+ class Authorize3D extends \Genesis\API\Request\Base\Financial
45
  {
46
+ use GamingAttributes, MotoAttributes, NotificationAttributes, AsyncAttributes,
47
+ PaymentAttributes, CreditCardAttributes, AddressInfoAttributes,
48
+ MpiAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  /**
51
+ * Returns the Request transaction type
52
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  */
54
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  {
56
+ return \Genesis\API\Constants\Transaction\Types::AUTHORIZE_3D;
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFields = [
67
  'transaction_id',
68
  'amount',
69
  'currency',
70
  'card_holder',
71
  'card_number',
72
  'expiration_month',
73
+ 'expiration_year'
74
+ ];
75
 
76
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
77
 
78
+ $requiredFieldValues = array_merge(
79
+ [
80
+ 'currency' => \Genesis\Utils\Currency::getList()
81
+ ],
82
+ $this->getCCFieldValueFormatValidators()
83
  );
84
 
85
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
86
+
87
+ $requiredFieldsConditional = [
88
+ 'notification_url' => ['return_success_url', 'return_failure_url'],
89
+ 'return_success_url' => ['notification_url', 'return_failure_url'],
90
+ 'return_failure_url' => ['notification_url', 'return_success_url']
91
+ ];
92
+
93
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
94
 
95
+ $requiredFieldsGroups = [
96
+ 'synchronous' => ['notification_url', 'return_success_url', 'return_failure_url'],
97
+ 'asynchronous' => ['mpi_eci']
98
+ ];
99
 
100
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
101
  }
102
 
103
  /**
104
+ * Return additional request attributes
105
+ * @return array
 
106
  */
107
+ protected function getPaymentTransactionStructure()
108
  {
109
+ return [
110
+ 'gaming' => $this->gaming,
111
+ 'moto' => $this->moto,
112
+ 'notification_url' => $this->notification_url,
113
+ 'return_success_url' => $this->return_success_url,
114
+ 'return_failure_url' => $this->return_failure_url,
115
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
116
+ 'currency' => $this->currency,
117
+ 'card_holder' => $this->card_holder,
118
+ 'card_number' => $this->card_number,
119
+ 'cvv' => $this->cvv,
120
+ 'expiration_month' => $this->expiration_month,
121
+ 'expiration_year' => $this->expiration_year,
122
+ 'customer_email' => $this->customer_email,
123
+ 'customer_phone' => $this->customer_phone,
124
+ 'birth_date' => $this->birth_date,
125
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
126
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
127
+ 'mpi_params' => $this->getMpiParamsStructure(),
128
+ 'risk_params' => $this->getRiskParamsStructure(),
129
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
130
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Credit.php CHANGED
@@ -23,116 +23,20 @@
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
25
  /**
 
 
26
  * Credit Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Credit extends \Genesis\API\Request
32
  {
33
  /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Amount of transaction in minor currency unit
56
- *
57
- * @var int|float|double
58
- */
59
- protected $amount;
60
-
61
- /**
62
- * Currency code in ISO-4217
63
- *
64
- * @var string
65
- */
66
- protected $currency;
67
-
68
- /**
69
- * Unique id of the existing (target) transaction
70
- *
71
- * @var string
72
  */
73
- protected $reference_id;
74
-
75
- /**
76
- * Set the per-request configuration
77
- *
78
- * @return void
79
- */
80
- protected function initConfiguration()
81
- {
82
- $this->config = \Genesis\Utils\Common::createArrayObject(
83
- array(
84
- 'protocol' => 'https',
85
- 'port' => 443,
86
- 'type' => 'POST',
87
- 'format' => 'xml',
88
- )
89
- );
90
-
91
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
92
- }
93
-
94
- /**
95
- * Set the required fields
96
- *
97
- * @return void
98
- */
99
- protected function setRequiredFields()
100
- {
101
- $requiredFields = array(
102
- 'transaction_id',
103
- 'reference_id',
104
- 'amount',
105
- 'currency'
106
- );
107
-
108
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
109
- }
110
-
111
- /**
112
- * Create the request's Tree structure
113
- *
114
- * @return void
115
- */
116
- protected function populateStructure()
117
  {
118
- $treeStructure = array(
119
- 'payment_transaction' => array(
120
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::CREDIT,
121
- 'transaction_id' => $this->transaction_id,
122
- 'usage' => $this->usage,
123
- 'remote_ip' => $this->remote_ip,
124
- 'reference_id' => $this->reference_id,
125
- 'amount' => $this->transform(
126
- 'amount',
127
- array(
128
- $this->amount,
129
- $this->currency,
130
- )
131
- ),
132
- 'currency' => $this->currency
133
- )
134
- );
135
-
136
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
137
  }
138
  }
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
25
  /**
26
+ * Class Credit
27
+ *
28
  * Credit Request
29
  *
30
+ * @package Genesis\API\Request\Financial\Cards
 
31
  */
32
+ class Credit extends \Genesis\API\Request\Base\Financial\Reference
33
  {
34
  /**
35
+ * Returns the Request transaction type
36
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  */
38
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  {
40
+ return \Genesis\API\Constants\Transaction\Types::CREDIT;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Payout.php CHANGED
@@ -20,236 +20,31 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
 
 
 
 
25
  /**
 
 
26
  * Payout Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Payout extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
 
40
  /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
  */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Amount of transaction in minor currency unit
56
- *
57
- * @var int|float|double
58
- */
59
- protected $amount;
60
-
61
- /**
62
- * Currency code in ISO-4217
63
- *
64
- * @var string
65
- */
66
- protected $currency;
67
-
68
- /**
69
- * Full name of customer as printed on credit card (first name and last name at least)
70
- *
71
- * @var string
72
- */
73
- protected $card_holder;
74
-
75
- /**
76
- * Complete CC number of customer
77
- *
78
- * @var int
79
- */
80
- protected $card_number;
81
-
82
- /**
83
- * CVV of CC, requirement is based on terminal configuration
84
- *
85
- * @var int
86
- */
87
- protected $cvv;
88
-
89
- /**
90
- * Expiration month as printed on credit card
91
- *
92
- * @var string (mm)
93
- */
94
- protected $expiration_month;
95
-
96
- /**
97
- * Expiration year as printed on credit card
98
- *
99
- * @var string (yyyy)
100
- */
101
- protected $expiration_year;
102
-
103
- /**
104
- * Email address of the Customer
105
- *
106
- * @var string
107
- */
108
- protected $customer_email;
109
-
110
- /**
111
- * Phone number of the customer
112
- *
113
- * @var string
114
- */
115
- protected $customer_phone;
116
-
117
- /**
118
- *Customer's Billing Address: First name
119
- *
120
- * @var string
121
- */
122
- protected $billing_first_name;
123
-
124
- /**
125
- * Customer's Billing Address: Last name
126
- *
127
- * @var string
128
- */
129
- protected $billing_last_name;
130
-
131
- /**
132
- * Customer's Billing Address: Part 1
133
- *
134
- * @var string
135
- */
136
- protected $billing_address1;
137
-
138
- /**
139
- * Customer's Billing Address: Part 2
140
- * @var string
141
- */
142
- protected $billing_address2;
143
-
144
- /**
145
- * Customer's Billing Address: ZIP
146
- *
147
- * @var string
148
- */
149
- protected $billing_zip_code;
150
-
151
- /**
152
- * Customer's Billing Address: City
153
- *
154
- * @var string
155
- */
156
- protected $billing_city;
157
-
158
- /**
159
- * Customer's Billing Address: State
160
- *
161
- * format: ISO-3166-2
162
- *
163
- * @var string
164
- */
165
- protected $billing_state;
166
-
167
- /**
168
- * Customer's Billing Address: Country
169
- *
170
- * format: ISO-3166
171
- *
172
- * @var string
173
- */
174
- protected $billing_country;
175
-
176
- /**
177
- * Customer's Shipping Address: First name
178
- *
179
- * @var string
180
- */
181
- protected $shipping_first_name;
182
-
183
- /**
184
- * Customer's Shipping Address: Last name
185
- *
186
- * @var string
187
- */
188
- protected $shipping_last_name;
189
-
190
- /**
191
- * Customer's Shipping Address: Part 1
192
- *
193
- * @var string
194
- */
195
- protected $shipping_address1;
196
-
197
- /**
198
- * Customer's Shipping Address: Part 2
199
- *
200
- * @var string
201
- */
202
- protected $shipping_address2;
203
-
204
- /**
205
- * Customer's Shipping Address: ZIP
206
- *
207
- * @var string
208
- */
209
- protected $shipping_zip_code;
210
-
211
- /**
212
- * Customer's Shipping Address: City
213
- *
214
- * @var string
215
- */
216
- protected $shipping_city;
217
-
218
- /**
219
- * Customer's Shipping Address: State
220
- *
221
- * format: ISO-3166-2
222
- *
223
- * @var string
224
- */
225
- protected $shipping_state;
226
-
227
- /**
228
- * Customer's Shipping Address
229
- *
230
- * format: ISO-3166
231
- *
232
- * @var string
233
- */
234
- protected $shipping_country;
235
-
236
- /**
237
- * Set the per-request configuration
238
- *
239
- * @return void
240
- */
241
- protected function initConfiguration()
242
  {
243
- $this->config = \Genesis\Utils\Common::createArrayObject(
244
- array(
245
- 'protocol' => 'https',
246
- 'port' => 443,
247
- 'type' => 'POST',
248
- 'format' => 'xml',
249
- )
250
- );
251
-
252
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
253
  }
254
 
255
  /**
@@ -259,70 +54,47 @@ class Payout extends \Genesis\API\Request
259
  */
260
  protected function setRequiredFields()
261
  {
262
- $requiredFields = array(
263
  'transaction_id',
264
  'amount',
265
  'currency',
266
  'card_holder',
267
  'card_number',
268
  'expiration_month',
269
- 'expiration_year',
270
- );
271
 
272
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
273
  }
274
 
275
  /**
276
- * Create the request's Tree structure
277
- *
278
- * @return void
279
  */
280
- protected function populateStructure()
281
  {
282
- $treeStructure = array(
283
- 'payment_transaction' => array(
284
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYOUT,
285
- 'transaction_id' => $this->transaction_id,
286
- 'usage' => $this->usage,
287
- 'amount' => $this->transform(
288
- 'amount',
289
- array(
290
- $this->amount,
291
- $this->currency,
292
- )
293
- ),
294
- 'currency' => $this->currency,
295
- 'remote_ip' => $this->remote_ip,
296
- 'card_holder' => $this->card_holder,
297
- 'card_number' => $this->card_number,
298
- 'cvv' => $this->cvv,
299
- 'expiration_month' => $this->expiration_month,
300
- 'expiration_year' => $this->expiration_year,
301
- 'customer_email' => $this->customer_email,
302
- 'customer_phone' => $this->customer_phone,
303
- 'billing_address' => array(
304
- 'first_name' => $this->billing_first_name,
305
- 'last_name' => $this->billing_last_name,
306
- 'address1' => $this->billing_address1,
307
- 'address2' => $this->billing_address2,
308
- 'zip_code' => $this->billing_zip_code,
309
- 'city' => $this->billing_city,
310
- 'state' => $this->billing_state,
311
- 'country' => $this->billing_country,
312
- ),
313
- 'shipping_address' => array(
314
- 'first_name' => $this->shipping_first_name,
315
- 'last_name' => $this->shipping_last_name,
316
- 'address1' => $this->shipping_address1,
317
- 'address2' => $this->shipping_address2,
318
- 'zip_code' => $this->shipping_zip_code,
319
- 'city' => $this->shipping_city,
320
- 'state' => $this->shipping_state,
321
- 'country' => $this->shipping_country,
322
- )
323
- )
324
- );
325
-
326
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
327
  }
328
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards;
25
 
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\CreditCardAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
  /**
31
+ * Class Payout
32
+ *
33
  * Payout Request
34
  *
35
+ * @package Genesis\API\Request\Financial\Cards
 
36
  */
37
+ class Payout extends \Genesis\API\Request\Base\Financial
38
  {
39
+ use PaymentAttributes, CreditCardAttributes, AddressInfoAttributes;
 
 
 
 
 
40
 
41
  /**
42
+ * Returns the Request transaction type
43
+ * @return string
 
44
  */
45
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  {
47
+ return \Genesis\API\Constants\Transaction\Types::PAYOUT;
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  /**
54
  */
55
  protected function setRequiredFields()
56
  {
57
+ $requiredFields = [
58
  'transaction_id',
59
  'amount',
60
  'currency',
61
  'card_holder',
62
  'card_number',
63
  'expiration_month',
64
+ 'expiration_year'
65
+ ];
66
 
67
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
68
+
69
+ $requiredFieldValues = array_merge(
70
+ [
71
+ 'currency' => \Genesis\Utils\Currency::getList()
72
+ ],
73
+ $this->getCCFieldValueFormatValidators()
74
+ );
75
+
76
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
77
  }
78
 
79
  /**
80
+ * Return additional request attributes
81
+ * @return array
 
82
  */
83
+ protected function getPaymentTransactionStructure()
84
  {
85
+ return [
86
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
87
+ 'currency' => $this->currency,
88
+ 'card_holder' => $this->card_holder,
89
+ 'card_number' => $this->card_number,
90
+ 'cvv' => $this->cvv,
91
+ 'expiration_month' => $this->expiration_month,
92
+ 'expiration_year' => $this->expiration_year,
93
+ 'customer_email' => $this->customer_email,
94
+ 'customer_phone' => $this->customer_phone,
95
+ 'birth_date' => $this->birth_date,
96
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
97
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
98
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale.php CHANGED
@@ -20,339 +20,35 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards\Recurring;
24
 
 
 
 
 
 
 
 
25
  /**
 
 
26
  * InitRecurringSale Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class InitRecurringSale extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a gaming transaction is performed.
49
- *
50
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $gaming;
55
-
56
- /**
57
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
58
- *
59
- * Contact tech support for more details.
60
- *
61
- * @var bool
62
- */
63
- protected $moto;
64
-
65
- /**
66
- * IPv4 address of customer
67
- *
68
- * @var string
69
- */
70
- protected $remote_ip;
71
-
72
- /**
73
- * Amount of transaction in minor currency unit
74
- *
75
- * @var int|float|double
76
- */
77
- protected $amount;
78
-
79
- /**
80
- * Currency code in ISO-4217
81
- *
82
- * @var string
83
- */
84
- protected $currency;
85
-
86
- /**
87
- * Full name of customer as printed on credit card (first name and last name at least)
88
- *
89
- * @var string
90
- */
91
- protected $card_holder;
92
-
93
- /**
94
- * Complete CC number of customer
95
- *
96
- * @var int
97
- */
98
- protected $card_number;
99
-
100
- /**
101
- * CVV of CC, requirement is based on terminal configuration
102
- *
103
- * @var int
104
- */
105
- protected $cvv;
106
-
107
- /**
108
- * Expiration month as printed on credit card
109
- *
110
- * @var string (mm)
111
- */
112
- protected $expiration_month;
113
-
114
- /**
115
- * Expiration year as printed on credit card
116
- *
117
- * @var string (yyyy)
118
- */
119
- protected $expiration_year;
120
-
121
- /**
122
- * Email address of the Customer
123
- *
124
- * @var string
125
- */
126
- protected $customer_email;
127
-
128
- /**
129
- * Phone number of the customer
130
- *
131
- * @var string
132
- */
133
- protected $customer_phone;
134
-
135
- /**
136
- *Customer's Billing Address: First name
137
- *
138
- * @var string
139
- */
140
- protected $billing_first_name;
141
-
142
- /**
143
- * Customer's Billing Address: Last name
144
- *
145
- * @var string
146
- */
147
- protected $billing_last_name;
148
-
149
- /**
150
- * Customer's Billing Address: Part 1
151
- *
152
- * @var string
153
- */
154
- protected $billing_address1;
155
-
156
- /**
157
- * Customer's Billing Address: Part 2
158
- * @var string
159
- */
160
- protected $billing_address2;
161
-
162
- /**
163
- * Customer's Billing Address: ZIP
164
- *
165
- * @var string
166
- */
167
- protected $billing_zip_code;
168
-
169
- /**
170
- * Customer's Billing Address: City
171
- *
172
- * @var string
173
- */
174
- protected $billing_city;
175
-
176
- /**
177
- * Customer's Billing Address: State
178
- *
179
- * format: ISO-3166-2
180
- *
181
- * @var string
182
- */
183
- protected $billing_state;
184
-
185
- /**
186
- * Customer's Billing Address: Country
187
- *
188
- * format: ISO-3166
189
- *
190
- * @var string
191
- */
192
- protected $billing_country;
193
 
194
  /**
195
- * Customer's Shipping Address: First name
196
- *
197
- * @var string
198
- */
199
- protected $shipping_first_name;
200
-
201
- /**
202
- * Customer's Shipping Address: Last name
203
- *
204
- * @var string
205
- */
206
- protected $shipping_last_name;
207
-
208
- /**
209
- * Customer's Shipping Address: Part 1
210
- *
211
- * @var string
212
- */
213
- protected $shipping_address1;
214
-
215
- /**
216
- * Customer's Shipping Address: Part 2
217
- *
218
- * @var string
219
- */
220
- protected $shipping_address2;
221
-
222
- /**
223
- * Customer's Shipping Address: ZIP
224
- *
225
- * @var string
226
- */
227
- protected $shipping_zip_code;
228
-
229
- /**
230
- * Customer's Shipping Address: City
231
- *
232
- * @var string
233
- */
234
- protected $shipping_city;
235
-
236
- /**
237
- * Customer's Shipping Address: State
238
- *
239
- * format: ISO-3166-2
240
- *
241
- * @var string
242
- */
243
- protected $shipping_state;
244
-
245
- /**
246
- * Customer's Shipping Address
247
- *
248
- * format: ISO-3166
249
- *
250
- * @var string
251
- */
252
- protected $shipping_country;
253
-
254
- /**
255
- * Social Security number or equivalent value for non US customers.
256
- *
257
- * @var string
258
- */
259
- protected $risk_ssn;
260
-
261
- /**
262
- * Customer's MAC address
263
- *
264
- * @var string
265
- */
266
- protected $risk_mac_address;
267
-
268
- /**
269
- * Customer's Session Id
270
- *
271
- * @var string
272
- */
273
- protected $risk_session_id;
274
-
275
- /**
276
- * Customer's User Id
277
- *
278
- * @var string
279
  */
280
- protected $risk_user_id;
281
-
282
- /**
283
- * Customer's User Level
284
- *
285
- * @var string
286
- */
287
- protected $risk_user_level;
288
-
289
- /**
290
- * Customer's Email address
291
- *
292
- * @note Set here if different from
293
- * shipping / billing
294
- *
295
- * @var string
296
- */
297
- protected $risk_email;
298
-
299
- /**
300
- * Customer's Phone number
301
- *
302
- * @note Set here if different from
303
- * shipping / billing
304
- *
305
- * @var string
306
- */
307
- protected $risk_phone;
308
-
309
- /**
310
- * Customer's IP address
311
- *
312
- * @note Set here if different from remote_ip
313
- *
314
- * @var string
315
- */
316
- protected $risk_remote_ip;
317
-
318
- /**
319
- * Customer's Serial Number
320
- *
321
- * @var string
322
- */
323
- protected $risk_serial_number;
324
-
325
- /**
326
- * Allows to dynamically override the charge descriptor
327
- *
328
- * @var string
329
- */
330
- protected $dynamic_merchant_name;
331
-
332
- /**
333
- * Allows to dynamically override the mer- chant phone number
334
- *
335
- * @var string
336
- */
337
- protected $dynamic_merchant_city;
338
-
339
- /**
340
- * Set the per-request configuration
341
- *
342
- * @return void
343
- */
344
- protected function initConfiguration()
345
  {
346
- $this->config = \Genesis\Utils\Common::createArrayObject(
347
- array(
348
- 'protocol' => 'https',
349
- 'port' => 443,
350
- 'type' => 'POST',
351
- 'format' => 'xml',
352
- )
353
- );
354
-
355
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
356
  }
357
 
358
  /**
@@ -362,87 +58,50 @@ class InitRecurringSale extends \Genesis\API\Request
362
  */
363
  protected function setRequiredFields()
364
  {
365
- $requiredFields = array(
366
  'transaction_id',
367
  'amount',
368
  'currency',
369
  'card_holder',
370
  'card_number',
371
  'expiration_month',
372
- 'expiration_year',
373
- );
374
 
375
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
376
  }
377
 
378
  /**
379
- * Create the request's Tree structure
380
- *
381
- * @return void
382
  */
383
- protected function populateStructure()
384
  {
385
- $treeStructure = array(
386
- 'payment_transaction' => array(
387
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE,
388
- 'transaction_id' => $this->transaction_id,
389
- 'usage' => $this->usage,
390
- 'gaming' => $this->gaming,
391
- 'moto' => $this->moto,
392
- 'remote_ip' => $this->remote_ip,
393
- 'amount' => $this->transform(
394
- 'amount',
395
- array(
396
- $this->amount,
397
- $this->currency,
398
- )
399
- ),
400
- 'currency' => $this->currency,
401
- 'card_holder' => $this->card_holder,
402
- 'card_number' => $this->card_number,
403
- 'cvv' => $this->cvv,
404
- 'expiration_month' => $this->expiration_month,
405
- 'expiration_year' => $this->expiration_year,
406
- 'customer_email' => $this->customer_email,
407
- 'customer_phone' => $this->customer_phone,
408
- 'billing_address' => array(
409
- 'first_name' => $this->billing_first_name,
410
- 'last_name' => $this->billing_last_name,
411
- 'address1' => $this->billing_address1,
412
- 'address2' => $this->billing_address2,
413
- 'zip_code' => $this->billing_zip_code,
414
- 'city' => $this->billing_city,
415
- 'state' => $this->billing_state,
416
- 'country' => $this->billing_country,
417
- ),
418
- 'shipping_address' => array(
419
- 'first_name' => $this->shipping_first_name,
420
- 'last_name' => $this->shipping_last_name,
421
- 'address1' => $this->shipping_address1,
422
- 'address2' => $this->shipping_address2,
423
- 'zip_code' => $this->shipping_zip_code,
424
- 'city' => $this->shipping_city,
425
- 'state' => $this->shipping_state,
426
- 'country' => $this->shipping_country,
427
- ),
428
- 'risk_params' => array(
429
- 'ssn' => $this->risk_ssn,
430
- 'mac_address' => $this->risk_mac_address,
431
- 'session_id' => $this->risk_session_id,
432
- 'user_id' => $this->risk_user_id,
433
- 'user_level' => $this->risk_user_level,
434
- 'email' => $this->risk_email,
435
- 'phone' => $this->risk_phone,
436
- 'remote_ip' => $this->risk_remote_ip,
437
- 'serial_number' => $this->risk_serial_number,
438
- ),
439
- 'dynamic_descriptor_params' => array(
440
- 'merchant_name' => $this->dynamic_merchant_name,
441
- 'merchant_city' => $this->dynamic_merchant_city,
442
- )
443
- )
444
- );
445
-
446
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
447
  }
448
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards\Recurring;
25
 
26
+ use Genesis\API\Traits\Request\MotoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+ use Genesis\API\Traits\Request\CreditCardAttributes;
29
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
30
+ use Genesis\API\Traits\Request\RiskAttributes;
31
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
32
+
33
  /**
34
+ * Class InitRecurringSale
35
+ *
36
  * InitRecurringSale Request
37
  *
38
+ * @package Genesis\API\Request\Financial\Cards\Recurring
 
39
  */
40
+ class InitRecurringSale extends \Genesis\API\Request\Base\Financial
41
  {
42
+ use MotoAttributes, PaymentAttributes, CreditCardAttributes,
43
+ AddressInfoAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  /**
46
+ * Returns the Request transaction type
47
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  */
49
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  {
51
+ return \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE;
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  /**
58
  */
59
  protected function setRequiredFields()
60
  {
61
+ $requiredFields = [
62
  'transaction_id',
63
  'amount',
64
  'currency',
65
  'card_holder',
66
  'card_number',
67
  'expiration_month',
68
+ 'expiration_year'
69
+ ];
70
 
71
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
72
+
73
+ $requiredFieldValues = array_merge(
74
+ [
75
+ 'currency' => \Genesis\Utils\Currency::getList()
76
+ ],
77
+ $this->getCCFieldValueFormatValidators()
78
+ );
79
+
80
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
81
  }
82
 
83
  /**
84
+ * Return additional request attributes
85
+ * @return array
 
86
  */
87
+ protected function getPaymentTransactionStructure()
88
  {
89
+ return [
90
+ 'moto' => $this->moto,
91
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
92
+ 'currency' => $this->currency,
93
+ 'card_holder' => $this->card_holder,
94
+ 'card_number' => $this->card_number,
95
+ 'cvv' => $this->cvv,
96
+ 'expiration_month' => $this->expiration_month,
97
+ 'expiration_year' => $this->expiration_year,
98
+ 'customer_email' => $this->customer_email,
99
+ 'customer_phone' => $this->customer_phone,
100
+ 'birth_date' => $this->birth_date,
101
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
102
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
103
+ 'risk_params' => $this->getRiskParamsStructure(),
104
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
105
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/InitRecurringSale3D.php CHANGED
@@ -20,382 +20,39 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards\Recurring;
24
 
 
 
 
 
 
 
 
 
 
 
25
  /**
 
 
26
  * InitRecurringSale 3D Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class InitRecurringSale3D extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a gaming transaction is performed.
49
- *
50
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $gaming;
55
-
56
- /**
57
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
58
- *
59
- * Contact tech support for more details.
60
- *
61
- * @var bool
62
- */
63
- protected $moto;
64
-
65
- /**
66
- * IPv4 address of customer
67
- *
68
- * @var string
69
- */
70
- protected $remote_ip;
71
-
72
- /**
73
- * URL endpoint for Genesis Notifications
74
- *
75
- * @var string
76
- */
77
- protected $notification_url;
78
-
79
- /**
80
- * URL where customer is sent to after successful payment
81
- *
82
- * @var string
83
- */
84
- protected $return_success_url;
85
-
86
- /**
87
- * URL where customer is sent to after un-successful payment
88
- *
89
- * @var string
90
- */
91
- protected $return_failure_url;
92
-
93
- /**
94
- * Amount of transaction in minor currency unit
95
- *
96
- * @var int|float|double
97
- */
98
- protected $amount;
99
-
100
- /**
101
- * Currency code in ISO-4217
102
- *
103
- * @var string
104
- */
105
- protected $currency;
106
-
107
- /**
108
- * Full name of customer as printed on credit card (first name and last name at least)
109
- *
110
- * @var string
111
- */
112
- protected $card_holder;
113
-
114
- /**
115
- * Complete CC number of customer
116
- *
117
- * @var int
118
- */
119
- protected $card_number;
120
-
121
- /**
122
- * CVV of CC, requirement is based on terminal configuration
123
- *
124
- * @var int
125
- */
126
- protected $cvv;
127
-
128
- /**
129
- * Expiration month as printed on credit card
130
- *
131
- * @var string (mm)
132
- */
133
- protected $expiration_month;
134
-
135
- /**
136
- * Expiration year as printed on credit card
137
- *
138
- * @var string (yyyy)
139
- */
140
- protected $expiration_year;
141
-
142
- /**
143
- * Email address of the Customer
144
- *
145
- * @var string
146
- */
147
- protected $customer_email;
148
-
149
- /**
150
- * Phone number of the customer
151
- *
152
- * @var string
153
- */
154
- protected $customer_phone;
155
-
156
- /**
157
- *Customer's Billing Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $billing_first_name;
162
-
163
- /**
164
- * Customer's Billing Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $billing_last_name;
169
-
170
- /**
171
- * Customer's Billing Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $billing_address1;
176
-
177
- /**
178
- * Customer's Billing Address: Part 2
179
- * @var string
180
- */
181
- protected $billing_address2;
182
-
183
- /**
184
- * Customer's Billing Address: ZIP
185
- *
186
- * @var string
187
- */
188
- protected $billing_zip_code;
189
-
190
- /**
191
- * Customer's Billing Address: City
192
- *
193
- * @var string
194
- */
195
- protected $billing_city;
196
-
197
- /**
198
- * Customer's Billing Address: State
199
- *
200
- * format: ISO-3166-2
201
- *
202
- * @var string
203
- */
204
- protected $billing_state;
205
-
206
- /**
207
- * Customer's Billing Address: Country
208
- *
209
- * format: ISO-3166
210
- *
211
- * @var string
212
- */
213
- protected $billing_country;
214
 
215
  /**
216
- * Customer's Shipping Address: First name
217
- *
218
- * @var string
219
- */
220
- protected $shipping_first_name;
221
-
222
- /**
223
- * Customer's Shipping Address: Last name
224
- *
225
- * @var string
226
- */
227
- protected $shipping_last_name;
228
-
229
- /**
230
- * Customer's Shipping Address: Part 1
231
- *
232
- * @var string
233
  */
234
- protected $shipping_address1;
235
-
236
- /**
237
- * Customer's Shipping Address: Part 2
238
- *
239
- * @var string
240
- */
241
- protected $shipping_address2;
242
-
243
- /**
244
- * Customer's Shipping Address: ZIP
245
- *
246
- * @var string
247
- */
248
- protected $shipping_zip_code;
249
-
250
- /**
251
- * Customer's Shipping Address: City
252
- *
253
- * @var string
254
- */
255
- protected $shipping_city;
256
-
257
- /**
258
- * Customer's Shipping Address: State
259
- *
260
- * format: ISO-3166-2
261
- *
262
- * @var string
263
- */
264
- protected $shipping_state;
265
-
266
- /**
267
- * Customer's Shipping Address
268
- *
269
- * format: ISO-3166
270
- *
271
- * @var string
272
- */
273
- protected $shipping_country;
274
-
275
- /**
276
- * Social Security number or equivalent value for non US customers.
277
- *
278
- * @var string
279
- */
280
- protected $risk_ssn;
281
-
282
- /**
283
- * Customer's MAC address
284
- *
285
- * @var string
286
- */
287
- protected $risk_mac_address;
288
-
289
- /**
290
- * Customer's Session Id
291
- *
292
- * @var string
293
- */
294
- protected $risk_session_id;
295
-
296
- /**
297
- * Customer's User Id
298
- *
299
- * @var string
300
- */
301
- protected $risk_user_id;
302
-
303
- /**
304
- * Customer's User Level
305
- *
306
- * @var string
307
- */
308
- protected $risk_user_level;
309
-
310
- /**
311
- * Customer's Email address
312
- *
313
- * @note Set here if different from
314
- * shipping / billing
315
- *
316
- * @var string
317
- */
318
- protected $risk_email;
319
-
320
- /**
321
- * Customer's Phone number
322
- *
323
- * @note Set here if different from
324
- * shipping / billing
325
- *
326
- * @var string
327
- */
328
- protected $risk_phone;
329
-
330
- /**
331
- * Customer's IP address
332
- *
333
- * @note Set here if different from remote_ip
334
- *
335
- * @var string
336
- */
337
- protected $risk_remote_ip;
338
-
339
- /**
340
- * Customer's Serial Number
341
- *
342
- * @var string
343
- */
344
- protected $risk_serial_number;
345
-
346
- /**
347
- * Verification Id of the authentication.
348
- *
349
- * Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
350
- *
351
- * @var string
352
- */
353
- protected $mpi_cavv;
354
-
355
- /**
356
- * Electric Commerce Indicator as returned from the MPI.
357
- *
358
- * @var string
359
- */
360
- protected $mpi_eci;
361
-
362
- /**
363
- * Transaction ID generated by the 3D Secure service
364
- * that uniquely identifies a 3D Secure check request
365
- *
366
- * @var string
367
- */
368
- protected $mpi_xid;
369
-
370
- /**
371
- * Allows to dynamically override the charge descriptor
372
- *
373
- * @var string
374
- */
375
- protected $dynamic_merchant_name;
376
-
377
- /**
378
- * Allows to dynamically override the mer- chant phone number
379
- *
380
- * @var string
381
- */
382
- protected $dynamic_merchant_city;
383
-
384
- /**
385
- * Set the per-request configuration
386
- *
387
- * @return void
388
- */
389
- protected function initConfiguration()
390
  {
391
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
392
- 'protocol' => 'https',
393
- 'port' => 443,
394
- 'type' => 'POST',
395
- 'format' => 'xml',
396
- ));
397
-
398
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
399
  }
400
 
401
  /**
@@ -405,110 +62,69 @@ class InitRecurringSale3D extends \Genesis\API\Request
405
  */
406
  protected function setRequiredFields()
407
  {
408
- $requiredFields = array(
409
  'transaction_id',
410
  'amount',
411
  'currency',
412
  'card_holder',
413
  'card_number',
414
  'expiration_month',
415
- 'expiration_year',
416
- );
417
 
418
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
419
 
420
- $requiredFieldsConditional = array(
421
- 'notification_url' => array('return_success_url', 'return_failure_url'),
422
- 'return_success_url' => array('notification_url', 'return_failure_url'),
423
- 'return_failure_url' => array('notification_url', 'return_success_url'),
 
424
  );
425
 
 
 
 
 
 
 
 
 
426
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
427
 
428
- $requiredFieldsGroups = array(
429
- 'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
430
- 'asynchronous' => array('mpi_eci'),
431
- );
432
 
433
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
434
  }
435
 
436
  /**
437
- * Create the request's Tree structure
438
- *
439
- * @return void
440
  */
441
- protected function populateStructure()
442
  {
443
- $treeStructure = array(
444
- 'payment_transaction' => array(
445
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D,
446
- 'transaction_id' => $this->transaction_id,
447
- 'usage' => $this->usage,
448
- 'gaming' => $this->gaming,
449
- 'moto' => $this->moto,
450
- 'remote_ip' => $this->remote_ip,
451
- 'notification_url' => $this->notification_url,
452
- 'return_success_url' => $this->return_success_url,
453
- 'return_failure_url' => $this->return_failure_url,
454
- 'amount' => $this->transform(
455
- 'amount',
456
- array(
457
- $this->amount,
458
- $this->currency,
459
- )
460
- ),
461
- 'currency' => $this->currency,
462
- 'card_holder' => $this->card_holder,
463
- 'card_number' => $this->card_number,
464
- 'cvv' => $this->cvv,
465
- 'expiration_month' => $this->expiration_month,
466
- 'expiration_year' => $this->expiration_year,
467
- 'customer_email' => $this->customer_email,
468
- 'customer_phone' => $this->customer_phone,
469
- 'billing_address' => array(
470
- 'first_name' => $this->billing_first_name,
471
- 'last_name' => $this->billing_last_name,
472
- 'address1' => $this->billing_address1,
473
- 'address2' => $this->billing_address2,
474
- 'zip_code' => $this->billing_zip_code,
475
- 'city' => $this->billing_city,
476
- 'state' => $this->billing_state,
477
- 'country' => $this->billing_country,
478
- ),
479
- 'shipping_address' => array(
480
- 'first_name' => $this->shipping_first_name,
481
- 'last_name' => $this->shipping_last_name,
482
- 'address1' => $this->shipping_address1,
483
- 'address2' => $this->shipping_address2,
484
- 'zip_code' => $this->shipping_zip_code,
485
- 'city' => $this->shipping_city,
486
- 'state' => $this->shipping_state,
487
- 'country' => $this->shipping_country,
488
- ),
489
- 'mpi_params' => array(
490
- 'cavv' => $this->mpi_cavv,
491
- 'eci' => $this->mpi_eci,
492
- 'xid' => $this->mpi_xid,
493
- ),
494
- 'risk_params' => array(
495
- 'ssn' => $this->risk_ssn,
496
- 'mac_address' => $this->risk_mac_address,
497
- 'session_id' => $this->risk_session_id,
498
- 'user_id' => $this->risk_user_id,
499
- 'user_level' => $this->risk_user_level,
500
- 'email' => $this->risk_email,
501
- 'phone' => $this->risk_phone,
502
- 'remote_ip' => $this->risk_remote_ip,
503
- 'serial_number' => $this->risk_serial_number,
504
- ),
505
- 'dynamic_descriptor_params' => array(
506
- 'merchant_name' => $this->dynamic_merchant_name,
507
- 'merchant_city' => $this->dynamic_merchant_city,
508
- )
509
- )
510
- );
511
-
512
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
513
  }
514
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards\Recurring;
25
 
26
+ use Genesis\API\Traits\Request\MotoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
28
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
29
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
30
+ use Genesis\API\Traits\Request\CreditCardAttributes;
31
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
32
+ use Genesis\API\Traits\Request\Financial\MpiAttributes;
33
+ use Genesis\API\Traits\Request\RiskAttributes;
34
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
35
+
36
  /**
37
+ * Class InitRecurringSale3D
38
+ *
39
  * InitRecurringSale 3D Request
40
  *
41
+ * @package Genesis\API\Request\Financial\Cards\Recurring
 
42
  */
43
+ class InitRecurringSale3D extends \Genesis\API\Request\Base\Financial
44
  {
45
+ use MotoAttributes, NotificationAttributes, AsyncAttributes,
46
+ PaymentAttributes, CreditCardAttributes, AddressInfoAttributes,
47
+ MpiAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  /**
50
+ * Returns the Request transaction type
51
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  */
53
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  {
55
+ return \Genesis\API\Constants\Transaction\Types::INIT_RECURRING_SALE_3D;
 
 
 
 
 
 
 
56
  }
57
 
58
  /**
62
  */
63
  protected function setRequiredFields()
64
  {
65
+ $requiredFields = [
66
  'transaction_id',
67
  'amount',
68
  'currency',
69
  'card_holder',
70
  'card_number',
71
  'expiration_month',
72
+ 'expiration_year'
73
+ ];
74
 
75
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
76
 
77
+ $requiredFieldValues = array_merge(
78
+ [
79
+ 'currency' => \Genesis\Utils\Currency::getList()
80
+ ],
81
+ $this->getCCFieldValueFormatValidators()
82
  );
83
 
84
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
85
+
86
+ $requiredFieldsConditional = [
87
+ 'notification_url' => ['return_success_url', 'return_failure_url'],
88
+ 'return_success_url' => ['notification_url', 'return_failure_url'],
89
+ 'return_failure_url' => ['notification_url', 'return_success_url']
90
+ ];
91
+
92
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
93
 
94
+ $requiredFieldsGroups = [
95
+ 'synchronous' => ['notification_url', 'return_success_url', 'return_failure_url'],
96
+ 'asynchronous' => ['mpi_eci']
97
+ ];
98
 
99
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
100
  }
101
 
102
  /**
103
+ * Return additional request attributes
104
+ * @return array
 
105
  */
106
+ protected function getPaymentTransactionStructure()
107
  {
108
+ return [
109
+ 'moto' => $this->moto,
110
+ 'notification_url' => $this->notification_url,
111
+ 'return_success_url' => $this->return_success_url,
112
+ 'return_failure_url' => $this->return_failure_url,
113
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
114
+ 'currency' => $this->currency,
115
+ 'card_holder' => $this->card_holder,
116
+ 'card_number' => $this->card_number,
117
+ 'cvv' => $this->cvv,
118
+ 'expiration_month' => $this->expiration_month,
119
+ 'expiration_year' => $this->expiration_year,
120
+ 'customer_email' => $this->customer_email,
121
+ 'customer_phone' => $this->customer_phone,
122
+ 'birth_date' => $this->birth_date,
123
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
124
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
125
+ 'mpi_params' => $this->getMpiParamsStructure(),
126
+ 'risk_params' => $this->getRiskParamsStructure(),
127
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
128
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Recurring/RecurringSale.php CHANGED
@@ -20,119 +20,24 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards\Recurring;
24
 
25
  /**
 
 
26
  * Recurring Sale Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class RecurringSale extends \Genesis\API\Request
32
  {
33
  /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Amount of transaction in minor currency unit
56
- *
57
- * @var int|float|double
58
- */
59
- protected $amount;
60
-
61
- /**
62
- * Currency code in ISO-4217
63
- *
64
- * @var string
65
- */
66
- protected $currency;
67
-
68
- /**
69
- * Unique id of the existing (target) transaction
70
- *
71
- * @var string
72
  */
73
- protected $reference_id;
74
-
75
- /**
76
- * Set the per-request configuration
77
- *
78
- * @return void
79
- */
80
- protected function initConfiguration()
81
- {
82
- $this->config = \Genesis\Utils\Common::createArrayObject(
83
- array(
84
- 'protocol' => 'https',
85
- 'port' => 443,
86
- 'type' => 'POST',
87
- 'format' => 'xml',
88
- )
89
- );
90
-
91
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
92
- }
93
-
94
- /**
95
- * Set the required fields
96
- *
97
- * @return void
98
- */
99
- protected function setRequiredFields()
100
- {
101
- $requiredFields = array(
102
- 'transaction_id',
103
- 'reference_id',
104
- 'amount',
105
- 'currency'
106
- );
107
-
108
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
109
- }
110
-
111
- /**
112
- * Create the request's Tree structure
113
- *
114
- * @return void
115
- */
116
- protected function populateStructure()
117
  {
118
- $treeStructure = array(
119
- 'payment_transaction' => array(
120
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::RECURRING_SALE,
121
- 'transaction_id' => $this->transaction_id,
122
- 'usage' => $this->usage,
123
- 'remote_ip' => $this->remote_ip,
124
- 'reference_id' => $this->reference_id,
125
- 'amount' => $this->transform(
126
- 'amount',
127
- array(
128
- $this->amount,
129
- $this->currency,
130
- )
131
- ),
132
- 'currency' => $this->currency
133
- )
134
- );
135
-
136
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
137
  }
138
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards\Recurring;
25
 
26
  /**
27
+ * Class RecurringSale
28
+ *
29
  * Recurring Sale Request
30
  *
31
+ * @package Genesis\API\Request\Financial\Cards\Recurring
 
32
  */
33
+ class RecurringSale extends \Genesis\API\Request\Base\Financial\Reference
34
  {
35
  /**
36
+ * Returns the Request transaction type
37
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  {
41
+ return \Genesis\API\Constants\Transaction\Types::RECURRING_SALE;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale.php CHANGED
@@ -20,339 +20,36 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
 
 
 
 
 
 
 
 
25
  /**
 
 
26
  * Sale Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Sale extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a gaming transaction is performed.
49
- *
50
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $gaming;
55
-
56
- /**
57
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
58
- *
59
- * Contact tech support for more details.
60
- *
61
- * @var bool
62
- */
63
- protected $moto;
64
-
65
- /**
66
- * IPv4 address of customer
67
- *
68
- * @var string
69
- */
70
- protected $remote_ip;
71
-
72
- /**
73
- * Amount of transaction in minor currency unit
74
- *
75
- * @var int|float|double
76
- */
77
- protected $amount;
78
-
79
- /**
80
- * Currency code in ISO-4217
81
- *
82
- * @var string
83
- */
84
- protected $currency;
85
-
86
- /**
87
- * Full name of customer as printed on credit card (first name and last name at least)
88
- *
89
- * @var string
90
- */
91
- protected $card_holder;
92
-
93
- /**
94
- * Complete CC number of customer
95
- *
96
- * @var int
97
- */
98
- protected $card_number;
99
-
100
- /**
101
- * CVV of CC, requirement is based on terminal configuration
102
- *
103
- * @var int
104
- */
105
- protected $cvv;
106
-
107
- /**
108
- * Expiration month as printed on credit card
109
- *
110
- * @var string (mm)
111
- */
112
- protected $expiration_month;
113
-
114
- /**
115
- * Expiration year as printed on credit card
116
- *
117
- * @var string (yyyy)
118
- */
119
- protected $expiration_year;
120
-
121
- /**
122
- * Email address of the Customer
123
- *
124
- * @var string
125
- */
126
- protected $customer_email;
127
-
128
- /**
129
- * Phone number of the customer
130
- *
131
- * @var string
132
- */
133
- protected $customer_phone;
134
-
135
- /**
136
- *Customer's Billing Address: First name
137
- *
138
- * @var string
139
- */
140
- protected $billing_first_name;
141
-
142
- /**
143
- * Customer's Billing Address: Last name
144
- *
145
- * @var string
146
- */
147
- protected $billing_last_name;
148
-
149
- /**
150
- * Customer's Billing Address: Part 1
151
- *
152
- * @var string
153
- */
154
- protected $billing_address1;
155
-
156
- /**
157
- * Customer's Billing Address: Part 2
158
- * @var string
159
- */
160
- protected $billing_address2;
161
-
162
- /**
163
- * Customer's Billing Address: ZIP
164
- *
165
- * @var string
166
- */
167
- protected $billing_zip_code;
168
-
169
- /**
170
- * Customer's Billing Address: City
171
- *
172
- * @var string
173
- */
174
- protected $billing_city;
175
-
176
- /**
177
- * Customer's Billing Address: State
178
- *
179
- * format: ISO-3166-2
180
- *
181
- * @var string
182
- */
183
- protected $billing_state;
184
-
185
- /**
186
- * Customer's Billing Address: Country
187
- *
188
- * format: ISO-3166
189
- *
190
- * @var string
191
- */
192
- protected $billing_country;
193
 
194
  /**
195
- * Customer's Shipping Address: First name
196
- *
197
- * @var string
198
- */
199
- protected $shipping_first_name;
200
-
201
- /**
202
- * Customer's Shipping Address: Last name
203
- *
204
- * @var string
205
- */
206
- protected $shipping_last_name;
207
-
208
- /**
209
- * Customer's Shipping Address: Part 1
210
- *
211
- * @var string
212
- */
213
- protected $shipping_address1;
214
-
215
- /**
216
- * Customer's Shipping Address: Part 2
217
- *
218
- * @var string
219
- */
220
- protected $shipping_address2;
221
-
222
- /**
223
- * Customer's Shipping Address: ZIP
224
- *
225
- * @var string
226
- */
227
- protected $shipping_zip_code;
228
-
229
- /**
230
- * Customer's Shipping Address: City
231
- *
232
- * @var string
233
- */
234
- protected $shipping_city;
235
-
236
- /**
237
- * Customer's Shipping Address: State
238
- *
239
- * format: ISO-3166-2
240
- *
241
- * @var string
242
- */
243
- protected $shipping_state;
244
-
245
- /**
246
- * Customer's Shipping Address
247
- *
248
- * format: ISO-3166
249
- *
250
- * @var string
251
- */
252
- protected $shipping_country;
253
-
254
- /**
255
- * Social Security number or equivalent value for non US customers.
256
- *
257
- * @var string
258
- */
259
- protected $risk_ssn;
260
-
261
- /**
262
- * Customer's MAC address
263
- *
264
- * @var string
265
- */
266
- protected $risk_mac_address;
267
-
268
- /**
269
- * Customer's Session Id
270
- *
271
- * @var string
272
- */
273
- protected $risk_session_id;
274
-
275
- /**
276
- * Customer's User Id
277
- *
278
- * @var string
279
  */
280
- protected $risk_user_id;
281
-
282
- /**
283
- * Customer's User Level
284
- *
285
- * @var string
286
- */
287
- protected $risk_user_level;
288
-
289
- /**
290
- * Customer's Email address
291
- *
292
- * @note Set here if different from
293
- * shipping / billing
294
- *
295
- * @var string
296
- */
297
- protected $risk_email;
298
-
299
- /**
300
- * Customer's Phone number
301
- *
302
- * @note Set here if different from
303
- * shipping / billing
304
- *
305
- * @var string
306
- */
307
- protected $risk_phone;
308
-
309
- /**
310
- * Customer's IP address
311
- *
312
- * @note Set here if different from remote_ip
313
- *
314
- * @var string
315
- */
316
- protected $risk_remote_ip;
317
-
318
- /**
319
- * Customer's Serial Number
320
- *
321
- * @var string
322
- */
323
- protected $risk_serial_number;
324
-
325
- /**
326
- * Allows to dynamically override the charge descriptor
327
- *
328
- * @var string
329
- */
330
- protected $dynamic_merchant_name;
331
-
332
- /**
333
- * Allows to dynamically override the mer- chant phone number
334
- *
335
- * @var string
336
- */
337
- protected $dynamic_merchant_city;
338
-
339
- /**
340
- * Set the per-request configuration
341
- *
342
- * @return void
343
- */
344
- protected function initConfiguration()
345
  {
346
- $this->config = \Genesis\Utils\Common::createArrayObject(
347
- array(
348
- 'protocol' => 'https',
349
- 'port' => 443,
350
- 'type' => 'POST',
351
- 'format' => 'xml',
352
- )
353
- );
354
-
355
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
356
  }
357
 
358
  /**
@@ -362,87 +59,51 @@ class Sale extends \Genesis\API\Request
362
  */
363
  protected function setRequiredFields()
364
  {
365
- $requiredFields = array(
366
  'transaction_id',
367
  'amount',
368
  'currency',
369
  'card_holder',
370
- 'card_number',
371
  'expiration_month',
372
  'expiration_year',
373
- );
 
374
 
375
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
376
  }
377
 
378
  /**
379
- * Create the request's Tree structure
380
- *
381
- * @return void
382
  */
383
- protected function populateStructure()
384
  {
385
- $treeStructure = array(
386
- 'payment_transaction' => array(
387
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::SALE,
388
- 'transaction_id' => $this->transaction_id,
389
- 'usage' => $this->usage,
390
- 'gaming' => $this->gaming,
391
- 'moto' => $this->moto,
392
- 'remote_ip' => $this->remote_ip,
393
- 'amount' => $this->transform(
394
- 'amount',
395
- array(
396
- $this->amount,
397
- $this->currency,
398
- )
399
- ),
400
- 'currency' => $this->currency,
401
- 'card_holder' => $this->card_holder,
402
- 'card_number' => $this->card_number,
403
- 'cvv' => $this->cvv,
404
- 'expiration_month' => $this->expiration_month,
405
- 'expiration_year' => $this->expiration_year,
406
- 'customer_email' => $this->customer_email,
407
- 'customer_phone' => $this->customer_phone,
408
- 'billing_address' => array(
409
- 'first_name' => $this->billing_first_name,
410
- 'last_name' => $this->billing_last_name,
411
- 'address1' => $this->billing_address1,
412
- 'address2' => $this->billing_address2,
413
- 'zip_code' => $this->billing_zip_code,
414
- 'city' => $this->billing_city,
415
- 'state' => $this->billing_state,
416
- 'country' => $this->billing_country,
417
- ),
418
- 'shipping_address' => array(
419
- 'first_name' => $this->shipping_first_name,
420
- 'last_name' => $this->shipping_last_name,
421
- 'address1' => $this->shipping_address1,
422
- 'address2' => $this->shipping_address2,
423
- 'zip_code' => $this->shipping_zip_code,
424
- 'city' => $this->shipping_city,
425
- 'state' => $this->shipping_state,
426
- 'country' => $this->shipping_country,
427
- ),
428
- 'risk_params' => array(
429
- 'ssn' => $this->risk_ssn,
430
- 'mac_address' => $this->risk_mac_address,
431
- 'session_id' => $this->risk_session_id,
432
- 'user_id' => $this->risk_user_id,
433
- 'user_level' => $this->risk_user_level,
434
- 'email' => $this->risk_email,
435
- 'phone' => $this->risk_phone,
436
- 'remote_ip' => $this->risk_remote_ip,
437
- 'serial_number' => $this->risk_serial_number,
438
- ),
439
- 'dynamic_descriptor_params' => array(
440
- 'merchant_name' => $this->dynamic_merchant_name,
441
- 'merchant_city' => $this->dynamic_merchant_city,
442
- )
443
- )
444
- );
445
-
446
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
447
  }
448
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards;
25
 
26
+ use Genesis\API\Traits\Request\Financial\GamingAttributes;
27
+ use Genesis\API\Traits\Request\MotoAttributes;
28
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
29
+ use Genesis\API\Traits\Request\CreditCardAttributes;
30
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
31
+ use Genesis\API\Traits\Request\RiskAttributes;
32
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
33
+
34
  /**
35
+ * Class Sale
36
+ *
37
  * Sale Request
38
  *
39
+ * @package Genesis\API\Request\Financial\Cards
 
40
  */
41
+ class Sale extends \Genesis\API\Request\Base\Financial
42
  {
43
+ use GamingAttributes, MotoAttributes, PaymentAttributes, CreditCardAttributes,
44
+ AddressInfoAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  /**
47
+ * Returns the Request transaction type
48
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  */
50
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
+ return \Genesis\API\Constants\Transaction\Types::SALE;
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
59
  */
60
  protected function setRequiredFields()
61
  {
62
+ $requiredFields = [
63
  'transaction_id',
64
  'amount',
65
  'currency',
66
  'card_holder',
 
67
  'expiration_month',
68
  'expiration_year',
69
+ 'card_number'
70
+ ];
71
 
72
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
73
+
74
+ $requiredFieldValues = array_merge(
75
+ [
76
+ 'currency' => \Genesis\Utils\Currency::getList()
77
+ ],
78
+ $this->getCCFieldValueFormatValidators()
79
+ );
80
+
81
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
82
  }
83
 
84
  /**
85
+ * Return additional request attributes
86
+ * @return array
 
87
  */
88
+ protected function getPaymentTransactionStructure()
89
  {
90
+ return [
91
+ 'gaming' => $this->gaming,
92
+ 'moto' => $this->moto,
93
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
94
+ 'currency' => $this->currency,
95
+ 'card_holder' => $this->card_holder,
96
+ 'card_number' => $this->card_number,
97
+ 'cvv' => $this->cvv,
98
+ 'expiration_month' => $this->expiration_month,
99
+ 'expiration_year' => $this->expiration_year,
100
+ 'customer_email' => $this->customer_email,
101
+ 'customer_phone' => $this->customer_phone,
102
+ 'birth_date' => $this->birth_date,
103
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
104
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
105
+ 'risk_params' => $this->getRiskParamsStructure(),
106
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
107
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
  }
lib/Genesis/src/Genesis/API/Request/Financial/Cards/Sale3D.php CHANGED
@@ -20,382 +20,40 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Cards;
24
 
 
 
 
 
 
 
 
 
 
 
 
25
  /**
 
 
26
  * Sale 3D Request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
30
  */
31
- class Sale3D extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a gaming transaction is performed.
49
- *
50
- * Gaming transactions usually use MCC 7995, contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $gaming;
55
-
56
- /**
57
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
58
- *
59
- * Contact tech support for more details.
60
- *
61
- * @var bool
62
- */
63
- protected $moto;
64
-
65
- /**
66
- * IPv4 address of customer
67
- *
68
- * @var string
69
- */
70
- protected $remote_ip;
71
-
72
- /**
73
- * URL endpoint for Genesis Notifications
74
- *
75
- * @var string
76
- */
77
- protected $notification_url;
78
-
79
- /**
80
- * URL where customer is sent to after successful payment
81
- *
82
- * @var string
83
- */
84
- protected $return_success_url;
85
-
86
- /**
87
- * URL where customer is sent to after un-successful payment
88
- *
89
- * @var string
90
- */
91
- protected $return_failure_url;
92
-
93
- /**
94
- * Amount of transaction in minor currency unit
95
- *
96
- * @var int|float|double
97
- */
98
- protected $amount;
99
-
100
- /**
101
- * Currency code in ISO-4217
102
- *
103
- * @var string
104
- */
105
- protected $currency;
106
-
107
- /**
108
- * Full name of customer as printed on credit card (first name and last name at least)
109
- *
110
- * @var string
111
- */
112
- protected $card_holder;
113
-
114
- /**
115
- * Complete CC number of customer
116
- *
117
- * @var int
118
- */
119
- protected $card_number;
120
-
121
- /**
122
- * CVV of CC, requirement is based on terminal configuration
123
- *
124
- * @var int
125
- */
126
- protected $cvv;
127
-
128
- /**
129
- * Expiration month as printed on credit card
130
- *
131
- * @var string (mm)
132
- */
133
- protected $expiration_month;
134
-
135
- /**
136
- * Expiration year as printed on credit card
137
- *
138
- * @var string (yyyy)
139
- */
140
- protected $expiration_year;
141
-
142
- /**
143
- * Email address of the Customer
144
- *
145
- * @var string
146
- */
147
- protected $customer_email;
148
-
149
- /**
150
- * Phone number of the customer
151
- *
152
- * @var string
153
- */
154
- protected $customer_phone;
155
-
156
- /**
157
- *Customer's Billing Address: First name
158
- *
159
- * @var string
160
- */
161
- protected $billing_first_name;
162
-
163
- /**
164
- * Customer's Billing Address: Last name
165
- *
166
- * @var string
167
- */
168
- protected $billing_last_name;
169
-
170
- /**
171
- * Customer's Billing Address: Part 1
172
- *
173
- * @var string
174
- */
175
- protected $billing_address1;
176
-
177
- /**
178
- * Customer's Billing Address: Part 2
179
- * @var string
180
- */
181
- protected $billing_address2;
182
-
183
- /**
184
- * Customer's Billing Address: ZIP
185
- *
186
- * @var string
187
- */
188
- protected $billing_zip_code;
189
-
190
- /**
191
- * Customer's Billing Address: City
192
- *
193
- * @var string
194
- */
195
- protected $billing_city;
196
-
197
- /**
198
- * Customer's Billing Address: State
199
- *
200
- * format: ISO-3166-2
201
- *
202
- * @var string
203
- */
204
- protected $billing_state;
205
-
206
- /**
207
- * Customer's Billing Address: Country
208
- *
209
- * format: ISO-3166
210
- *
211
- * @var string
212
- */
213
- protected $billing_country;
214
 
215
  /**
216
- * Customer's Shipping Address: First name
217
- *
218
- * @var string
219
- */
220
- protected $shipping_first_name;
221
-
222
- /**
223
- * Customer's Shipping Address: Last name
224
- *
225
- * @var string
226
- */
227
- protected $shipping_last_name;
228
-
229
- /**
230
- * Customer's Shipping Address: Part 1
231
- *
232
- * @var string
233
  */
234
- protected $shipping_address1;
235
-
236
- /**
237
- * Customer's Shipping Address: Part 2
238
- *
239
- * @var string
240
- */
241
- protected $shipping_address2;
242
-
243
- /**
244
- * Customer's Shipping Address: ZIP
245
- *
246
- * @var string
247
- */
248
- protected $shipping_zip_code;
249
-
250
- /**
251
- * Customer's Shipping Address: City
252
- *
253
- * @var string
254
- */
255
- protected $shipping_city;
256
-
257
- /**
258
- * Customer's Shipping Address: State
259
- *
260
- * format: ISO-3166-2
261
- *
262
- * @var string
263
- */
264
- protected $shipping_state;
265
-
266
- /**
267
- * Customer's Shipping Address
268
- *
269
- * format: ISO-3166
270
- *
271
- * @var string
272
- */
273
- protected $shipping_country;
274
-
275
- /**
276
- * Social Security number or equivalent value for non US customers.
277
- *
278
- * @var string
279
- */
280
- protected $risk_ssn;
281
-
282
- /**
283
- * Customer's MAC address
284
- *
285
- * @var string
286
- */
287
- protected $risk_mac_address;
288
-
289
- /**
290
- * Customer's Session Id
291
- *
292
- * @var string
293
- */
294
- protected $risk_session_id;
295
-
296
- /**
297
- * Customer's User Id
298
- *
299
- * @var string
300
- */
301
- protected $risk_user_id;
302
-
303
- /**
304
- * Customer's User Level
305
- *
306
- * @var string
307
- */
308
- protected $risk_user_level;
309
-
310
- /**
311
- * Customer's Email address
312
- *
313
- * @note Set here if different from
314
- * shipping / billing
315
- *
316
- * @var string
317
- */
318
- protected $risk_email;
319
-
320
- /**
321
- * Customer's Phone number
322
- *
323
- * @note Set here if different from
324
- * shipping / billing
325
- *
326
- * @var string
327
- */
328
- protected $risk_phone;
329
-
330
- /**
331
- * Customer's IP address
332
- *
333
- * @note Set here if different from remote_ip
334
- *
335
- * @var string
336
- */
337
- protected $risk_remote_ip;
338
-
339
- /**
340
- * Customer's Serial Number
341
- *
342
- * @var string
343
- */
344
- protected $risk_serial_number;
345
-
346
- /**
347
- * Verification Id of the authentication.
348
- *
349
- * Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
350
- *
351
- * @var string
352
- */
353
- protected $mpi_cavv;
354
-
355
- /**
356
- * Electric Commerce Indicator as returned from the MPI.
357
- *
358
- * @var string
359
- */
360
- protected $mpi_eci;
361
-
362
- /**
363
- * Transaction ID generated by the 3D Secure service
364
- * that uniquely identifies a 3D Secure check request
365
- *
366
- * @var string
367
- */
368
- protected $mpi_xid;
369
-
370
- /**
371
- * Allows to dynamically override the charge descriptor
372
- *
373
- * @var string
374
- */
375
- protected $dynamic_merchant_name;
376
-
377
- /**
378
- * Allows to dynamically override the mer- chant phone number
379
- *
380
- * @var string
381
- */
382
- protected $dynamic_merchant_city;
383
-
384
- /**
385
- * Set the per-request configuration
386
- *
387
- * @return void
388
- */
389
- protected function initConfiguration()
390
  {
391
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
392
- 'protocol' => 'https',
393
- 'port' => 443,
394
- 'type' => 'POST',
395
- 'format' => 'xml',
396
- ));
397
-
398
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
399
  }
400
 
401
  /**
@@ -405,110 +63,70 @@ class Sale3D extends \Genesis\API\Request
405
  */
406
  protected function setRequiredFields()
407
  {
408
- $requiredFields = array(
409
  'transaction_id',
410
  'amount',
411
  'currency',
412
  'card_holder',
413
  'card_number',
414
  'expiration_month',
415
- 'expiration_year',
416
- );
417
 
418
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
419
 
420
- $requiredFieldsConditional = array(
421
- 'notification_url' => array('return_success_url', 'return_failure_url'),
422
- 'return_success_url' => array('notification_url', 'return_failure_url'),
423
- 'return_failure_url' => array('notification_url', 'return_success_url'),
 
424
  );
425
 
 
 
 
 
 
 
 
 
426
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
427
 
428
- $requiredFieldsGroups = array(
429
- 'synchronous' => array('notification_url', 'return_success_url', 'return_failure_url'),
430
- 'asynchronous' => array('mpi_eci'),
431
- );
432
 
433
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
434
  }
435
 
436
  /**
437
- * Create the request's Tree structure
438
- *
439
- * @return void
440
  */
441
- protected function populateStructure()
442
  {
443
- $treeStructure = array(
444
- 'payment_transaction' => array(
445
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::SALE_3D,
446
- 'transaction_id' => $this->transaction_id,
447
- 'usage' => $this->usage,
448
- 'gaming' => $this->gaming,
449
- 'moto' => $this->moto,
450
- 'remote_ip' => $this->remote_ip,
451
- 'notification_url' => $this->notification_url,
452
- 'return_success_url' => $this->return_success_url,
453
- 'return_failure_url' => $this->return_failure_url,
454
- 'amount' => $this->transform(
455
- 'amount',
456
- array(
457
- $this->amount,
458
- $this->currency,
459
- )
460
- ),
461
- 'currency' => $this->currency,
462
- 'card_holder' => $this->card_holder,
463
- 'card_number' => $this->card_number,
464
- 'cvv' => $this->cvv,
465
- 'expiration_month' => $this->expiration_month,
466
- 'expiration_year' => $this->expiration_year,
467
- 'customer_email' => $this->customer_email,
468
- 'customer_phone' => $this->customer_phone,
469
- 'billing_address' => array(
470
- 'first_name' => $this->billing_first_name,
471
- 'last_name' => $this->billing_last_name,
472
- 'address1' => $this->billing_address1,
473
- 'address2' => $this->billing_address2,
474
- 'zip_code' => $this->billing_zip_code,
475
- 'city' => $this->billing_city,
476
- 'state' => $this->billing_state,
477
- 'country' => $this->billing_country,
478
- ),
479
- 'shipping_address' => array(
480
- 'first_name' => $this->shipping_first_name,
481
- 'last_name' => $this->shipping_last_name,
482
- 'address1' => $this->shipping_address1,
483
- 'address2' => $this->shipping_address2,
484
- 'zip_code' => $this->shipping_zip_code,
485
- 'city' => $this->shipping_city,
486
- 'state' => $this->shipping_state,
487
- 'country' => $this->shipping_country,
488
- ),
489
- 'mpi_params' => array(
490
- 'cavv' => $this->mpi_cavv,
491
- 'eci' => $this->mpi_eci,
492
- 'xid' => $this->mpi_xid,
493
- ),
494
- 'risk_params' => array(
495
- 'ssn' => $this->risk_ssn,
496
- 'mac_address' => $this->risk_mac_address,
497
- 'session_id' => $this->risk_session_id,
498
- 'user_id' => $this->risk_user_id,
499
- 'user_level' => $this->risk_user_level,
500
- 'email' => $this->risk_email,
501
- 'phone' => $this->risk_phone,
502
- 'remote_ip' => $this->risk_remote_ip,
503
- 'serial_number' => $this->risk_serial_number,
504
- ),
505
- 'dynamic_descriptor_params' => array(
506
- 'merchant_name' => $this->dynamic_merchant_name,
507
- 'merchant_city' => $this->dynamic_merchant_city,
508
- )
509
- )
510
- );
511
-
512
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
513
  }
514
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Cards;
25
 
26
+ use Genesis\API\Traits\Request\Financial\GamingAttributes;
27
+ use Genesis\API\Traits\Request\MotoAttributes;
28
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
29
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
30
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
31
+ use Genesis\API\Traits\Request\CreditCardAttributes;
32
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
33
+ use Genesis\API\Traits\Request\Financial\MpiAttributes;
34
+ use Genesis\API\Traits\Request\RiskAttributes;
35
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
36
+
37
  /**
38
+ * Class Sale3D
39
+ *
40
  * Sale 3D Request
41
  *
42
+ * @package Genesis\API\Request\Financial\Cards
 
43
  */
44
+ class Sale3D extends \Genesis\API\Request\Base\Financial
45
  {
46
+ use GamingAttributes, MotoAttributes, NotificationAttributes, AsyncAttributes,
47
+ PaymentAttributes, CreditCardAttributes, AddressInfoAttributes,
48
+ MpiAttributes, RiskAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  /**
51
+ * Returns the Request transaction type
52
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  */
54
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  {
56
+ return \Genesis\API\Constants\Transaction\Types::SALE_3D;
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFields = [
67
  'transaction_id',
68
  'amount',
69
  'currency',
70
  'card_holder',
71
  'card_number',
72
  'expiration_month',
73
+ 'expiration_year'
74
+ ];
75
 
76
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
77
 
78
+ $requiredFieldValues = array_merge(
79
+ [
80
+ 'currency' => \Genesis\Utils\Currency::getList()
81
+ ],
82
+ $this->getCCFieldValueFormatValidators()
83
  );
84
 
85
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
86
+
87
+ $requiredFieldsConditional = [
88
+ 'notification_url' => ['return_success_url', 'return_failure_url'],
89
+ 'return_success_url' => ['notification_url', 'return_failure_url'],
90
+ 'return_failure_url' => ['notification_url', 'return_success_url']
91
+ ];
92
+
93
  $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
94
 
95
+ $requiredFieldsGroups = [
96
+ 'synchronous' => ['notification_url', 'return_success_url', 'return_failure_url'],
97
+ 'asynchronous' => ['mpi_eci']
98
+ ];
99
 
100
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
101
  }
102
 
103
  /**
104
+ * Return additional request attributes
105
+ * @return array
 
106
  */
107
+ protected function getPaymentTransactionStructure()
108
  {
109
+ return [
110
+ 'gaming' => $this->gaming,
111
+ 'moto' => $this->moto,
112
+ 'notification_url' => $this->notification_url,
113
+ 'return_success_url' => $this->return_success_url,
114
+ 'return_failure_url' => $this->return_failure_url,
115
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
116
+ 'currency' => $this->currency,
117
+ 'card_holder' => $this->card_holder,
118
+ 'card_number' => $this->card_number,
119
+ 'cvv' => $this->cvv,
120
+ 'expiration_month' => $this->expiration_month,
121
+ 'expiration_year' => $this->expiration_year,
122
+ 'customer_email' => $this->customer_email,
123
+ 'customer_phone' => $this->customer_phone,
124
+ 'birth_date' => $this->birth_date,
125
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
126
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
127
+ 'mpi_params' => $this->getMpiParamsStructure(),
128
+ 'risk_params' => $this->getRiskParamsStructure(),
129
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
130
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
  }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/Citadel/Payin.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\Citadel;
25
+
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
28
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
29
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
30
+
31
+ /**
32
+ * Class Payin
33
+ *
34
+ * Citadel Payin - oBeP-style alternative payment method
35
+ *
36
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\Citadel
37
+ *
38
+ * @method Payin setMerchantCustomerId($value) Set Unique consumer account ID
39
+ */
40
+ class Payin extends \Genesis\API\Request\Base\Financial
41
+ {
42
+ use AsyncAttributes, NotificationAttributes, PaymentAttributes, AddressInfoAttributes;
43
+
44
+ /**
45
+ * Unique consumer account ID
46
+ *
47
+ * Identifier provided by the merchant that uniquely identifies the customer in their system
48
+ *
49
+ * @var string
50
+ */
51
+ protected $merchant_customer_id;
52
+
53
+ /**
54
+ * Returns the Request transaction type
55
+ * @return string
56
+ */
57
+ protected function getTransactionType()
58
+ {
59
+ return \Genesis\API\Constants\Transaction\Types::CITADEL_PAYIN;
60
+ }
61
+
62
+ /**
63
+ * Set the required fields
64
+ *
65
+ * @return void
66
+ */
67
+ protected function setRequiredFields()
68
+ {
69
+ $requiredFields = [
70
+ 'transaction_id',
71
+ 'amount',
72
+ 'return_success_url',
73
+ 'return_failure_url',
74
+ 'notification_url',
75
+ 'currency',
76
+ 'customer_email',
77
+ 'merchant_customer_id',
78
+ 'billing_first_name',
79
+ 'billing_last_name',
80
+ 'billing_country'
81
+ ];
82
+
83
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
84
+
85
+ $requiredFieldValues = [
86
+ 'billing_country' => [
87
+ 'AT', 'AU', 'BE', 'CA', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB',
88
+ 'GR', 'HU', 'IE', 'IT', 'JP', 'LT', 'LV', 'PL', 'PT', 'SE', 'SK'
89
+ ],
90
+ 'currency' => \Genesis\Utils\Currency::getList()
91
+ ];
92
+
93
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
94
+ }
95
+
96
+ /**
97
+ * Return additional request attributes
98
+ * @return array
99
+ */
100
+ protected function getPaymentTransactionStructure()
101
+ {
102
+ return [
103
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
104
+ 'currency' => $this->currency,
105
+ 'return_success_url' => $this->return_success_url,
106
+ 'return_failure_url' => $this->return_failure_url,
107
+ 'notification_url' => $this->notification_url,
108
+ 'customer_email' => $this->customer_email,
109
+ 'customer_phone' => $this->customer_phone,
110
+ 'merchant_customer_id' => $this->merchant_customer_id,
111
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
112
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
113
+ ];
114
+ }
115
+ }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/Citadel/Payout.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\Citadel;
25
+
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+
29
+ /**
30
+ * Class Payout
31
+ *
32
+ * Citadel Payout - oBeP-style alternative payment method
33
+ *
34
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\Citadel
35
+ *
36
+ * @method Payout setHolderName($value) Set Customer’s bank account holder name
37
+ * @method Payout setIban($value) Set Customer’s IBAN number
38
+ * @method Payout setSwiftCode($value) Set SWIFT/BIC code of the customer’s bank
39
+ * @method Payout setAccountNumber($value) Set National bank account number of the customer
40
+ * @method Payout setBankName($value) Set Customer’s bank name
41
+ * @method Payout setBankCity($value) Set Customer’s bank city
42
+ * @method Payout setBankCode($value) Set Customer’s bank code
43
+ * @method Payout setBranchCode($value) Set Customer’s bank branch code
44
+ * @method Payout setBranchCheckDigit($value) Set Customer’s bank check digit
45
+ */
46
+ class Payout extends \Genesis\API\Request\Base\Financial
47
+ {
48
+ use PaymentAttributes, AddressInfoAttributes;
49
+
50
+ /**
51
+ * Customer’s bank account holder name
52
+ *
53
+ * @var string
54
+ */
55
+ protected $holder_name;
56
+
57
+ /**
58
+ * Customer’s IBAN number, check:
59
+ *
60
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
61
+ *
62
+ * in the official API documentation
63
+ *
64
+ * @var string
65
+ */
66
+ protected $iban;
67
+
68
+ /**
69
+ * SWIFT/BIC code of the customer’s bank, check:
70
+ *
71
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
72
+ *
73
+ * in the official API documentation
74
+ *
75
+ * @var string
76
+ */
77
+ protected $swift_code;
78
+
79
+ /**
80
+ * National bank account number of the customer, check:
81
+ *
82
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
83
+ *
84
+ * in the official API documentation
85
+ *
86
+ * @var string
87
+ */
88
+ protected $account_number;
89
+
90
+ /**
91
+ * Customer’s bank name, check:
92
+ *
93
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
94
+ *
95
+ * in the official API documentation
96
+ *
97
+ * @var string
98
+ */
99
+ protected $bank_name;
100
+
101
+ /**
102
+ * Customer’s bank city
103
+ *
104
+ * @var string
105
+ */
106
+ protected $bank_city;
107
+
108
+ /**
109
+ * Customer’s bank code, check:
110
+ *
111
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
112
+ *
113
+ * in the official API documentation
114
+ *
115
+ * @var string
116
+ */
117
+ protected $bank_code;
118
+
119
+ /**
120
+ * Customer’s bank branch code, check:
121
+ *
122
+ * "Citadel Payment Method Requirements - Supported countries for Payouts"
123
+ *
124
+ * in the official API documentation
125
+ *
126
+ * @var string
127
+ */
128
+ protected $branch_code;
129
+
130
+ /**
131
+ * Customer’s bank check digit
132
+ *
133
+ * @var string
134
+ */
135
+ protected $branch_check_digit;
136
+
137
+ /**
138
+ * Returns the Request transaction type
139
+ * @return string
140
+ */
141
+ protected function getTransactionType()
142
+ {
143
+ return \Genesis\API\Constants\Transaction\Types::CITADEL_PAYOUT;
144
+ }
145
+
146
+ /**
147
+ * Set the required fields
148
+ *
149
+ * @return void
150
+ */
151
+ protected function setRequiredFields()
152
+ {
153
+ $requiredFields = [
154
+ 'transaction_id',
155
+ 'amount',
156
+ 'currency',
157
+ 'customer_email',
158
+ 'holder_name',
159
+ 'billing_country'
160
+ ];
161
+
162
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
163
+
164
+ $requiredFieldValues = [
165
+ 'billing_country' => [
166
+ 'АЕ', 'AT', 'AU', 'BE', 'BG', 'CA', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES',
167
+ 'FI', 'FR', 'GB', 'GF', 'GP', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV',
168
+ 'MC', 'MQ', 'MT', 'MX', 'NL', 'PL', 'PT', 'RE', 'SE', 'SI', 'SK'
169
+ ],
170
+ 'currency' => \Genesis\Utils\Currency::getList()
171
+ ];
172
+
173
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
174
+
175
+ $this->setRequiredFieldsConditional();
176
+ }
177
+
178
+ /**
179
+ * Set the required fields conditional
180
+ *
181
+ * @return void
182
+ */
183
+ protected function setRequiredFieldsConditional()
184
+ {
185
+ $requiredParamsIbanSwiftCode = ['iban', 'swift_code'];
186
+
187
+ $requiredFieldsConditional = [
188
+ 'billing_country' => [
189
+ 'AE' => $requiredParamsIbanSwiftCode,
190
+ 'AT' => $requiredParamsIbanSwiftCode,
191
+ 'AU' => ['account_number', 'branch_code'],
192
+ 'BE' => $requiredParamsIbanSwiftCode,
193
+ 'BG' => ['iban'],
194
+ 'CA' => ['account_number', 'branch_code', 'bank_code', 'bank_name'],
195
+ 'CY' => $requiredParamsIbanSwiftCode,
196
+ 'CZ' => ['iban'],
197
+ 'DE' => $requiredParamsIbanSwiftCode,
198
+ 'DK' => ['account_number', 'bank_code'],
199
+ 'EE' => $requiredParamsIbanSwiftCode,
200
+ 'ES' => $requiredParamsIbanSwiftCode,
201
+ 'FI' => $requiredParamsIbanSwiftCode,
202
+ 'FR' => $requiredParamsIbanSwiftCode,
203
+ 'GB' => ['account_number', 'bank_code'],
204
+ 'GF' => $requiredParamsIbanSwiftCode,
205
+ 'GP' => $requiredParamsIbanSwiftCode,
206
+ 'GR' => $requiredParamsIbanSwiftCode,
207
+ 'HU' => ['account_number'],
208
+ 'IE' => $requiredParamsIbanSwiftCode,
209
+ 'IT' => $requiredParamsIbanSwiftCode,
210
+ 'LT' => $requiredParamsIbanSwiftCode,
211
+ 'LU' => $requiredParamsIbanSwiftCode,
212
+ 'LV' => $requiredParamsIbanSwiftCode,
213
+ 'MC' => $requiredParamsIbanSwiftCode,
214
+ 'MQ' => $requiredParamsIbanSwiftCode,
215
+ 'MT' => $requiredParamsIbanSwiftCode,
216
+ 'MX' => ['iban', 'bank_name'],
217
+ 'NL' => $requiredParamsIbanSwiftCode,
218
+ 'PL' => ['iban'],
219
+ 'PT' => $requiredParamsIbanSwiftCode,
220
+ 'RE' => $requiredParamsIbanSwiftCode,
221
+ 'SE' => ['iban'],
222
+ 'SI' => $requiredParamsIbanSwiftCode,
223
+ 'SK' => $requiredParamsIbanSwiftCode
224
+ ]
225
+ ];
226
+
227
+ $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
228
+ }
229
+
230
+ /**
231
+ * Return additional request attributes
232
+ * @return array
233
+ */
234
+ protected function getPaymentTransactionStructure()
235
+ {
236
+ return [
237
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
238
+ 'currency' => $this->currency,
239
+ 'customer_email' => $this->customer_email,
240
+ 'customer_phone' => $this->customer_phone,
241
+ 'holder_name' => $this->holder_name,
242
+ 'iban' => $this->iban,
243
+ 'swift_code' => $this->swift_code,
244
+ 'account_number' => $this->account_number,
245
+ 'bank_name' => $this->bank_name,
246
+ 'bank_city' => $this->bank_city,
247
+ 'bank_code' => $this->bank_code,
248
+ 'branch_code' => $this->branch_code,
249
+ 'branch_check_digit' => $this->branch_check_digit,
250
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
251
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
252
+ ];
253
+ }
254
+ }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/InstaDebit/Payin.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\InstaDebit;
25
+
26
+ /**
27
+ * Class Payin
28
+ *
29
+ * InstaDebit Payin - Online Banking ePayments (oBeP)
30
+ *
31
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\InstaDebit
32
+ */
33
+ class Payin extends \Genesis\API\Request\Financial\OnlineBankingPayments\iDebit\Payin
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::INSTA_DEBIT_PAYIN;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFieldValues = [
54
+ 'billing_country' => ['CA'],
55
+ 'currency' => ['CAD', 'USD']
56
+ ];
57
+
58
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
59
+ }
60
+ }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/InstaDebit/Payout.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\InstaDebit;
25
+
26
+ /**
27
+ * Class Payout
28
+ *
29
+ * InstaDebit Payout - Online Banking ePayments (oBeP)
30
+ *
31
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\InstaDebit
32
+ */
33
+ class Payout extends \Genesis\API\Request\Financial\OnlineBankingPayments\iDebit\Payout
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::INSTA_DEBIT_PAYOUT;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFieldValues = [
54
+ 'currency' => ['CAD', 'USD']
55
+ ];
56
+
57
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
58
+ }
59
+ }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/iDebit/Payin.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\iDebit;
25
+
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
28
+
29
+ /**
30
+ * Class Payin
31
+ *
32
+ * iDebit Payin - Online Banking ePayments (oBeP)
33
+ *
34
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\iDebit
35
+ *
36
+ * @method Payin setCustomerAccountId($value) Set Unique consumer account ID
37
+ * @method Payin setReturnUrl($value) Set the URL where customer is sent to after payment
38
+ */
39
+ class Payin extends \Genesis\API\Request\Base\Financial
40
+ {
41
+ use PaymentAttributes, AddressInfoAttributes;
42
+
43
+ /**
44
+ * Unique consumer account ID
45
+ *
46
+ * @var string
47
+ */
48
+ protected $customer_account_id;
49
+
50
+ /**
51
+ * URL where customer is sent to after payment
52
+ *
53
+ * @var string
54
+ */
55
+ protected $return_url;
56
+
57
+ /**
58
+ * Returns the Request transaction type
59
+ * @return string
60
+ */
61
+ protected function getTransactionType()
62
+ {
63
+ return \Genesis\API\Constants\Transaction\Types::IDEBIT_PAYIN;
64
+ }
65
+
66
+ /**
67
+ * Set the required fields
68
+ *
69
+ * @return void
70
+ */
71
+ protected function setRequiredFields()
72
+ {
73
+ $requiredFields = [
74
+ 'transaction_id',
75
+ 'amount',
76
+ 'currency',
77
+ 'return_url',
78
+ 'customer_account_id',
79
+ 'billing_country'
80
+ ];
81
+
82
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
83
+
84
+ $requiredFieldValues = [
85
+ 'billing_country' => ['CA'],
86
+ 'currency' => ['CAD', 'USD', 'EUR', 'GBP', 'AUD']
87
+ ];
88
+
89
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
90
+ }
91
+
92
+ /**
93
+ * Return additional request attributes
94
+ * @return array
95
+ */
96
+ protected function getPaymentTransactionStructure()
97
+ {
98
+ return [
99
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
100
+ 'currency' => $this->currency,
101
+ 'customer_account_id' => $this->customer_account_id,
102
+ 'return_url' => $this->return_url,
103
+ 'customer_email' => $this->customer_email,
104
+ 'customer_phone' => $this->customer_phone,
105
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
106
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
107
+ ];
108
+ }
109
+ }
lib/Genesis/src/Genesis/API/Request/Financial/OnlineBankingPayments/iDebit/Payout.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\OnlineBankingPayments\iDebit;
25
+
26
+ /**
27
+ * Class Payout
28
+ *
29
+ * iDebit Payout - Online Banking ePayments (oBeP)
30
+ *
31
+ * @package Genesis\API\Request\Financial\OnlineBankingPayments\iDebit
32
+ */
33
+ class Payout extends \Genesis\API\Request\Base\Financial\Reference
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::IDEBIT_PAYOUT;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ $requiredFields = [
52
+ 'transaction_id',
53
+ 'reference_id',
54
+ 'amount',
55
+ 'currency'
56
+ ];
57
+
58
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
59
+
60
+ $requiredFieldValues = [
61
+ 'currency' => ['CAD', 'USD', 'EUR', 'GBP', 'AUD']
62
+ ];
63
+
64
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
65
+ }
66
+ }
lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/Sale.php CHANGED
@@ -20,8 +20,18 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\PayByVouchers;
24
 
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Class Sale
27
  *
@@ -29,327 +39,17 @@ namespace Genesis\API\Request\Financial\PayByVouchers;
29
  *
30
  * @package Genesis\API\Request\Financial\PayByVouchers
31
  */
32
- class Sale extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by merchant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Card type for the voucher - can be ’virtual’ or ’physical’ only
43
- *
44
- * @var string
45
- */
46
- protected $card_type;
47
-
48
- /**
49
- * Redeem type for the voucher - can be ’stored’ or ’instant’ only
50
- *
51
- * @var string
52
- */
53
- protected $redeem_type;
54
-
55
- /**
56
- * Description of the transaction for later use
57
- *
58
- * @var string
59
- */
60
- protected $usage;
61
-
62
- /**
63
- * IPv4 address of customer
64
- *
65
- * @var string
66
- */
67
- protected $remote_ip;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int|float|double
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Full name of customer as printed on credit card (first name and last name at least)
85
- *
86
- * @var string
87
- */
88
- protected $card_holder;
89
-
90
- /**
91
- * Complete CC number of customer
92
- *
93
- * @var int
94
- */
95
- protected $card_number;
96
-
97
- /**
98
- * CVV of CC, requirement is based on terminal configuration
99
- *
100
- * @var int
101
- */
102
- protected $cvv;
103
-
104
- /**
105
- * Expiration month as printed on credit card
106
- *
107
- * @var string (mm)
108
- */
109
- protected $expiration_month;
110
-
111
- /**
112
- * Expiration year as printed on credit card
113
- *
114
- * @var string (yyyy)
115
- */
116
- protected $expiration_year;
117
-
118
- /**
119
- * Email address of the Customer
120
- *
121
- * @var string
122
- */
123
- protected $customer_email;
124
-
125
- /**
126
- * Phone number of the customer
127
- *
128
- * @var string
129
- */
130
- protected $customer_phone;
131
-
132
- /**
133
- *Customer's Billing Address: First name
134
- *
135
- * @var string
136
- */
137
- protected $billing_first_name;
138
-
139
- /**
140
- * Customer's Billing Address: Last name
141
- *
142
- * @var string
143
- */
144
- protected $billing_last_name;
145
-
146
- /**
147
- * Customer's Billing Address: Part 1
148
- *
149
- * @var string
150
- */
151
- protected $billing_address1;
152
 
153
  /**
154
- * Customer's Billing Address: Part 2
155
- * @var string
156
  */
157
- protected $billing_address2;
158
-
159
- /**
160
- * Customer's Billing Address: ZIP
161
- *
162
- * @var string
163
- */
164
- protected $billing_zip_code;
165
-
166
- /**
167
- * Customer's Billing Address: City
168
- *
169
- * @var string
170
- */
171
- protected $billing_city;
172
-
173
- /**
174
- * Customer's Billing Address: State
175
- *
176
- * format: ISO-3166-2
177
- *
178
- * @var string
179
- */
180
- protected $billing_state;
181
-
182
- /**
183
- * Customer's Billing Address: Country
184
- *
185
- * format: ISO-3166
186
- *
187
- * @var string
188
- */
189
- protected $billing_country;
190
-
191
- /**
192
- * Customer's Shipping Address: First name
193
- *
194
- * @var string
195
- */
196
- protected $shipping_first_name;
197
-
198
- /**
199
- * Customer's Shipping Address: Last name
200
- *
201
- * @var string
202
- */
203
- protected $shipping_last_name;
204
-
205
- /**
206
- * Customer's Shipping Address: Part 1
207
- *
208
- * @var string
209
- */
210
- protected $shipping_address1;
211
-
212
- /**
213
- * Customer's Shipping Address: Part 2
214
- *
215
- * @var string
216
- */
217
- protected $shipping_address2;
218
-
219
- /**
220
- * Customer's Shipping Address: ZIP
221
- *
222
- * @var string
223
- */
224
- protected $shipping_zip_code;
225
-
226
- /**
227
- * Customer's Shipping Address: City
228
- *
229
- * @var string
230
- */
231
- protected $shipping_city;
232
-
233
- /**
234
- * Customer's Shipping Address: State
235
- *
236
- * format: ISO-3166-2
237
- *
238
- * @var string
239
- */
240
- protected $shipping_state;
241
-
242
- /**
243
- * Customer's Shipping Address
244
- *
245
- * format: ISO-3166
246
- *
247
- * @var string
248
- */
249
- protected $shipping_country;
250
-
251
- /**
252
- * Social Security number or equivalent value for non US customers.
253
- *
254
- * @var string
255
- */
256
- protected $risk_ssn;
257
-
258
- /**
259
- * Customer's MAC address
260
- *
261
- * @var string
262
- */
263
- protected $risk_mac_address;
264
-
265
- /**
266
- * Customer's Session Id
267
- *
268
- * @var string
269
- */
270
- protected $risk_session_id;
271
-
272
- /**
273
- * Customer's User Id
274
- *
275
- * @var string
276
- */
277
- protected $risk_user_id;
278
-
279
- /**
280
- * Customer's User Level
281
- *
282
- * @var string
283
- */
284
- protected $risk_user_level;
285
-
286
- /**
287
- * Customer's Email address
288
- *
289
- * @note Set here if different from
290
- * shipping / billing
291
- *
292
- * @var string
293
- */
294
- protected $risk_email;
295
-
296
- /**
297
- * Customer's Phone number
298
- *
299
- * @note Set here if different from
300
- * shipping / billing
301
- *
302
- * @var string
303
- */
304
- protected $risk_phone;
305
-
306
- /**
307
- * Customer's IP address
308
- *
309
- * @note Set here if different from remote_ip
310
- *
311
- * @var string
312
- */
313
- protected $risk_remote_ip;
314
-
315
- /**
316
- * Customer's Serial Number
317
- *
318
- * @var string
319
- */
320
- protected $risk_serial_number;
321
-
322
- /**
323
- * Allows to dynamically override the charge descriptor
324
- *
325
- * @var string
326
- */
327
- protected $dynamic_merchant_name;
328
-
329
- /**
330
- * Allows to dynamically override the mer- chant phone number
331
- *
332
- * @var string
333
- */
334
- protected $dynamic_merchant_city;
335
-
336
- /**
337
- * Set the per-request configuration
338
- *
339
- * @return void
340
- */
341
- protected function initConfiguration()
342
  {
343
- $this->config = \Genesis\Utils\Common::createArrayObject(
344
- array(
345
- 'protocol' => 'https',
346
- 'port' => 443,
347
- 'type' => 'POST',
348
- 'format' => 'xml',
349
- )
350
- );
351
-
352
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
353
  }
354
 
355
  /**
@@ -359,7 +59,7 @@ class Sale extends \Genesis\API\Request
359
  */
360
  protected function setRequiredFields()
361
  {
362
- $requiredFields = array(
363
  'transaction_id',
364
  'card_type',
365
  'redeem_type',
@@ -368,80 +68,45 @@ class Sale extends \Genesis\API\Request
368
  'card_holder',
369
  'card_number',
370
  'expiration_month',
371
- 'expiration_year',
372
- );
373
 
374
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
 
377
  /**
378
- * Create the request's Tree structure
379
- *
380
- * @return void
381
  */
382
- protected function populateStructure()
383
  {
384
- $treeStructure = array(
385
- 'payment_transaction' => array(
386
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE,
387
- 'transaction_id' => $this->transaction_id,
388
- 'card_type' => $this->card_type,
389
- 'redeem_type' => $this->redeem_type,
390
- 'usage' => $this->usage,
391
- 'remote_ip' => $this->remote_ip,
392
- 'amount' => $this->transform(
393
- 'amount',
394
- array(
395
- $this->amount,
396
- $this->currency,
397
- )
398
- ),
399
- 'currency' => $this->currency,
400
- 'card_holder' => $this->card_holder,
401
- 'card_number' => $this->card_number,
402
- 'cvv' => $this->cvv,
403
- 'expiration_month' => $this->expiration_month,
404
- 'expiration_year' => $this->expiration_year,
405
- 'customer_email' => $this->customer_email,
406
- 'customer_phone' => $this->customer_phone,
407
- 'billing_address' => array(
408
- 'first_name' => $this->billing_first_name,
409
- 'last_name' => $this->billing_last_name,
410
- 'address1' => $this->billing_address1,
411
- 'address2' => $this->billing_address2,
412
- 'zip_code' => $this->billing_zip_code,
413
- 'city' => $this->billing_city,
414
- 'state' => $this->billing_state,
415
- 'country' => $this->billing_country,
416
- ),
417
- 'shipping_address' => array(
418
- 'first_name' => $this->shipping_first_name,
419
- 'last_name' => $this->shipping_last_name,
420
- 'address1' => $this->shipping_address1,
421
- 'address2' => $this->shipping_address2,
422
- 'zip_code' => $this->shipping_zip_code,
423
- 'city' => $this->shipping_city,
424
- 'state' => $this->shipping_state,
425
- 'country' => $this->shipping_country,
426
- ),
427
- 'risk_params' => array(
428
- 'ssn' => $this->risk_ssn,
429
- 'mac_address' => $this->risk_mac_address,
430
- 'session_id' => $this->risk_session_id,
431
- 'user_id' => $this->risk_user_id,
432
- 'user_level' => $this->risk_user_level,
433
- 'email' => $this->risk_email,
434
- 'phone' => $this->risk_phone,
435
- 'remote_ip' => $this->risk_remote_ip,
436
- 'serial_number' => $this->risk_serial_number,
437
- ),
438
- 'dynamic_descriptor_params' => array(
439
- 'merchant_name' => $this->dynamic_merchant_name,
440
- 'merchant_city' => $this->dynamic_merchant_city,
441
- )
442
- )
443
- );
444
-
445
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
446
  }
447
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\PayByVouchers;
25
 
26
+ use Genesis\API\Constants\Transaction\Parameters\PayByVouchers\CardTypes;
27
+ use Genesis\API\Constants\Transaction\Parameters\PayByVouchers\RedeemTypes;
28
+ use Genesis\API\Traits\Request\Financial\VoucherAttributes;
29
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
30
+ use Genesis\API\Traits\Request\CreditCardAttributes;
31
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
32
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
33
+ use Genesis\Utils\Currency;
34
+
35
  /**
36
  * Class Sale
37
  *
39
  *
40
  * @package Genesis\API\Request\Financial\PayByVouchers
41
  */
42
+ class Sale extends \Genesis\API\Request\Base\Financial
43
  {
44
+ use VoucherAttributes, PaymentAttributes, CreditCardAttributes, AddressInfoAttributes, DescriptorAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  /**
47
+ * Returns the Request transaction type
48
+ * @return string
49
  */
50
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  {
52
+ return \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_SALE;
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
59
  */
60
  protected function setRequiredFields()
61
  {
62
+ $requiredFields = [
63
  'transaction_id',
64
  'card_type',
65
  'redeem_type',
68
  'card_holder',
69
  'card_number',
70
  'expiration_month',
71
+ 'expiration_year'
72
+ ];
73
 
74
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
75
+
76
+ $requiredFieldValues = array_merge(
77
+ [
78
+ 'card_type' => CardTypes::getCardTypes(),
79
+ 'redeem_type' => RedeemTypes::getRedeemTypes(),
80
+ 'currency' => Currency::getList()
81
+ ],
82
+ $this->getCCFieldValueFormatValidators()
83
+ );
84
+
85
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
86
  }
87
 
88
  /**
89
+ * Return additional request attributes
90
+ * @return array
 
91
  */
92
+ protected function getPaymentTransactionStructure()
93
  {
94
+ return [
95
+ 'card_type' => $this->card_type,
96
+ 'redeem_type' => $this->redeem_type,
97
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
98
+ 'currency' => $this->currency,
99
+ 'card_holder' => $this->card_holder,
100
+ 'card_number' => $this->card_number,
101
+ 'cvv' => $this->cvv,
102
+ 'expiration_month' => $this->expiration_month,
103
+ 'expiration_year' => $this->expiration_year,
104
+ 'customer_email' => $this->customer_email,
105
+ 'customer_phone' => $this->customer_phone,
106
+ 'birth_date' => $this->birth_date,
107
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
108
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
109
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
110
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
112
  }
lib/Genesis/src/Genesis/API/Request/Financial/PayByVouchers/oBeP.php CHANGED
@@ -29,7 +29,9 @@ namespace Genesis\API\Request\Financial\PayByVouchers;
29
  *
30
  * @package Genesis\API\Request\Financial\PayByVouchers
31
  */
 
32
  class oBeP extends \Genesis\API\Request
 
33
  {
34
  /**
35
  * Unique transaction id defined by mer-chant
@@ -153,16 +155,9 @@ class oBeP extends \Genesis\API\Request
153
  */
154
  protected function initConfiguration()
155
  {
156
- $this->config = \Genesis\Utils\Common::createArrayObject(
157
- array(
158
- 'protocol' => 'https',
159
- 'port' => 443,
160
- 'type' => 'POST',
161
- 'format' => 'xml',
162
- )
163
- );
164
-
165
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
166
  }
167
 
168
  /**
@@ -172,7 +167,7 @@ class oBeP extends \Genesis\API\Request
172
  */
173
  protected function setRequiredFields()
174
  {
175
- $requiredFields = array(
176
  'transaction_id',
177
  'card_type',
178
  'redeem_type',
@@ -186,7 +181,7 @@ class oBeP extends \Genesis\API\Request
186
  'customer_id_number',
187
  'customer_bank_id',
188
  'bank_account_number'
189
- );
190
 
191
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
192
  }
@@ -198,8 +193,8 @@ class oBeP extends \Genesis\API\Request
198
  */
199
  protected function populateStructure()
200
  {
201
- $treeStructure = array(
202
- 'payment_transaction' => array(
203
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY,
204
  'transaction_id' => $this->transaction_id,
205
  'card_type' => $this->card_type,
@@ -207,10 +202,10 @@ class oBeP extends \Genesis\API\Request
207
  'remote_ip' => $this->remote_ip,
208
  'amount' => $this->transform(
209
  'amount',
210
- array(
211
  $this->amount,
212
- $this->currency,
213
- )
214
  ),
215
  'currency' => $this->currency,
216
  'product_name' => $this->product_name,
@@ -220,9 +215,9 @@ class oBeP extends \Genesis\API\Request
220
  'customer_phone' => $this->customer_phone,
221
  'customer_id_number' => $this->customer_id_number,
222
  'customer_bank_id' => $this->customer_bank_id,
223
- 'bank_account_number' => $this->bank_account_number,
224
- )
225
- );
226
 
227
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
228
  }
29
  *
30
  * @package Genesis\API\Request\Financial\PayByVouchers
31
  */
32
+ // @codingStandardsIgnoreStart
33
  class oBeP extends \Genesis\API\Request
34
+ // @codingStandardsIgnoreEnd
35
  {
36
  /**
37
  * Unique transaction id defined by mer-chant
155
  */
156
  protected function initConfiguration()
157
  {
158
+ $this->initXmlConfiguration();
159
+
160
+ $this->initApiGatewayConfiguration();
 
 
 
 
 
 
 
161
  }
162
 
163
  /**
167
  */
168
  protected function setRequiredFields()
169
  {
170
+ $requiredFields = [
171
  'transaction_id',
172
  'card_type',
173
  'redeem_type',
181
  'customer_id_number',
182
  'customer_bank_id',
183
  'bank_account_number'
184
+ ];
185
 
186
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
187
  }
193
  */
194
  protected function populateStructure()
195
  {
196
+ $treeStructure = [
197
+ 'payment_transaction' => [
198
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::PAYBYVOUCHER_YEEPAY,
199
  'transaction_id' => $this->transaction_id,
200
  'card_type' => $this->card_type,
202
  'remote_ip' => $this->remote_ip,
203
  'amount' => $this->transform(
204
  'amount',
205
+ [
206
  $this->amount,
207
+ $this->currency
208
+ ]
209
  ),
210
  'currency' => $this->currency,
211
  'product_name' => $this->product_name,
215
  'customer_phone' => $this->customer_phone,
216
  'customer_id_number' => $this->customer_id_number,
217
  'customer_bank_id' => $this->customer_bank_id,
218
+ 'bank_account_number' => $this->bank_account_number
219
+ ]
220
+ ];
221
 
222
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
223
  }
lib/Genesis/src/Genesis/API/Request/Financial/Refund.php CHANGED
@@ -23,116 +23,20 @@
23
  namespace Genesis\API\Request\Financial;
24
 
25
  /**
26
- * Refund request
27
  *
28
- * @package Genesis
29
- * @subpackage Request
 
30
  */
31
- class Refund extends \Genesis\API\Request
32
  {
33
  /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Amount of transaction in minor currency unit
56
- *
57
- * @var int
58
- */
59
- protected $amount;
60
-
61
- /**
62
- * Currency code in ISO-4217
63
- *
64
- * @var string
65
- */
66
- protected $currency;
67
-
68
- /**
69
- * Unique id of the existing (target) transaction
70
- *
71
- * @var string
72
  */
73
- protected $reference_id;
74
-
75
- /**
76
- * Set the per-request configuration
77
- *
78
- * @return void
79
- */
80
- protected function initConfiguration()
81
- {
82
- $this->config = \Genesis\Utils\Common::createArrayObject(
83
- array(
84
- 'protocol' => 'https',
85
- 'port' => 443,
86
- 'type' => 'POST',
87
- 'format' => 'xml',
88
- )
89
- );
90
-
91
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
92
- }
93
-
94
- /**
95
- * Set the required fields
96
- *
97
- * @return void
98
- */
99
- protected function setRequiredFields()
100
- {
101
- $requiredFields = array(
102
- 'transaction_id',
103
- 'reference_id',
104
- 'amount',
105
- 'currency'
106
- );
107
-
108
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
109
- }
110
-
111
- /**
112
- * Create the request's Tree structure
113
- *
114
- * @return void
115
- */
116
- protected function populateStructure()
117
  {
118
- $treeStructure = array(
119
- 'payment_transaction' => array(
120
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::REFUND,
121
- 'transaction_id' => $this->transaction_id,
122
- 'usage' => $this->usage,
123
- 'remote_ip' => $this->remote_ip,
124
- 'reference_id' => $this->reference_id,
125
- 'amount' => $this->transform(
126
- 'amount',
127
- array(
128
- $this->amount,
129
- $this->currency,
130
- )
131
- ),
132
- 'currency' => $this->currency
133
- )
134
- );
135
-
136
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
137
  }
138
  }
23
  namespace Genesis\API\Request\Financial;
24
 
25
  /**
26
+ * Class Refund
27
  *
28
+ * Refund Request
29
+ *
30
+ * @package Genesis\API\Request\Financial
31
  */
32
+ class Refund extends \Genesis\API\Request\Base\Financial\Reference
33
  {
34
  /**
35
+ * Returns the Request transaction type
36
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  */
38
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  {
40
+ return \Genesis\API\Constants\Transaction\Types::REFUND;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  }
lib/Genesis/src/Genesis/API/Request/Financial/SDD/Payout.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+ namespace Genesis\API\Request\Financial\SDD;
24
+
25
+ use Genesis\Utils\Common as CommonUtils;
26
+
27
+ /**
28
+ * Class Payout
29
+ *
30
+ * SDD Payout Transactions
31
+ *
32
+ * @package Genesis\API\Request\Financial\SDD
33
+ */
34
+ class Payout extends \Genesis\API\Request\Financial\SDD\Sale
35
+ {
36
+ /**
37
+ * Set the required fields
38
+ *
39
+ * @return void
40
+ */
41
+ protected function setRequiredFields()
42
+ {
43
+ parent::setRequiredFields();
44
+
45
+ CommonUtils::appendItemsToArrayObj(
46
+ $this->requiredFieldValues,
47
+ 'billing_country',
48
+ ['BG', 'HR', 'CZ', 'DK', 'UK', 'HU', 'IS', 'LI', 'NO', 'PL', 'RO', 'SE', 'CH']
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Returns the Request transaction type
54
+ * @return string
55
+ */
56
+ protected function getTransactionType()
57
+ {
58
+ return \Genesis\API\Constants\Transaction\Types::SDD_PAYOUT;
59
+ }
60
+ }
lib/Genesis/src/Genesis/API/Request/Financial/SDD/Recurring/InitRecurringSale.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+ namespace Genesis\API\Request\Financial\SDD\Recurring;
24
+
25
+ /**
26
+ * Class InitRecurringSale
27
+ *
28
+ * SDD Initial Recurring Sale Payment Transactions
29
+ *
30
+ * @package Genesis\API\Request\Financial\SDD\Recurring
31
+ *
32
+ */
33
+ class InitRecurringSale extends \Genesis\API\Request\Financial\SDD\Sale
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::SDD_INIT_RECURRING_SALE;
42
+ }
43
+ }
lib/Genesis/src/Genesis/API/Request/Financial/SDD/Recurring/RecurringSale.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\SDD\Recurring;
25
+
26
+ /**
27
+ * Class RecurringSale
28
+ *
29
+ * SDD Recurring Sale Transaction Request
30
+ *
31
+ * @package Genesis\API\Request\Financial\SDD\Recurring
32
+ */
33
+ class RecurringSale extends \Genesis\API\Request\Base\Financial\Reference
34
+ {
35
+ /**
36
+ * Returns the Request transaction type
37
+ * @return string
38
+ */
39
+ protected function getTransactionType()
40
+ {
41
+ return \Genesis\API\Constants\Transaction\Types::SDD_RECURRING_SALE;
42
+ }
43
+
44
+ /**
45
+ * Set the required fields
46
+ *
47
+ * @return void
48
+ */
49
+ protected function setRequiredFields()
50
+ {
51
+ parent::setRequiredFields();
52
+
53
+ $requiredFields = [
54
+ 'transaction_id',
55
+ 'reference_id',
56
+ 'amount',
57
+ 'currency',
58
+ 'usage'
59
+ ];
60
+
61
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
62
+ }
63
+ }
lib/Genesis/src/Genesis/API/Request/Financial/SDD/Refund.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\SDD;
25
+
26
+ /**
27
+ * Class Refund
28
+ *
29
+ * SDD Refund Transaction
30
+ *
31
+ * @package Genesis\API\Request\Financial\SDD
32
+ *
33
+ */
34
+ class Refund extends \Genesis\API\Request\Base\Financial\Reference
35
+ {
36
+ /**
37
+ * Returns the Request transaction type
38
+ * @return string
39
+ */
40
+ protected function getTransactionType()
41
+ {
42
+ return \Genesis\API\Constants\Transaction\Types::SDD_REFUND;
43
+ }
44
+
45
+ /**
46
+ * Set the required fields
47
+ *
48
+ * @return void
49
+ */
50
+ protected function setRequiredFields()
51
+ {
52
+ parent::setRequiredFields();
53
+
54
+ $requiredFields = [
55
+ 'transaction_id',
56
+ 'reference_id',
57
+ 'amount',
58
+ 'currency',
59
+ 'usage'
60
+ ];
61
+
62
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
63
+ }
64
+ }
lib/Genesis/src/Genesis/API/Request/Financial/SDD/Sale.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Request\Financial\SDD;
25
+
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
28
+ use Genesis\API\Traits\Request\Financial\SddBankAttributes;
29
+
30
+ /**
31
+ * Class Sale
32
+ *
33
+ * SDD Payment Transactions
34
+ *
35
+ * @package Genesis\API\Request\Financial\SDD
36
+ */
37
+ class Sale extends \Genesis\API\Request\Base\Financial
38
+ {
39
+ use PaymentAttributes, AddressInfoAttributes, SddBankAttributes;
40
+
41
+ /**
42
+ * Returns the Request transaction type
43
+ * @return string
44
+ */
45
+ protected function getTransactionType()
46
+ {
47
+ return \Genesis\API\Constants\Transaction\Types::SDD_SALE;
48
+ }
49
+
50
+ /**
51
+ * Set the required fields
52
+ *
53
+ * @return void
54
+ */
55
+ protected function setRequiredFields()
56
+ {
57
+ $requiredFields = [
58
+ 'transaction_id',
59
+ 'usage',
60
+ 'amount',
61
+ 'currency',
62
+ 'iban',
63
+ 'bic',
64
+ 'billing_first_name',
65
+ 'billing_last_name',
66
+ 'billing_country'
67
+ ];
68
+
69
+ $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
70
+
71
+ $requiredFieldValues = [
72
+ 'billing_country' => [
73
+ 'AT', 'BE', 'CY', 'EE', 'FI', 'FR', 'DE', 'GR', 'IE', 'IT', 'LV',
74
+ 'LT', 'LU', 'MT', 'MC', 'NL', 'PT', 'SK', 'SM', 'SI', 'ES'
75
+ ],
76
+ 'currency' => \Genesis\Utils\Currency::getList()
77
+ ];
78
+
79
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
80
+ }
81
+
82
+ /**
83
+ * Return additional request attributes
84
+ * @return array
85
+ */
86
+ protected function getPaymentTransactionStructure()
87
+ {
88
+ return [
89
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
90
+ 'currency' => $this->currency,
91
+ 'iban' => $this->iban,
92
+ 'bic' => $this->bic,
93
+ 'customer_email' => $this->customer_email,
94
+ 'customer_phone' => $this->customer_phone,
95
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
96
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
97
+ ];
98
+ }
99
+ }
lib/Genesis/src/Genesis/API/Request/Financial/Void.php DELETED
@@ -1,114 +0,0 @@
1
- <?php
2
- /*
3
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4
- * of this software and associated documentation files (the "Software"), to deal
5
- * in the Software without restriction, including without limitation the rights
6
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- * copies of the Software, and to permit persons to whom the Software is
8
- * furnished to do so, subject to the following conditions:
9
- *
10
- * The above copyright notice and this permission notice shall be included in
11
- * all copies or substantial portions of the Software.
12
- *
13
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- * THE SOFTWARE.
20
- *
21
- * @license http://opensource.org/licenses/MIT The MIT License
22
- */
23
- namespace Genesis\API\Request\Financial;
24
-
25
- /**
26
- * Void Request
27
- *
28
- * @package Genesis
29
- * @subpackage Request
30
- */
31
- class Void extends \Genesis\API\Request
32
- {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * IPv4 address of customer
49
- *
50
- * @var string
51
- */
52
- protected $remote_ip;
53
-
54
- /**
55
- * Unique id of the existing (target) transaction
56
- *
57
- * @var string
58
- */
59
- protected $reference_id;
60
-
61
- /**
62
- * Set the per-request configuration
63
- *
64
- * @return void
65
- */
66
- protected function initConfiguration()
67
- {
68
- $this->config = \Genesis\Utils\Common::createArrayObject(
69
- array(
70
- 'protocol' => 'https',
71
- 'port' => 443,
72
- 'type' => 'POST',
73
- 'format' => 'xml',
74
- )
75
- );
76
-
77
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
78
- }
79
-
80
- /**
81
- * Set the required fields
82
- *
83
- * @return void
84
- */
85
- protected function setRequiredFields()
86
- {
87
- $requiredFields = array(
88
- 'transaction_id',
89
- 'reference_id',
90
- );
91
-
92
- $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
93
- }
94
-
95
- /**
96
- * Create the request's Tree structure
97
- *
98
- * @return void
99
- */
100
- protected function populateStructure()
101
- {
102
- $treeStructure = array(
103
- 'payment_transaction' => array(
104
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::VOID,
105
- 'transaction_id' => $this->transaction_id,
106
- 'usage' => $this->usage,
107
- 'remote_ip' => $this->remote_ip,
108
- 'reference_id' => $this->reference_id,
109
- )
110
- );
111
-
112
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
113
- }
114
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/Neteller.php CHANGED
@@ -20,79 +20,26 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Wallets;
24
 
 
 
 
 
25
  /**
26
  * Class Neteller
27
  *
28
  * Electronic Wallet
29
  *
30
  * @package Genesis\API\Request\Financial\Wallets
 
 
 
31
  */
32
- class Neteller extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by mer-chant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
-
83
- /**
84
- * Email address of the Customer
85
- *
86
- * @var string
87
- */
88
- protected $customer_email;
89
-
90
- /**
91
- * Phone number of the customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_phone;
96
 
97
  /**
98
  * Neteller Account Id
@@ -109,210 +56,12 @@ class Neteller extends \Genesis\API\Request
109
  protected $account_password;
110
 
111
  /**
112
- *Customer's Billing Address: First name
113
- *
114
- * @var string
115
- */
116
- protected $billing_first_name;
117
-
118
- /**
119
- * Customer's Billing Address: Last name
120
- *
121
- * @var string
122
- */
123
- protected $billing_last_name;
124
-
125
- /**
126
- * Customer's Billing Address: Part 1
127
- *
128
- * @var string
129
- */
130
- protected $billing_address1;
131
-
132
- /**
133
- * Customer's Billing Address: Part 2
134
- * @var string
135
- */
136
- protected $billing_address2;
137
-
138
- /**
139
- * Customer's Billing Address: ZIP
140
- *
141
- * @var string
142
- */
143
- protected $billing_zip_code;
144
-
145
- /**
146
- * Customer's Billing Address: City
147
- *
148
- * @var string
149
- */
150
- protected $billing_city;
151
-
152
- /**
153
- * Customer's Billing Address: State
154
- *
155
- * format: ISO-3166-2
156
- *
157
- * @var string
158
  */
159
- protected $billing_state;
160
-
161
- /**
162
- * Customer's Billing Address: Country
163
- *
164
- * format: ISO-3166
165
- *
166
- * @var string
167
- */
168
- protected $billing_country;
169
-
170
- /**
171
- * Customer's Shipping Address: First name
172
- *
173
- * @var string
174
- */
175
- protected $shipping_first_name;
176
-
177
- /**
178
- * Customer's Shipping Address: Last name
179
- *
180
- * @var string
181
- */
182
- protected $shipping_last_name;
183
-
184
- /**
185
- * Customer's Shipping Address: Part 1
186
- *
187
- * @var string
188
- */
189
- protected $shipping_address1;
190
-
191
- /**
192
- * Customer's Shipping Address: Part 2
193
- *
194
- * @var string
195
- */
196
- protected $shipping_address2;
197
-
198
- /**
199
- * Customer's Shipping Address: ZIP
200
- *
201
- * @var string
202
- */
203
- protected $shipping_zip_code;
204
-
205
- /**
206
- * Customer's Shipping Address: City
207
- *
208
- * @var string
209
- */
210
- protected $shipping_city;
211
-
212
- /**
213
- * Customer's Shipping Address: State
214
- *
215
- * format: ISO-3166-2
216
- *
217
- * @var string
218
- */
219
- protected $shipping_state;
220
-
221
- /**
222
- * Customer's Shipping Address
223
- *
224
- * format: ISO-3166
225
- *
226
- * @var string
227
- */
228
- protected $shipping_country;
229
-
230
- /**
231
- * Social Security number or equivalent value for non US customers.
232
- *
233
- * @var string
234
- */
235
- protected $risk_ssn;
236
-
237
- /**
238
- * Customer's MAC address
239
- *
240
- * @var string
241
- */
242
- protected $risk_mac_address;
243
-
244
- /**
245
- * Customer's Session Id
246
- *
247
- * @var string
248
- */
249
- protected $risk_session_id;
250
-
251
- /**
252
- * Customer's User Id
253
- *
254
- * @var string
255
- */
256
- protected $risk_user_id;
257
-
258
- /**
259
- * Customer's User Level
260
- *
261
- * @var string
262
- */
263
- protected $risk_user_level;
264
-
265
- /**
266
- * Customer's Email address
267
- *
268
- * @note Set here if different from
269
- * shipping / billing
270
- *
271
- * @var string
272
- */
273
- protected $risk_email;
274
-
275
- /**
276
- * Customer's Phone number
277
- *
278
- * @note Set here if different from
279
- * shipping / billing
280
- *
281
- * @var string
282
- */
283
- protected $risk_phone;
284
-
285
- /**
286
- * Customer's IP address
287
- *
288
- * @note Set here if different from remote_ip
289
- *
290
- * @var string
291
- */
292
- protected $risk_remote_ip;
293
-
294
- /**
295
- * Customer's Serial Number
296
- *
297
- * @var string
298
- */
299
- protected $risk_serial_number;
300
-
301
- /**
302
- * Set the per-request configuration
303
- *
304
- * @return void
305
- */
306
- protected function initConfiguration()
307
  {
308
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
309
- 'protocol' => 'https',
310
- 'port' => 443,
311
- 'type' => 'POST',
312
- 'format' => 'xml',
313
- ));
314
-
315
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
316
  }
317
 
318
  /**
@@ -322,7 +71,7 @@ class Neteller extends \Genesis\API\Request
322
  */
323
  protected function setRequiredFields()
324
  {
325
- $requiredFields = array(
326
  'transaction_id',
327
  'remote_ip',
328
  'amount',
@@ -332,72 +81,36 @@ class Neteller extends \Genesis\API\Request
332
  'customer_email',
333
  'customer_account',
334
  'account_password',
335
- );
 
336
 
337
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
338
  }
339
 
340
  /**
341
- * Create the request's Tree structure
342
- *
343
- * @return void
344
  */
345
- protected function populateStructure()
346
  {
347
- $treeStructure = array(
348
- 'payment_transaction' => array(
349
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::NETELLER,
350
- 'transaction_id' => $this->transaction_id,
351
- 'usage' => $this->usage,
352
- 'remote_ip' => $this->remote_ip,
353
- 'return_success_url' => $this->return_success_url,
354
- 'return_failure_url' => $this->return_failure_url,
355
- 'amount' => $this->transform(
356
- 'amount',
357
- array(
358
- $this->amount,
359
- $this->currency,
360
- )
361
- ),
362
- 'currency' => $this->currency,
363
- 'customer_email' => $this->customer_email,
364
- 'customer_phone' => $this->customer_phone,
365
- 'customer_account' => $this->customer_account,
366
- 'account_password' => $this->account_password,
367
- 'billing_address' => array(
368
- 'first_name' => $this->billing_first_name,
369
- 'last_name' => $this->billing_last_name,
370
- 'address1' => $this->billing_address1,
371
- 'address2' => $this->billing_address2,
372
- 'zip_code' => $this->billing_zip_code,
373
- 'city' => $this->billing_city,
374
- 'state' => $this->billing_state,
375
- 'country' => $this->billing_country,
376
- ),
377
- 'shipping_address' => array(
378
- 'first_name' => $this->shipping_first_name,
379
- 'last_name' => $this->shipping_last_name,
380
- 'address1' => $this->shipping_address1,
381
- 'address2' => $this->shipping_address2,
382
- 'zip_code' => $this->shipping_zip_code,
383
- 'city' => $this->shipping_city,
384
- 'state' => $this->shipping_state,
385
- 'country' => $this->shipping_country,
386
- ),
387
- 'risk_params' => array(
388
- 'ssn' => $this->risk_ssn,
389
- 'mac_address' => $this->risk_mac_address,
390
- 'session_id' => $this->risk_session_id,
391
- 'user_id' => $this->risk_user_id,
392
- 'user_level' => $this->risk_user_level,
393
- 'email' => $this->risk_email,
394
- 'phone' => $this->risk_phone,
395
- 'remote_ip' => $this->risk_remote_ip,
396
- 'serial_number' => $this->risk_serial_number,
397
- ),
398
- )
399
- );
400
-
401
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
402
  }
403
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Wallets;
25
 
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
  /**
31
  * Class Neteller
32
  *
33
  * Electronic Wallet
34
  *
35
  * @package Genesis\API\Request\Financial\Wallets
36
+ *
37
+ * @method Neteller setCustomerAccount($value) Set Neteller Account Id
38
+ * @method Neteller setAccountPassword($value) Set Neteller Account Password
39
  */
40
+ class Neteller extends \Genesis\API\Request\Base\Financial
41
  {
42
+ use PaymentAttributes, AsyncAttributes, AddressInfoAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  /**
45
  * Neteller Account Id
56
  protected $account_password;
57
 
58
  /**
59
+ * Returns the Request transaction type
60
+ * @return string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  */
62
+ protected function getTransactionType()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  {
64
+ return \Genesis\API\Constants\Transaction\Types::NETELLER;
 
 
 
 
 
 
 
65
  }
66
 
67
  /**
71
  */
72
  protected function setRequiredFields()
73
  {
74
+ $requiredFields = [
75
  'transaction_id',
76
  'remote_ip',
77
  'amount',
81
  'customer_email',
82
  'customer_account',
83
  'account_password',
84
+ 'billing_country'
85
+ ];
86
 
87
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
88
+
89
+ $requiredFieldValues = [
90
+ 'billing_country' => \Genesis\Utils\Country::getList(),
91
+ 'currency' => \Genesis\Utils\Currency::getList()
92
+ ];
93
+
94
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
95
  }
96
 
97
  /**
98
+ * Return additional request attributes
99
+ * @return array
 
100
  */
101
+ protected function getPaymentTransactionStructure()
102
  {
103
+ return [
104
+ 'return_success_url' => $this->return_success_url,
105
+ 'return_failure_url' => $this->return_failure_url,
106
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
107
+ 'currency' => $this->currency,
108
+ 'customer_email' => $this->customer_email,
109
+ 'customer_phone' => $this->customer_phone,
110
+ 'customer_account' => $this->customer_account,
111
+ 'account_password' => $this->account_password,
112
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
113
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
114
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
  }
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/WebMoney.php CHANGED
@@ -20,65 +20,25 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Wallets;
24
 
 
 
 
 
25
  /**
26
  * Class WebMoney
27
  *
28
  * Electronic Wallet
29
  *
30
  * @package Genesis\API\Request\Financial\Wallets
 
 
31
  */
32
- class WebMoney extends \Genesis\API\Request
33
  {
34
- /**
35
- * Unique transaction id defined by merchant
36
- *
37
- * @var string
38
- */
39
- protected $transaction_id;
40
-
41
- /**
42
- * Description of the transaction for later use
43
- *
44
- * @var string
45
- */
46
- protected $usage;
47
-
48
- /**
49
- * IPv4 address of customer
50
- *
51
- * @var string
52
- */
53
- protected $remote_ip;
54
-
55
- /**
56
- * URL where customer is sent to after successful payment
57
- *
58
- * @var string
59
- */
60
- protected $return_success_url;
61
-
62
- /**
63
- * URL where customer is sent to after un-successful payment
64
- *
65
- * @var string
66
- */
67
- protected $return_failure_url;
68
-
69
- /**
70
- * Amount of transaction in minor currency unit
71
- *
72
- * @var int
73
- */
74
- protected $amount;
75
-
76
- /**
77
- * Currency code in ISO-4217
78
- *
79
- * @var string
80
- */
81
- protected $currency;
82
 
83
  /**
84
  * Flag for payout transaction
@@ -88,224 +48,41 @@ class WebMoney extends \Genesis\API\Request
88
  protected $is_payout;
89
 
90
  /**
91
- * Email address of the Customer
92
- *
93
- * @var string
94
- */
95
- protected $customer_email;
96
-
97
- /**
98
- * Phone number of the customer
99
- *
100
- * @var string
101
- */
102
- protected $customer_phone;
103
-
104
- /**
105
- *Customer's Billing Address: First name
106
- *
107
- * @var string
108
- */
109
- protected $billing_first_name;
110
-
111
- /**
112
- * Customer's Billing Address: Last name
113
- *
114
- * @var string
115
- */
116
- protected $billing_last_name;
117
-
118
- /**
119
- * Customer's Billing Address: Part 1
120
- *
121
- * @var string
122
- */
123
- protected $billing_address1;
124
-
125
- /**
126
- * Customer's Billing Address: Part 2
127
- * @var string
128
- */
129
- protected $billing_address2;
130
-
131
- /**
132
- * Customer's Billing Address: ZIP
133
- *
134
- * @var string
135
- */
136
- protected $billing_zip_code;
137
-
138
- /**
139
- * Customer's Billing Address: City
140
- *
141
- * @var string
142
- */
143
- protected $billing_city;
144
-
145
- /**
146
- * Customer's Billing Address: State
147
- *
148
- * format: ISO-3166-2
149
- *
150
- * @var string
151
- */
152
- protected $billing_state;
153
-
154
- /**
155
- * Customer's Billing Address: Country
156
- *
157
- * format: ISO-3166
158
  *
159
  * @var string
160
  */
161
- protected $billing_country;
162
 
163
  /**
164
- * Customer's Shipping Address: First name
165
- *
166
- * @var string
167
  */
168
- protected $shipping_first_name;
169
-
170
- /**
171
- * Customer's Shipping Address: Last name
172
- *
173
- * @var string
174
- */
175
- protected $shipping_last_name;
176
-
177
- /**
178
- * Customer's Shipping Address: Part 1
179
- *
180
- * @var string
181
- */
182
- protected $shipping_address1;
183
-
184
- /**
185
- * Customer's Shipping Address: Part 2
186
- *
187
- * @var string
188
- */
189
- protected $shipping_address2;
190
-
191
- /**
192
- * Customer's Shipping Address: ZIP
193
- *
194
- * @var string
195
- */
196
- protected $shipping_zip_code;
197
-
198
- /**
199
- * Customer's Shipping Address: City
200
- *
201
- * @var string
202
- */
203
- protected $shipping_city;
204
-
205
- /**
206
- * Customer's Shipping Address: State
207
- *
208
- * format: ISO-3166-2
209
- *
210
- * @var string
211
- */
212
- protected $shipping_state;
213
-
214
- /**
215
- * Customer's Shipping Address
216
- *
217
- * format: ISO-3166
218
- *
219
- * @var string
220
- */
221
- protected $shipping_country;
222
-
223
- /**
224
- * Social Security number or equivalent value for non US customers.
225
- *
226
- * @var string
227
- */
228
- protected $risk_ssn;
229
-
230
- /**
231
- * Customer's MAC address
232
- *
233
- * @var string
234
- */
235
- protected $risk_mac_address;
236
-
237
- /**
238
- * Customer's Session Id
239
- *
240
- * @var string
241
- */
242
- protected $risk_session_id;
243
-
244
- /**
245
- * Customer's User Id
246
- *
247
- * @var string
248
- */
249
- protected $risk_user_id;
250
-
251
- /**
252
- * Customer's User Level
253
- *
254
- * @var string
255
- */
256
- protected $risk_user_level;
257
-
258
- /**
259
- * Customer's Email address
260
- *
261
- * @note Set here if different from
262
- * shipping / billing
263
- *
264
- * @var string
265
- */
266
- protected $risk_email;
267
-
268
- /**
269
- * Customer's Phone number
270
- *
271
- * @note Set here if different from
272
- * shipping / billing
273
- *
274
- * @var string
275
- */
276
- protected $risk_phone;
277
 
278
- /**
279
- * Customer's IP address
280
- *
281
- * @note Set here if different from remote_ip
282
- *
283
- * @var string
284
- */
285
- protected $risk_remote_ip;
286
 
287
  /**
288
- * Customer's Serial Number
289
- *
290
- * @var string
291
  */
292
- protected $risk_serial_number;
 
 
 
293
 
294
  /**
295
- * Set the per-request configuration
296
- *
297
- * @return void
298
  */
299
- protected function initConfiguration()
300
  {
301
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
302
- 'protocol' => 'https',
303
- 'port' => 443,
304
- 'type' => 'POST',
305
- 'format' => 'xml',
306
- ));
307
 
308
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
309
  }
310
 
311
  /**
@@ -315,7 +92,7 @@ class WebMoney extends \Genesis\API\Request
315
  */
316
  protected function setRequiredFields()
317
  {
318
- $requiredFields = array(
319
  'transaction_id',
320
  'remote_ip',
321
  'amount',
@@ -323,71 +100,46 @@ class WebMoney extends \Genesis\API\Request
323
  'return_success_url',
324
  'return_failure_url',
325
  'customer_email',
326
- );
 
327
 
328
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  }
330
 
331
  /**
332
- * Create the request's Tree structure
333
- *
334
- * @return void
335
  */
336
- protected function populateStructure()
337
  {
338
- $treeStructure = array(
339
- 'payment_transaction' => array(
340
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::WEBMONEY,
341
- 'transaction_id' => $this->transaction_id,
342
- 'usage' => $this->usage,
343
- 'remote_ip' => $this->remote_ip,
344
- 'return_success_url' => $this->return_success_url,
345
- 'return_failure_url' => $this->return_failure_url,
346
- 'amount' => $this->transform(
347
- 'amount',
348
- array(
349
- $this->amount,
350
- $this->currency,
351
- )
352
- ),
353
- 'currency' => $this->currency,
354
- 'is_payout' => $this->is_payout,
355
- 'customer_email' => $this->customer_email,
356
- 'customer_phone' => $this->customer_phone,
357
- 'billing_address' => array(
358
- 'first_name' => $this->billing_first_name,
359
- 'last_name' => $this->billing_last_name,
360
- 'address1' => $this->billing_address1,
361
- 'address2' => $this->billing_address2,
362
- 'zip_code' => $this->billing_zip_code,
363
- 'city' => $this->billing_city,
364
- 'state' => $this->billing_state,
365
- 'country' => $this->billing_country,
366
- ),
367
- 'shipping_address' => array(
368
- 'first_name' => $this->shipping_first_name,
369
- 'last_name' => $this->shipping_last_name,
370
- 'address1' => $this->shipping_address1,
371
- 'address2' => $this->shipping_address2,
372
- 'zip_code' => $this->shipping_zip_code,
373
- 'city' => $this->shipping_city,
374
- 'state' => $this->shipping_state,
375
- 'country' => $this->shipping_country,
376
- ),
377
- 'risk_params' => array(
378
- 'ssn' => $this->risk_ssn,
379
- 'mac_address' => $this->risk_mac_address,
380
- 'session_id' => $this->risk_session_id,
381
- 'user_id' => $this->risk_user_id,
382
- 'user_level' => $this->risk_user_level,
383
- 'email' => $this->risk_email,
384
- 'phone' => $this->risk_phone,
385
- 'remote_ip' => $this->risk_remote_ip,
386
- 'serial_number' => $this->risk_serial_number,
387
- ),
388
- )
389
- );
390
-
391
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
392
  }
393
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Wallets;
25
 
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
28
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
29
+
30
  /**
31
  * Class WebMoney
32
  *
33
  * Electronic Wallet
34
  *
35
  * @package Genesis\API\Request\Financial\Wallets
36
+ *
37
+ * @method WebMoney setCustomerAccountId($value) Set Webmoney account ID (WMID)
38
  */
39
+ class WebMoney extends \Genesis\API\Request\Base\Financial
40
  {
41
+ use PaymentAttributes, AsyncAttributes, AddressInfoAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  /**
44
  * Flag for payout transaction
48
  protected $is_payout;
49
 
50
  /**
51
+ * Webmoney account ID (WMID)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  *
53
  * @var string
54
  */
55
+ protected $customer_account_id;
56
 
57
  /**
58
+ * WebMoney constructor
 
 
59
  */
60
+ public function __construct()
61
+ {
62
+ parent::__construct();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ $this->setIsPayout(false);
65
+ }
 
 
 
 
 
 
66
 
67
  /**
68
+ * Returns the Request transaction type
69
+ * @return string
 
70
  */
71
+ protected function getTransactionType()
72
+ {
73
+ return \Genesis\API\Constants\Transaction\Types::WEBMONEY;
74
+ }
75
 
76
  /**
77
+ * Set Flag for payout transaction
78
+ * @param bool|int|string $value
79
+ * @return $this
80
  */
81
+ public function setIsPayout($value)
82
  {
83
+ $this->is_payout = filter_var($value, FILTER_VALIDATE_BOOLEAN);
 
 
 
 
 
84
 
85
+ return $this;
86
  }
87
 
88
  /**
92
  */
93
  protected function setRequiredFields()
94
  {
95
+ $requiredFields = [
96
  'transaction_id',
97
  'remote_ip',
98
  'amount',
100
  'return_success_url',
101
  'return_failure_url',
102
  'customer_email',
103
+ 'billing_country'
104
+ ];
105
 
106
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
107
+
108
+ $requiredFieldValues = [
109
+ 'billing_country' => \Genesis\Utils\Country::getList(),
110
+ 'currency' => \Genesis\Utils\Currency::getList()
111
+ ];
112
+
113
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
114
+
115
+ $requiredFieldsConditional = [
116
+ 'is_payout' => [
117
+ true => [
118
+ 'customer_account_id'
119
+ ]
120
+ ]
121
+ ];
122
+
123
+ $this->requiredFieldsConditional = \Genesis\Utils\Common::createArrayObject($requiredFieldsConditional);
124
  }
125
 
126
  /**
127
+ * Return additional request attributes
128
+ * @return array
 
129
  */
130
+ protected function getPaymentTransactionStructure()
131
  {
132
+ return [
133
+ 'return_success_url' => $this->return_success_url,
134
+ 'return_failure_url' => $this->return_failure_url,
135
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
136
+ 'currency' => $this->currency,
137
+ 'is_payout' => var_export($this->is_payout, true),
138
+ 'customer_account_id' => $this->customer_account_id,
139
+ 'customer_email' => $this->customer_email,
140
+ 'customer_phone' => $this->customer_phone,
141
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
142
+ 'shipping_address' => $this->getShippingAddressParamsStructure()
143
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  }
145
  }
lib/Genesis/src/Genesis/API/Request/Financial/Wallets/eZeeWallet.php CHANGED
@@ -20,67 +20,28 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\Financial\Wallets;
24
 
 
 
 
 
25
  /**
26
  * Class eZeeWallet
27
  *
28
  * Electronic Wallet
29
  *
30
  * @package Genesis\API\Request\Financial\Wallets
 
 
 
31
  */
32
  // @codingStandardsIgnoreStart
33
- class eZeeWallet extends \Genesis\API\Request
34
  // @codingStandardsIgnoreEnd
35
  {
36
- /**
37
- * Unique transaction id defined by mer-chant
38
- *
39
- * @var string
40
- */
41
- protected $transaction_id;
42
-
43
- /**
44
- * Description of the transaction for later use
45
- *
46
- * @var string
47
- */
48
- protected $usage;
49
-
50
- /**
51
- * IPv4 address of customer
52
- *
53
- * @var string
54
- */
55
- protected $remote_ip;
56
-
57
- /**
58
- * Amount of transaction in minor currency unit
59
- *
60
- * @var int
61
- */
62
- protected $amount;
63
-
64
- /**
65
- * Currency code in ISO-4217
66
- *
67
- * @var string
68
- */
69
- protected $currency;
70
-
71
- /**
72
- * URL where customer is sent to after successful payment
73
- *
74
- * @var string
75
- */
76
- protected $return_success_url;
77
-
78
- /**
79
- * URL where customer is sent to after unsuccessful payment
80
- *
81
- * @var string
82
- */
83
- protected $return_failure_url;
84
 
85
  /**
86
  * Email address of consumer who owns the source wallet
@@ -97,20 +58,12 @@ class eZeeWallet extends \Genesis\API\Request
97
  protected $source_wallet_pwd;
98
 
99
  /**
100
- * Set the per-request configuration
101
- *
102
- * @return void
103
  */
104
- protected function initConfiguration()
105
  {
106
- $this->config = \Genesis\Utils\Common::createArrayObject(array(
107
- 'protocol' => 'https',
108
- 'port' => 443,
109
- 'type' => 'POST',
110
- 'format' => 'xml',
111
- ));
112
-
113
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
114
  }
115
 
116
  /**
@@ -120,55 +73,38 @@ class eZeeWallet extends \Genesis\API\Request
120
  */
121
  protected function setRequiredFields()
122
  {
123
- $requiredFields = array(
124
  'transaction_id',
125
  'amount',
126
  'currency',
127
  'return_success_url',
128
  'return_failure_url',
 
129
  'source_wallet_id',
130
- 'source_wallet_pwd',
131
- );
132
 
133
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
134
  }
135
 
136
  /**
137
- * Create the request's Tree structure
138
- *
139
- * @return void
140
  */
141
- protected function populateStructure()
142
  {
143
- $treeStructure = array(
144
- 'payment_transaction' => array(
145
- 'transaction_type' => \Genesis\API\Constants\Transaction\Types::EZEEWALLET,
146
- 'transaction_id' => $this->transaction_id,
147
- 'usage' => $this->usage,
148
- 'remote_ip' => $this->remote_ip,
149
- 'amount' => $this->transform(
150
- 'amount',
151
- array(
152
- $this->amount,
153
- $this->currency,
154
- )
155
- ),
156
- 'currency' => $this->currency,
157
- 'return_success_url' => $this->return_success_url,
158
- 'return_failure_url' => $this->return_failure_url,
159
- 'source_wallet_id' => $this->source_wallet_id,
160
- 'source_wallet_pwd' => $this->transform(
161
- 'wallet_password',
162
- array(
163
- $this->source_wallet_pwd
164
- )
165
- ),
166
- )
167
- );
168
-
169
- $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
170
  }
171
 
 
172
  /**
173
  * Apply transformation:
174
  *
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\Financial\Wallets;
25
 
26
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
27
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
28
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
29
+
30
  /**
31
  * Class eZeeWallet
32
  *
33
  * Electronic Wallet
34
  *
35
  * @package Genesis\API\Request\Financial\Wallets
36
+ *
37
+ * @method eZeeWallet setSourceWalletId($value) Set Email address of consumer who owns the source wallet
38
+ * @method eZeeWallet setSourceWalletPwd($value) Set the Password of consumer who owns the source wallet
39
  */
40
  // @codingStandardsIgnoreStart
41
+ class eZeeWallet extends \Genesis\API\Request\Base\Financial
42
  // @codingStandardsIgnoreEnd
43
  {
44
+ use PaymentAttributes, NotificationAttributes, AsyncAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  /**
47
  * Email address of consumer who owns the source wallet
58
  protected $source_wallet_pwd;
59
 
60
  /**
61
+ * Returns the Request transaction type
62
+ * @return string
 
63
  */
64
+ protected function getTransactionType()
65
  {
66
+ return \Genesis\API\Constants\Transaction\Types::EZEEWALLET;
 
 
 
 
 
 
 
67
  }
68
 
69
  /**
73
  */
74
  protected function setRequiredFields()
75
  {
76
+ $requiredFields = [
77
  'transaction_id',
78
  'amount',
79
  'currency',
80
  'return_success_url',
81
  'return_failure_url',
82
+ 'notification_url',
83
  'source_wallet_id',
84
+ 'source_wallet_pwd'
85
+ ];
86
 
87
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
88
  }
89
 
90
  /**
91
+ * Return additional request attributes
92
+ * @return array
 
93
  */
94
+ protected function getPaymentTransactionStructure()
95
  {
96
+ return [
97
+ 'amount' => $this->transformAmount($this->amount, $this->currency),
98
+ 'currency' => $this->currency,
99
+ 'return_success_url' => $this->return_success_url,
100
+ 'return_failure_url' => $this->return_failure_url,
101
+ 'notification_url' => $this->notification_url,
102
+ 'source_wallet_id' => $this->source_wallet_id,
103
+ 'source_wallet_pwd' => $this->transformWalletPassword($this->source_wallet_pwd)
104
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
+
108
  /**
109
  * Apply transformation:
110
  *
lib/Genesis/src/Genesis/API/Request/NonFinancial/AVS.php CHANGED
@@ -20,8 +20,15 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\NonFinancial;
24
 
 
 
 
 
 
 
25
  /**
26
  * Address Verification System Request
27
  *
@@ -30,274 +37,7 @@ namespace Genesis\API\Request\NonFinancial;
30
  */
31
  class AVS extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
49
- *
50
- * Contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $moto;
55
-
56
- /**
57
- * IPv4 address of customer
58
- *
59
- * @var string
60
- */
61
- protected $remote_ip;
62
-
63
- /**
64
- * Full name of customer as printed on credit card (first name and last name at least)
65
- *
66
- * @var string
67
- */
68
- protected $card_holder;
69
-
70
- /**
71
- * Complete CC number of customer
72
- *
73
- * @var int
74
- */
75
- protected $card_number;
76
-
77
- /**
78
- * CVV of CC, requirement is based on terminal configuration
79
- *
80
- * @var int
81
- */
82
- protected $cvv;
83
-
84
- /**
85
- * Expiration month as printed on credit card
86
- *
87
- * @var string (mm)
88
- */
89
- protected $expiration_month;
90
-
91
- /**
92
- * Expiration year as printed on credit card
93
- *
94
- * @var string (yyyy)
95
- */
96
- protected $expiration_year;
97
-
98
- /**
99
- * Email address of the Customer
100
- *
101
- * @var string
102
- */
103
- protected $customer_email;
104
-
105
- /**
106
- * Phone number of the customer
107
- *
108
- * @var string
109
- */
110
- protected $customer_phone;
111
-
112
- /**
113
- *Customer's Billing Address: First name
114
- *
115
- * @var string
116
- */
117
- protected $billing_first_name;
118
-
119
- /**
120
- * Customer's Billing Address: Last name
121
- *
122
- * @var string
123
- */
124
- protected $billing_last_name;
125
-
126
- /**
127
- * Customer's Billing Address: Part 1
128
- *
129
- * @var string
130
- */
131
- protected $billing_address1;
132
-
133
- /**
134
- * Customer's Billing Address: Part 2
135
- * @var string
136
- */
137
- protected $billing_address2;
138
-
139
- /**
140
- * Customer's Billing Address: ZIP
141
- *
142
- * @var string
143
- */
144
- protected $billing_zip_code;
145
-
146
- /**
147
- * Customer's Billing Address: City
148
- *
149
- * @var string
150
- */
151
- protected $billing_city;
152
-
153
- /**
154
- * Customer's Billing Address: State
155
- *
156
- * format: ISO-3166-2
157
- *
158
- * @var string
159
- */
160
- protected $billing_state;
161
-
162
- /**
163
- * Customer's Billing Address: Country
164
- *
165
- * format: ISO-3166
166
- *
167
- * @var string
168
- */
169
- protected $billing_country;
170
-
171
- /**
172
- * Customer's Shipping Address: First name
173
- *
174
- * @var string
175
- */
176
- protected $shipping_first_name;
177
-
178
- /**
179
- * Customer's Shipping Address: Last name
180
- *
181
- * @var string
182
- */
183
- protected $shipping_last_name;
184
-
185
- /**
186
- * Customer's Shipping Address: Part 1
187
- *
188
- * @var string
189
- */
190
- protected $shipping_address1;
191
-
192
- /**
193
- * Customer's Shipping Address: Part 2
194
- *
195
- * @var string
196
- */
197
- protected $shipping_address2;
198
-
199
- /**
200
- * Customer's Shipping Address: ZIP
201
- *
202
- * @var string
203
- */
204
- protected $shipping_zip_code;
205
-
206
- /**
207
- * Customer's Shipping Address: City
208
- *
209
- * @var string
210
- */
211
- protected $shipping_city;
212
-
213
- /**
214
- * Customer's Shipping Address: State
215
- *
216
- * format: ISO-3166-2
217
- *
218
- * @var string
219
- */
220
- protected $shipping_state;
221
-
222
- /**
223
- * Customer's Shipping Address
224
- *
225
- * format: ISO-3166
226
- *
227
- * @var string
228
- */
229
- protected $shipping_country;
230
-
231
- /**
232
- * Social Security number or equivalent value for non US customers.
233
- *
234
- * @var string
235
- */
236
- protected $risk_ssn;
237
-
238
- /**
239
- * Customer's MAC address
240
- *
241
- * @var string
242
- */
243
- protected $risk_mac_address;
244
-
245
- /**
246
- * Customer's Session Id
247
- *
248
- * @var string
249
- */
250
- protected $risk_session_id;
251
-
252
- /**
253
- * Customer's User Id
254
- *
255
- * @var string
256
- */
257
- protected $risk_user_id;
258
-
259
- /**
260
- * Customer's User Level
261
- *
262
- * @var string
263
- */
264
- protected $risk_user_level;
265
-
266
- /**
267
- * Customer's Email address
268
- *
269
- * @note Set here if different from
270
- * shipping / billing
271
- *
272
- * @var string
273
- */
274
- protected $risk_email;
275
-
276
- /**
277
- * Customer's Phone number
278
- *
279
- * @note Set here if different from
280
- * shipping / billing
281
- *
282
- * @var string
283
- */
284
- protected $risk_phone;
285
-
286
- /**
287
- * Customer's IP address
288
- *
289
- * @note Set here if different from remote_ip
290
- *
291
- * @var string
292
- */
293
- protected $risk_remote_ip;
294
-
295
- /**
296
- * Customer's Serial Number
297
- *
298
- * @var string
299
- */
300
- protected $risk_serial_number;
301
 
302
  /**
303
  * Set the per-request configuration
@@ -306,16 +46,9 @@ class AVS extends \Genesis\API\Request
306
  */
307
  protected function initConfiguration()
308
  {
309
- $this->config = \Genesis\Utils\Common::createArrayObject(
310
- array(
311
- 'protocol' => 'https',
312
- 'port' => 443,
313
- 'type' => 'POST',
314
- 'format' => 'xml',
315
- )
316
- );
317
 
318
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
319
  }
320
 
321
  /**
@@ -325,7 +58,7 @@ class AVS extends \Genesis\API\Request
325
  */
326
  protected function setRequiredFields()
327
  {
328
- $requiredFields = array(
329
  'transaction_id',
330
  'card_holder',
331
  'card_number',
@@ -333,10 +66,14 @@ class AVS extends \Genesis\API\Request
333
  'expiration_year',
334
  'billing_address1',
335
  'billing_zip_code',
336
- 'billing_city',
337
- );
338
 
339
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
340
  }
341
 
342
  /**
@@ -346,8 +83,8 @@ class AVS extends \Genesis\API\Request
346
  */
347
  protected function populateStructure()
348
  {
349
- $treeStructure = array(
350
- 'payment_transaction' => array(
351
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::AVS,
352
  'transaction_id' => $this->transaction_id,
353
  'usage' => $this->usage,
@@ -360,39 +97,12 @@ class AVS extends \Genesis\API\Request
360
  'expiration_year' => $this->expiration_year,
361
  'customer_email' => $this->customer_email,
362
  'customer_phone' => $this->customer_phone,
363
- 'billing_address' => array(
364
- 'first_name' => $this->billing_first_name,
365
- 'last_name' => $this->billing_last_name,
366
- 'address1' => $this->billing_address1,
367
- 'address2' => $this->billing_address2,
368
- 'zip_code' => $this->billing_zip_code,
369
- 'city' => $this->billing_city,
370
- 'state' => $this->billing_state,
371
- 'country' => $this->billing_country,
372
- ),
373
- 'shipping_address' => array(
374
- 'first_name' => $this->shipping_first_name,
375
- 'last_name' => $this->shipping_last_name,
376
- 'address1' => $this->shipping_address1,
377
- 'address2' => $this->shipping_address2,
378
- 'zip_code' => $this->shipping_zip_code,
379
- 'city' => $this->shipping_city,
380
- 'state' => $this->shipping_state,
381
- 'country' => $this->shipping_country,
382
- ),
383
- 'risk_params' => array(
384
- 'ssn' => $this->risk_ssn,
385
- 'mac_address' => $this->risk_mac_address,
386
- 'session_id' => $this->risk_session_id,
387
- 'user_id' => $this->risk_user_id,
388
- 'user_level' => $this->risk_user_level,
389
- 'email' => $this->risk_email,
390
- 'phone' => $this->risk_phone,
391
- 'remote_ip' => $this->risk_remote_ip,
392
- 'serial_number' => $this->risk_serial_number,
393
- )
394
- )
395
- );
396
 
397
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
398
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\NonFinancial;
25
 
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\BaseAttributes;
28
+ use Genesis\API\Traits\Request\CreditCardAttributes;
29
+ use Genesis\API\Traits\Request\MotoAttributes;
30
+ use Genesis\API\Traits\Request\RiskAttributes;
31
+
32
  /**
33
  * Address Verification System Request
34
  *
37
  */
38
  class AVS extends \Genesis\API\Request
39
  {
40
+ use BaseAttributes, MotoAttributes, CreditCardAttributes, AddressInfoAttributes, RiskAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  /**
43
  * Set the per-request configuration
46
  */
47
  protected function initConfiguration()
48
  {
49
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
50
 
51
+ $this->initApiGatewayConfiguration();
52
  }
53
 
54
  /**
58
  */
59
  protected function setRequiredFields()
60
  {
61
+ $requiredFields = [
62
  'transaction_id',
63
  'card_holder',
64
  'card_number',
66
  'expiration_year',
67
  'billing_address1',
68
  'billing_zip_code',
69
+ 'billing_city'
70
+ ];
71
 
72
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
73
+
74
+ $requiredFieldValues = $this->getCCFieldValueFormatValidators();
75
+
76
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
77
  }
78
 
79
  /**
83
  */
84
  protected function populateStructure()
85
  {
86
+ $treeStructure = [
87
+ 'payment_transaction' => [
88
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::AVS,
89
  'transaction_id' => $this->transaction_id,
90
  'usage' => $this->usage,
97
  'expiration_year' => $this->expiration_year,
98
  'customer_email' => $this->customer_email,
99
  'customer_phone' => $this->customer_phone,
100
+ 'birth_date' => $this->birth_date,
101
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
102
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
103
+ 'risk_params' => $this->getRiskParamsStructure()
104
+ ]
105
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
108
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/AccountVerification.php CHANGED
@@ -20,8 +20,15 @@
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
 
23
  namespace Genesis\API\Request\NonFinancial;
24
 
 
 
 
 
 
 
25
  /**
26
  * Account Verification Request
27
  *
@@ -30,274 +37,7 @@ namespace Genesis\API\Request\NonFinancial;
30
  */
31
  class AccountVerification extends \Genesis\API\Request
32
  {
33
- /**
34
- * Unique transaction id defined by merchant
35
- *
36
- * @var string
37
- */
38
- protected $transaction_id;
39
-
40
- /**
41
- * Description of the transaction for later use
42
- *
43
- * @var string
44
- */
45
- protected $usage;
46
-
47
- /**
48
- * Signifies whether a MOTO (mail order telephone order) transaction is performed.
49
- *
50
- * Contact tech support for more details.
51
- *
52
- * @var bool
53
- */
54
- protected $moto;
55
-
56
- /**
57
- * IPv4 address of customer
58
- *
59
- * @var string
60
- */
61
- protected $remote_ip;
62
-
63
- /**
64
- * Full name of customer as printed on credit card (first name and last name at least)
65
- *
66
- * @var string
67
- */
68
- protected $card_holder;
69
-
70
- /**
71
- * Complete CC number of customer
72
- *
73
- * @var int
74
- */
75
- protected $card_number;
76
-
77
- /**
78
- * CVV of CC, requirement is based on terminal configuration
79
- *
80
- * @var int
81
- */
82
- protected $cvv;
83
-
84
- /**
85
- * Expiration month as printed on credit card
86
- *
87
- * @var string (mm)
88
- */
89
- protected $expiration_month;
90
-
91
- /**
92
- * Expiration year as printed on credit card
93
- *
94
- * @var string (yyyy)
95
- */
96
- protected $expiration_year;
97
-
98
- /**
99
- * Email address of the Customer
100
- *
101
- * @var string
102
- */
103
- protected $customer_email;
104
-
105
- /**
106
- * Phone number of the customer
107
- *
108
- * @var string
109
- */
110
- protected $customer_phone;
111
-
112
- /**
113
- *Customer's Billing Address: First name
114
- *
115
- * @var string
116
- */
117
- protected $billing_first_name;
118
-
119
- /**
120
- * Customer's Billing Address: Last name
121
- *
122
- * @var string
123
- */
124
- protected $billing_last_name;
125
-
126
- /**
127
- * Customer's Billing Address: Part 1
128
- *
129
- * @var string
130
- */
131
- protected $billing_address1;
132
-
133
- /**
134
- * Customer's Billing Address: Part 2
135
- * @var string
136
- */
137
- protected $billing_address2;
138
-
139
- /**
140
- * Customer's Billing Address: ZIP
141
- *
142
- * @var string
143
- */
144
- protected $billing_zip_code;
145
-
146
- /**
147
- * Customer's Billing Address: City
148
- *
149
- * @var string
150
- */
151
- protected $billing_city;
152
-
153
- /**
154
- * Customer's Billing Address: State
155
- *
156
- * format: ISO-3166-2
157
- *
158
- * @var string
159
- */
160
- protected $billing_state;
161
-
162
- /**
163
- * Customer's Billing Address: Country
164
- *
165
- * format: ISO-3166
166
- *
167
- * @var string
168
- */
169
- protected $billing_country;
170
-
171
- /**
172
- * Customer's Shipping Address: First name
173
- *
174
- * @var string
175
- */
176
- protected $shipping_first_name;
177
-
178
- /**
179
- * Customer's Shipping Address: Last name
180
- *
181
- * @var string
182
- */
183
- protected $shipping_last_name;
184
-
185
- /**
186
- * Customer's Shipping Address: Part 1
187
- *
188
- * @var string
189
- */
190
- protected $shipping_address1;
191
-
192
- /**
193
- * Customer's Shipping Address: Part 2
194
- *
195
- * @var string
196
- */
197
- protected $shipping_address2;
198
-
199
- /**
200
- * Customer's Shipping Address: ZIP
201
- *
202
- * @var string
203
- */
204
- protected $shipping_zip_code;
205
-
206
- /**
207
- * Customer's Shipping Address: City
208
- *
209
- * @var string
210
- */
211
- protected $shipping_city;
212
-
213
- /**
214
- * Customer's Shipping Address: State
215
- *
216
- * format: ISO-3166-2
217
- *
218
- * @var string
219
- */
220
- protected $shipping_state;
221
-
222
- /**
223
- * Customer's Shipping Address
224
- *
225
- * format: ISO-3166
226
- *
227
- * @var string
228
- */
229
- protected $shipping_country;
230
-
231
- /**
232
- * Social Security number or equivalent value for non US customers.
233
- *
234
- * @var string
235
- */
236
- protected $risk_ssn;
237
-
238
- /**
239
- * Customer's MAC address
240
- *
241
- * @var string
242
- */
243
- protected $risk_mac_address;
244
-
245
- /**
246
- * Customer's Session Id
247
- *
248
- * @var string
249
- */
250
- protected $risk_session_id;
251
-
252
- /**
253
- * Customer's User Id
254
- *
255
- * @var string
256
- */
257
- protected $risk_user_id;
258
-
259
- /**
260
- * Customer's User Level
261
- *
262
- * @var string
263
- */
264
- protected $risk_user_level;
265
-
266
- /**
267
- * Customer's Email address
268
- *
269
- * @note Set here if different from
270
- * shipping / billing
271
- *
272
- * @var string
273
- */
274
- protected $risk_email;
275
-
276
- /**
277
- * Customer's Phone number
278
- *
279
- * @note Set here if different from
280
- * shipping / billing
281
- *
282
- * @var string
283
- */
284
- protected $risk_phone;
285
-
286
- /**
287
- * Customer's IP address
288
- *
289
- * @note Set here if different from remote_ip
290
- *
291
- * @var string
292
- */
293
- protected $risk_remote_ip;
294
-
295
- /**
296
- * Customer's Serial Number
297
- *
298
- * @var string
299
- */
300
- protected $risk_serial_number;
301
 
302
  /**
303
  * Set the per-request configuration
@@ -306,16 +46,9 @@ class AccountVerification extends \Genesis\API\Request
306
  */
307
  protected function initConfiguration()
308
  {
309
- $this->config = \Genesis\Utils\Common::createArrayObject(
310
- array(
311
- 'protocol' => 'https',
312
- 'port' => 443,
313
- 'type' => 'POST',
314
- 'format' => 'xml',
315
- )
316
- );
317
 
318
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'process', \Genesis\Config::getToken()));
319
  }
320
 
321
  /**
@@ -325,7 +58,7 @@ class AccountVerification extends \Genesis\API\Request
325
  */
326
  protected function setRequiredFields()
327
  {
328
- $requiredFields = array(
329
  'transaction_id',
330
  'card_holder',
331
  'card_number',
@@ -333,10 +66,14 @@ class AccountVerification extends \Genesis\API\Request
333
  'expiration_year',
334
  'billing_address1',
335
  'billing_zip_code',
336
- 'billing_city',
337
- );
338
 
339
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
 
 
 
 
340
  }
341
 
342
  /**
@@ -346,8 +83,8 @@ class AccountVerification extends \Genesis\API\Request
346
  */
347
  protected function populateStructure()
348
  {
349
- $treeStructure = array(
350
- 'payment_transaction' => array(
351
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::ACCOUNT_VERIFICATION,
352
  'transaction_id' => $this->transaction_id,
353
  'usage' => $this->usage,
@@ -360,39 +97,12 @@ class AccountVerification extends \Genesis\API\Request
360
  'expiration_year' => $this->expiration_year,
361
  'customer_email' => $this->customer_email,
362
  'customer_phone' => $this->customer_phone,
363
- 'billing_address' => array(
364
- 'first_name' => $this->billing_first_name,
365
- 'last_name' => $this->billing_last_name,
366
- 'address1' => $this->billing_address1,
367
- 'address2' => $this->billing_address2,
368
- 'zip_code' => $this->billing_zip_code,
369
- 'city' => $this->billing_city,
370
- 'state' => $this->billing_state,
371
- 'country' => $this->billing_country,
372
- ),
373
- 'shipping_address' => array(
374
- 'first_name' => $this->shipping_first_name,
375
- 'last_name' => $this->shipping_last_name,
376
- 'address1' => $this->shipping_address1,
377
- 'address2' => $this->shipping_address2,
378
- 'zip_code' => $this->shipping_zip_code,
379
- 'city' => $this->shipping_city,
380
- 'state' => $this->shipping_state,
381
- 'country' => $this->shipping_country,
382
- ),
383
- 'risk_params' => array(
384
- 'ssn' => $this->risk_ssn,
385
- 'mac_address' => $this->risk_mac_address,
386
- 'session_id' => $this->risk_session_id,
387
- 'user_id' => $this->risk_user_id,
388
- 'user_level' => $this->risk_user_level,
389
- 'email' => $this->risk_email,
390
- 'phone' => $this->risk_phone,
391
- 'remote_ip' => $this->risk_remote_ip,
392
- 'serial_number' => $this->risk_serial_number,
393
- )
394
- )
395
- );
396
 
397
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
398
  }
20
  *
21
  * @license http://opensource.org/licenses/MIT The MIT License
22
  */
23
+
24
  namespace Genesis\API\Request\NonFinancial;
25
 
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\BaseAttributes;
28
+ use Genesis\API\Traits\Request\CreditCardAttributes;
29
+ use Genesis\API\Traits\Request\MotoAttributes;
30
+ use Genesis\API\Traits\Request\RiskAttributes;
31
+
32
  /**
33
  * Account Verification Request
34
  *
37
  */
38
  class AccountVerification extends \Genesis\API\Request
39
  {
40
+ use BaseAttributes, MotoAttributes, CreditCardAttributes, AddressInfoAttributes, RiskAttributes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  /**
43
  * Set the per-request configuration
46
  */
47
  protected function initConfiguration()
48
  {
49
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
50
 
51
+ $this->initApiGatewayConfiguration();
52
  }
53
 
54
  /**
58
  */
59
  protected function setRequiredFields()
60
  {
61
+ $requiredFields = [
62
  'transaction_id',
63
  'card_holder',
64
  'card_number',
66
  'expiration_year',
67
  'billing_address1',
68
  'billing_zip_code',
69
+ 'billing_city'
70
+ ];
71
 
72
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
73
+
74
+ $requiredFieldValues = $this->getCCFieldValueFormatValidators();
75
+
76
+ $this->requiredFieldValues = \Genesis\Utils\Common::createArrayObject($requiredFieldValues);
77
  }
78
 
79
  /**
83
  */
84
  protected function populateStructure()
85
  {
86
+ $treeStructure = [
87
+ 'payment_transaction' => [
88
  'transaction_type' => \Genesis\API\Constants\Transaction\Types::ACCOUNT_VERIFICATION,
89
  'transaction_id' => $this->transaction_id,
90
  'usage' => $this->usage,
97
  'expiration_year' => $this->expiration_year,
98
  'customer_email' => $this->customer_email,
99
  'customer_phone' => $this->customer_phone,
100
+ 'birth_date' => $this->birth_date,
101
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
102
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
103
+ 'risk_params' => $this->getRiskParamsStructure()
104
+ ]
105
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
108
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Blacklist.php CHANGED
@@ -51,16 +51,9 @@ class Blacklist extends \Genesis\API\Request
51
  */
52
  protected function initConfiguration()
53
  {
54
- $this->config = \Genesis\Utils\Common::createArrayObject(
55
- array(
56
- 'protocol' => 'https',
57
- 'port' => 443,
58
- 'type' => 'POST',
59
- 'format' => 'xml',
60
- )
61
- );
62
 
63
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'blacklists', \Genesis\Config::getToken()));
64
  }
65
 
66
  /**
@@ -70,9 +63,9 @@ class Blacklist extends \Genesis\API\Request
70
  */
71
  protected function setRequiredFields()
72
  {
73
- $requiredFields = array(
74
- 'card_number',
75
- );
76
 
77
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
78
  }
@@ -84,12 +77,12 @@ class Blacklist extends \Genesis\API\Request
84
  */
85
  protected function populateStructure()
86
  {
87
- $treeStructure = array(
88
- 'blacklist_request' => array(
89
  'card_number' => $this->card_number,
90
- 'terminal_token' => $this->terminal_token,
91
- )
92
- );
93
 
94
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
95
  }
51
  */
52
  protected function initConfiguration()
53
  {
54
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
55
 
56
+ $this->initApiGatewayConfiguration('blacklists');
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFields = [
67
+ 'card_number'
68
+ ];
69
 
70
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
71
  }
77
  */
78
  protected function populateStructure()
79
  {
80
+ $treeStructure = [
81
+ 'blacklist_request' => [
82
  'card_number' => $this->card_number,
83
+ 'terminal_token' => $this->terminal_token
84
+ ]
85
+ ];
86
 
87
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
88
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/DateRange.php CHANGED
@@ -60,23 +60,9 @@ class DateRange extends \Genesis\API\Request
60
  */
61
  protected function initConfiguration()
62
  {
63
- $this->config = \Genesis\Utils\Common::createArrayObject(
64
- array(
65
- 'protocol' => 'https',
66
- 'port' => 443,
67
- 'type' => 'POST',
68
- 'format' => 'xml',
69
- )
70
- );
71
 
72
- $this->setApiConfig(
73
- 'url',
74
- $this->buildRequestURL(
75
- 'gateway',
76
- 'chargebacks/by_date',
77
- false
78
- )
79
- );
80
  }
81
 
82
  /**
@@ -86,9 +72,9 @@ class DateRange extends \Genesis\API\Request
86
  */
87
  protected function setRequiredFields()
88
  {
89
- $requiredFields = array(
90
- 'start_date',
91
- );
92
 
93
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
94
  }
@@ -100,13 +86,13 @@ class DateRange extends \Genesis\API\Request
100
  */
101
  protected function populateStructure()
102
  {
103
- $treeStructure = array(
104
- 'chargeback_request' => array(
105
  'start_date' => $this->start_date,
106
  'end_date' => $this->end_date,
107
- 'page' => $this->page,
108
- )
109
- );
110
 
111
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
112
  }
60
  */
61
  protected function initConfiguration()
62
  {
63
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
64
 
65
+ $this->initApiGatewayConfiguration('chargebacks/by_date', false);
 
 
 
 
 
 
 
66
  }
67
 
68
  /**
72
  */
73
  protected function setRequiredFields()
74
  {
75
+ $requiredFields = [
76
+ 'start_date'
77
+ ];
78
 
79
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
80
  }
86
  */
87
  protected function populateStructure()
88
  {
89
+ $treeStructure = [
90
+ 'chargeback_request' => [
91
  'start_date' => $this->start_date,
92
  'end_date' => $this->end_date,
93
+ 'page' => $this->page
94
+ ]
95
+ ];
96
 
97
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
98
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Chargeback/Transaction.php CHANGED
@@ -51,16 +51,9 @@ class Transaction extends \Genesis\API\Request
51
  */
52
  protected function initConfiguration()
53
  {
54
- $this->config = \Genesis\Utils\Common::createArrayObject(
55
- array(
56
- 'protocol' => 'https',
57
- 'port' => 443,
58
- 'type' => 'POST',
59
- 'format' => 'xml',
60
- )
61
- );
62
 
63
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'chargebacks', false));
64
  }
65
 
66
  /**
@@ -70,10 +63,10 @@ class Transaction extends \Genesis\API\Request
70
  */
71
  protected function setRequiredFields()
72
  {
73
- $requiredFieldsOR = array(
74
  'arn',
75
  'original_transaction_unique_id'
76
- );
77
 
78
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
79
  }
@@ -85,12 +78,12 @@ class Transaction extends \Genesis\API\Request
85
  */
86
  protected function populateStructure()
87
  {
88
- $treeStructure = array(
89
- 'chargeback_request' => array(
90
  'arn' => $this->arn,
91
- 'original_transaction_unique_id' => $this->original_transaction_unique_id,
92
- )
93
- );
94
 
95
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
96
  }
51
  */
52
  protected function initConfiguration()
53
  {
54
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
55
 
56
+ $this->initApiGatewayConfiguration('chargebacks', false);
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFieldsOR = [
67
  'arn',
68
  'original_transaction_unique_id'
69
+ ];
70
 
71
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
72
  }
78
  */
79
  protected function populateStructure()
80
  {
81
+ $treeStructure = [
82
+ 'chargeback_request' => [
83
  'arn' => $this->arn,
84
+ 'original_transaction_unique_id' => $this->original_transaction_unique_id
85
+ ]
86
+ ];
87
 
88
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
89
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/DateRange.php CHANGED
@@ -61,23 +61,9 @@ class DateRange extends \Genesis\API\Request
61
  */
62
  protected function initConfiguration()
63
  {
64
- $this->config = \Genesis\Utils\Common::createArrayObject(
65
- array(
66
- 'protocol' => 'https',
67
- 'port' => 443,
68
- 'type' => 'POST',
69
- 'format' => 'xml',
70
- )
71
- );
72
 
73
- $this->setApiConfig(
74
- 'url',
75
- $this->buildRequestURL(
76
- 'gateway',
77
- 'fraud_reports/by_date',
78
- false
79
- )
80
- );
81
  }
82
 
83
  /**
@@ -87,9 +73,9 @@ class DateRange extends \Genesis\API\Request
87
  */
88
  protected function setRequiredFields()
89
  {
90
- $requiredFields = array(
91
- 'start_date',
92
- );
93
 
94
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
95
  }
@@ -101,13 +87,13 @@ class DateRange extends \Genesis\API\Request
101
  */
102
  protected function populateStructure()
103
  {
104
- $treeStructure = array(
105
- 'fraud_report_request' => array(
106
  'start_date' => $this->start_date,
107
  'end_date' => $this->end_date,
108
- 'page' => $this->page,
109
- )
110
- );
111
 
112
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
113
  }
61
  */
62
  protected function initConfiguration()
63
  {
64
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
65
 
66
+ $this->initApiGatewayConfiguration('fraud_reports/by_date', false);
 
 
 
 
 
 
 
67
  }
68
 
69
  /**
73
  */
74
  protected function setRequiredFields()
75
  {
76
+ $requiredFields = [
77
+ 'start_date'
78
+ ];
79
 
80
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
81
  }
87
  */
88
  protected function populateStructure()
89
  {
90
+ $treeStructure = [
91
+ 'fraud_report_request' => [
92
  'start_date' => $this->start_date,
93
  'end_date' => $this->end_date,
94
+ 'page' => $this->page
95
+ ]
96
+ ];
97
 
98
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
99
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Reports/Transaction.php CHANGED
@@ -51,16 +51,9 @@ class Transaction extends \Genesis\API\Request
51
  */
52
  protected function initConfiguration()
53
  {
54
- $this->config = \Genesis\Utils\Common::createArrayObject(
55
- array(
56
- 'protocol' => 'https',
57
- 'port' => 443,
58
- 'type' => 'POST',
59
- 'format' => 'xml',
60
- )
61
- );
62
 
63
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'fraud_reports', false));
64
  }
65
 
66
  /**
@@ -70,10 +63,10 @@ class Transaction extends \Genesis\API\Request
70
  */
71
  protected function setRequiredFields()
72
  {
73
- $requiredFieldsOR = array(
74
  'arn',
75
  'original_transaction_unique_id'
76
- );
77
 
78
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
79
  }
@@ -85,12 +78,12 @@ class Transaction extends \Genesis\API\Request
85
  */
86
  protected function populateStructure()
87
  {
88
- $treeStructure = array(
89
- 'fraud_report_request' => array(
90
  'arn' => $this->arn,
91
  'original_transaction_unique_id' => $this->original_transaction_unique_id,
92
- )
93
- );
94
 
95
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
96
  }
51
  */
52
  protected function initConfiguration()
53
  {
54
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
55
 
56
+ $this->initApiGatewayConfiguration('fraud_reports', false);
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFieldsOR = [
67
  'arn',
68
  'original_transaction_unique_id'
69
+ ];
70
 
71
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
72
  }
78
  */
79
  protected function populateStructure()
80
  {
81
+ $treeStructure = [
82
+ 'fraud_report_request' => [
83
  'arn' => $this->arn,
84
  'original_transaction_unique_id' => $this->original_transaction_unique_id,
85
+ ]
86
+ ];
87
 
88
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
89
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/DateRange.php CHANGED
@@ -61,23 +61,9 @@ class DateRange extends \Genesis\API\Request
61
  */
62
  protected function initConfiguration()
63
  {
64
- $this->config = \Genesis\Utils\Common::createArrayObject(
65
- array(
66
- 'protocol' => 'https',
67
- 'port' => 443,
68
- 'type' => 'POST',
69
- 'format' => 'xml',
70
- )
71
- );
72
 
73
- $this->setApiConfig(
74
- 'url',
75
- $this->buildRequestURL(
76
- 'gateway',
77
- 'retrieval_requests/by_date',
78
- false
79
- )
80
- );
81
  }
82
 
83
  /**
@@ -87,9 +73,9 @@ class DateRange extends \Genesis\API\Request
87
  */
88
  protected function setRequiredFields()
89
  {
90
- $requiredFields = array(
91
- 'start_date',
92
- );
93
 
94
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
95
  }
@@ -101,13 +87,13 @@ class DateRange extends \Genesis\API\Request
101
  */
102
  protected function populateStructure()
103
  {
104
- $treeStructure = array(
105
- 'retrieval_request_request' => array(
106
  'start_date' => $this->start_date,
107
  'end_date' => $this->end_date,
108
- 'page' => $this->page,
109
- )
110
- );
111
 
112
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
113
  }
61
  */
62
  protected function initConfiguration()
63
  {
64
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
65
 
66
+ $this->initApiGatewayConfiguration('retrieval_requests/by_date', false);
 
 
 
 
 
 
 
67
  }
68
 
69
  /**
73
  */
74
  protected function setRequiredFields()
75
  {
76
+ $requiredFields = [
77
+ 'start_date'
78
+ ];
79
 
80
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
81
  }
87
  */
88
  protected function populateStructure()
89
  {
90
+ $treeStructure = [
91
+ 'retrieval_request_request' => [
92
  'start_date' => $this->start_date,
93
  'end_date' => $this->end_date,
94
+ 'page' => $this->page
95
+ ]
96
+ ];
97
 
98
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
99
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Fraud/Retrieval/Transaction.php CHANGED
@@ -51,16 +51,9 @@ class Transaction extends \Genesis\API\Request
51
  */
52
  protected function initConfiguration()
53
  {
54
- $this->config = \Genesis\Utils\Common::createArrayObject(
55
- array(
56
- 'protocol' => 'https',
57
- 'port' => 443,
58
- 'type' => 'POST',
59
- 'format' => 'xml',
60
- )
61
- );
62
 
63
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'retrieval_requests', false));
64
  }
65
 
66
  /**
@@ -70,10 +63,10 @@ class Transaction extends \Genesis\API\Request
70
  */
71
  protected function setRequiredFields()
72
  {
73
- $requiredFieldsOR = array(
74
  'arn',
75
  'original_transaction_unique_id'
76
- );
77
 
78
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
79
  }
@@ -85,12 +78,12 @@ class Transaction extends \Genesis\API\Request
85
  */
86
  protected function populateStructure()
87
  {
88
- $treeStructure = array(
89
- 'retrieval_request_request' => array(
90
  'arn' => $this->arn,
91
- 'original_transaction_unique_id' => $this->original_transaction_unique_id,
92
- )
93
- );
94
 
95
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
96
  }
51
  */
52
  protected function initConfiguration()
53
  {
54
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
55
 
56
+ $this->initApiGatewayConfiguration('retrieval_requests', false);
57
  }
58
 
59
  /**
63
  */
64
  protected function setRequiredFields()
65
  {
66
+ $requiredFieldsOR = [
67
  'arn',
68
  'original_transaction_unique_id'
69
+ ];
70
 
71
  $this->requiredFieldsOR = \Genesis\Utils\Common::createArrayObject($requiredFieldsOR);
72
  }
78
  */
79
  protected function populateStructure()
80
  {
81
+ $treeStructure = [
82
+ 'retrieval_request_request' => [
83
  'arn' => $this->arn,
84
+ 'original_transaction_unique_id' => $this->original_transaction_unique_id
85
+ ]
86
+ ];
87
 
88
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
89
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/DateRange.php CHANGED
@@ -60,16 +60,9 @@ class DateRange extends \Genesis\API\Request
60
  */
61
  protected function initConfiguration()
62
  {
63
- $this->config = \Genesis\Utils\Common::createArrayObject(
64
- array(
65
- 'protocol' => 'https',
66
- 'port' => 443,
67
- 'type' => 'POST',
68
- 'format' => 'xml',
69
- )
70
- );
71
 
72
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'reconcile/by_date', \Genesis\Config::getToken()));
73
  }
74
 
75
  /**
@@ -79,9 +72,9 @@ class DateRange extends \Genesis\API\Request
79
  */
80
  protected function setRequiredFields()
81
  {
82
- $requiredFields = array(
83
- 'start_date',
84
- );
85
 
86
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
87
  }
@@ -93,13 +86,13 @@ class DateRange extends \Genesis\API\Request
93
  */
94
  protected function populateStructure()
95
  {
96
- $treeStructure = array(
97
- 'reconcile' => array(
98
  'start_date' => $this->start_date,
99
  'end_date' => $this->end_date,
100
- 'page' => $this->page,
101
- )
102
- );
103
 
104
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
105
  }
60
  */
61
  protected function initConfiguration()
62
  {
63
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
64
 
65
+ $this->initApiGatewayConfiguration('reconcile/by_date');
66
  }
67
 
68
  /**
72
  */
73
  protected function setRequiredFields()
74
  {
75
+ $requiredFields = [
76
+ 'start_date'
77
+ ];
78
 
79
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
80
  }
86
  */
87
  protected function populateStructure()
88
  {
89
+ $treeStructure = [
90
+ 'reconcile' => [
91
  'start_date' => $this->start_date,
92
  'end_date' => $this->end_date,
93
+ 'page' => $this->page
94
+ ]
95
+ ];
96
 
97
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
98
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Reconcile/Transaction.php CHANGED
@@ -58,16 +58,9 @@ class Transaction extends \Genesis\API\Request
58
  */
59
  protected function initConfiguration()
60
  {
61
- $this->config = \Genesis\Utils\Common::createArrayObject(
62
- array(
63
- 'protocol' => 'https',
64
- 'port' => 443,
65
- 'type' => 'POST',
66
- 'format' => 'xml',
67
- )
68
- );
69
 
70
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'reconcile', \Genesis\Config::getToken()));
71
  }
72
 
73
  /**
@@ -77,9 +70,9 @@ class Transaction extends \Genesis\API\Request
77
  */
78
  protected function setRequiredFields()
79
  {
80
- $requiredFieldsGroups = array(
81
- 'id' => array('arn', 'transaction_id', 'unique_id'),
82
- );
83
 
84
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
85
  }
@@ -91,13 +84,13 @@ class Transaction extends \Genesis\API\Request
91
  */
92
  protected function populateStructure()
93
  {
94
- $treeStructure = array(
95
- 'reconcile' => array(
96
  'arn' => $this->arn,
97
  'transaction_id' => $this->transaction_id,
98
- 'unique_id' => $this->unique_id,
99
- )
100
- );
101
 
102
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
103
  }
58
  */
59
  protected function initConfiguration()
60
  {
61
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
62
 
63
+ $this->initApiGatewayConfiguration('reconcile');
64
  }
65
 
66
  /**
70
  */
71
  protected function setRequiredFields()
72
  {
73
+ $requiredFieldsGroups = [
74
+ 'id' => ['arn', 'transaction_id', 'unique_id']
75
+ ];
76
 
77
  $this->requiredFieldsGroups = \Genesis\Utils\Common::createArrayObject($requiredFieldsGroups);
78
  }
84
  */
85
  protected function populateStructure()
86
  {
87
+ $treeStructure = [
88
+ 'reconcile' => [
89
  'arn' => $this->arn,
90
  'transaction_id' => $this->transaction_id,
91
+ 'unique_id' => $this->unique_id
92
+ ]
93
+ ];
94
 
95
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
96
  }
lib/Genesis/src/Genesis/API/Request/NonFinancial/Retrieve/AbniDealBanks.php CHANGED
@@ -39,14 +39,14 @@ class AbniDealBanks extends \Genesis\API\Request
39
  protected function initConfiguration()
40
  {
41
  $this->config = \Genesis\Utils\Common::createArrayObject(
42
- array(
43
  'protocol' => 'https',
44
  'port' => 443,
45
  'type' => 'GET',
46
- 'format' => 'plain',
47
- )
48
  );
49
 
50
- $this->setApiConfig('url', $this->buildRequestURL('gateway', 'retrieve_abn_ideal_banks', false));
51
  }
52
  }
39
  protected function initConfiguration()
40
  {
41
  $this->config = \Genesis\Utils\Common::createArrayObject(
42
+ [
43
  'protocol' => 'https',
44
  'port' => 443,
45
  'type' => 'GET',
46
+ 'format' => 'plain'
47
+ ]
48
  );
49
 
50
+ $this->initApiGatewayConfiguration('retrieve_abn_ideal_banks', false);
51
  }
52
  }
lib/Genesis/src/Genesis/API/Request/WPF/Create.php CHANGED
@@ -22,14 +22,31 @@
22
  */
23
  namespace Genesis\API\Request\WPF;
24
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Web-Payment-Form Request
27
  *
28
  * @package Genesis
29
  * @subpackage Request
 
 
 
 
 
 
30
  */
31
  class Create extends \Genesis\API\Request
32
  {
 
 
 
33
  /**
34
  * unique transaction id defined by merchant
35
  *
@@ -37,20 +54,6 @@ class Create extends \Genesis\API\Request
37
  */
38
  protected $transaction_id;
39
 
40
- /**
41
- * Amount of transaction in minor currency unit
42
- *
43
- * @var int
44
- */
45
- protected $amount;
46
-
47
- /**
48
- * Currency code in ISO-4217
49
- *
50
- * @var string
51
- */
52
- protected $currency;
53
-
54
  /**
55
  * Statement, as it appears in the customer’s bank statement
56
  *
@@ -67,41 +70,6 @@ class Create extends \Genesis\API\Request
67
  */
68
  protected $description;
69
 
70
- /**
71
- * Email address of the Customer
72
- *
73
- * @var string
74
- */
75
- protected $customer_email;
76
-
77
- /**
78
- * Phone number of the customer
79
- *
80
- * @var string
81
- */
82
- protected $customer_phone;
83
-
84
- /**
85
- * URL endpoint for Genesis Notifications
86
- *
87
- * @var string
88
- */
89
- protected $notification_url;
90
-
91
- /**
92
- * URL where customer is sent to after successful payment
93
- *
94
- * @var string
95
- */
96
- protected $return_success_url;
97
-
98
- /**
99
- * URL where customer is sent to after un-successful payment
100
- *
101
- * @var string
102
- */
103
- protected $return_failure_url;
104
-
105
  /**
106
  * URL where the customer is sent to after they cancel the payment
107
  *
@@ -109,202 +77,12 @@ class Create extends \Genesis\API\Request
109
  */
110
  protected $return_cancel_url;
111
 
112
- /**
113
- *Customer's Billing Address: First name
114
- *
115
- * @var string
116
- */
117
- protected $billing_first_name;
118
-
119
- /**
120
- * Customer's Billing Address: Last name
121
- *
122
- * @var string
123
- */
124
- protected $billing_last_name;
125
-
126
- /**
127
- * Customer's Billing Address: Part 1
128
- *
129
- * @var string
130
- */
131
- protected $billing_address1;
132
-
133
- /**
134
- * Customer's Billing Address: Part 2
135
- * @var string
136
- */
137
- protected $billing_address2;
138
-
139
- /**
140
- * Customer's Billing Address: ZIP
141
- *
142
- * @var string
143
- */
144
- protected $billing_zip_code;
145
-
146
- /**
147
- * Customer's Billing Address: City
148
- *
149
- * @var string
150
- */
151
- protected $billing_city;
152
-
153
- /**
154
- * Customer's Billing Address: State
155
- *
156
- * format: ISO-3166-2
157
- *
158
- * @var string
159
- */
160
- protected $billing_state;
161
-
162
- /**
163
- * Customer's Billing Address: Country
164
- *
165
- * format: ISO-3166
166
- *
167
- * @var string
168
- */
169
- protected $billing_country;
170
-
171
- /**
172
- * Customer's Shipping Address: First name
173
- *
174
- * @var string
175
- */
176
- protected $shipping_first_name;
177
-
178
- /**
179
- * Customer's Shipping Address: Last name
180
- *
181
- * @var string
182
- */
183
- protected $shipping_last_name;
184
-
185
- /**
186
- * Customer's Shipping Address: Part 1
187
- *
188
- * @var string
189
- */
190
- protected $shipping_address1;
191
-
192
- /**
193
- * Customer's Shipping Address: Part 2
194
- *
195
- * @var string
196
- */
197
- protected $shipping_address2;
198
-
199
- /**
200
- * Customer's Shipping Address: ZIP
201
- *
202
- * @var string
203
- */
204
- protected $shipping_zip_code;
205
-
206
- /**
207
- * Customer's Shipping Address: City
208
- *
209
- * @var string
210
- */
211
- protected $shipping_city;
212
-
213
- /**
214
- * Customer's Shipping Address: State
215
- *
216
- * format: ISO-3166-2
217
- *
218
- * @var string
219
- */
220
- protected $shipping_state;
221
-
222
- /**
223
- * Customer's Shipping Address
224
- *
225
- * format: ISO-3166
226
- *
227
- * @var string
228
- */
229
- protected $shipping_country;
230
-
231
  /**
232
  * The transaction types that the merchant is willing to accept payments for
233
  *
234
  * @var array
235
  */
236
- protected $transaction_types = array();
237
-
238
- /**
239
- * Social Security number or equivalent value for non US customers.
240
- *
241
- * @var string
242
- */
243
- protected $risk_ssn;
244
-
245
- /**
246
- * Customer's MAC address
247
- *
248
- * @var string
249
- */
250
- protected $risk_mac_address;
251
-
252
- /**
253
- * Customer's Session Id
254
- *
255
- * @var string
256
- */
257
- protected $risk_session_id;
258
-
259
- /**
260
- * Customer's User Id
261
- *
262
- * @var string
263
- */
264
- protected $risk_user_id;
265
-
266
- /**
267
- * Customer's User Level
268
- *
269
- * @var string
270
- */
271
- protected $risk_user_level;
272
-
273
- /**
274
- * Customer's Email address
275
- *
276
- * @note Set here if different from
277
- * shipping / billing
278
- *
279
- * @var string
280
- */
281
- protected $risk_email;
282
-
283
- /**
284
- * Customer's Phone number
285
- *
286
- * @note Set here if different from
287
- * shipping / billing
288
- *
289
- * @var string
290
- */
291
- protected $risk_phone;
292
-
293
- /**
294
- * Customer's IP address
295
- *
296
- * @note Set here if different from remote_ip
297
- *
298
- * @var string
299
- */
300
- protected $risk_remote_ip;
301
-
302
- /**
303
- * Customer's Serial Number
304
- *
305
- * @var string
306
- */
307
- protected $risk_serial_number;
308
 
309
  /**
310
  * Add transaction type to the list of available types
@@ -315,18 +93,18 @@ class Create extends \Genesis\API\Request
315
  *
316
  * @return $this
317
  */
318
- public function addTransactionType($name, $parameters = array())
319
  {
320
  $this->verifyTransactionType($name, $parameters);
321
 
322
- $structure = array(
323
- 'transaction_type' => array(
324
- '@attributes' => array(
325
  'name' => $name
326
- ),
327
  $parameters
328
- )
329
- );
330
 
331
  array_push($this->transaction_types, $structure);
332
 
@@ -340,7 +118,7 @@ class Create extends \Genesis\API\Request
340
  * @param array $parameters
341
  * @throws \Genesis\Exceptions\ErrorParameter
342
  */
343
- protected function verifyTransactionType($transactionType, $parameters = array())
344
  {
345
  if (!\Genesis\API\Constants\Transaction\Types::isValidTransactionType($transactionType)) {
346
  throw new \Genesis\Exceptions\ErrorParameter(
@@ -351,57 +129,77 @@ class Create extends \Genesis\API\Request
351
  );
352
  }
353
 
354
- $transactionCustomRequiredParams = \Genesis\API\Constants\Transaction\Types::getCustomRequiredParameters(
355
  $transactionType
356
  );
357
 
358
- if (\Genesis\Utils\Common::isValidArray($transactionCustomRequiredParams)) {
359
- foreach ($transactionCustomRequiredParams as $customRequiredParam => $customRequiredParamValues) {
360
- if (!array_key_exists($customRequiredParam, $parameters)) {
361
- foreach ($parameters as $parameter) {
362
- if (!\Genesis\Utils\Common::isValidArray($parameter) ||
363
- !array_key_exists($customRequiredParam, $parameter)) {
364
- throw new \Genesis\Exceptions\ErrorParameter(
365
- sprintf(
366
- 'Empty (null) required parameter: %s for transaction type %s',
367
- $customRequiredParam,
368
- $transactionType
369
- )
370
- );
371
- }
372
- }
 
 
 
 
373
  }
374
 
375
- if (!empty($customRequiredParamValues) && \Genesis\Utils\Common::isValidArray($customRequiredParamValues)) {
376
- if (!\Genesis\Utils\Common::arrayContainsArrayItems($parameters)) {
377
- if (!in_array($parameters[$customRequiredParam], $customRequiredParamValues)) {
378
- sprintf(
379
- 'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
380
- $parameters[$customRequiredParam],
381
- $customRequiredParam,
382
- $transactionType
383
- );
384
- }
385
- }
386
- else {
387
- foreach ($parameters as $parameter) {
388
- if (!in_array($parameter[$customRequiredParam], $customRequiredParamValues)) {
389
- throw new \Genesis\Exceptions\ErrorParameter(
390
- sprintf(
391
- 'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
392
- $parameter[$customRequiredParam],
393
- $customRequiredParam,
394
- $transactionType
395
- )
396
- );
397
- }
398
- }
399
- }
400
  }
401
  }
402
  }
403
  }
404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  /**
406
  * Add ISO 639-1 language code to the URL
407
  *
@@ -441,14 +239,7 @@ class Create extends \Genesis\API\Request
441
  */
442
  protected function initConfiguration()
443
  {
444
- $this->config = \Genesis\Utils\Common::createArrayObject(
445
- array(
446
- 'protocol' => 'https',
447
- 'port' => 443,
448
- 'type' => 'POST',
449
- 'format' => 'xml',
450
- )
451
- );
452
 
453
  $this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf', false));
454
  }
@@ -460,7 +251,7 @@ class Create extends \Genesis\API\Request
460
  */
461
  protected function setRequiredFields()
462
  {
463
- $requiredFields = array(
464
  'transaction_id',
465
  'amount',
466
  'currency',
@@ -469,8 +260,8 @@ class Create extends \Genesis\API\Request
469
  'return_success_url',
470
  'return_failure_url',
471
  'return_cancel_url',
472
- 'transaction_types',
473
- );
474
 
475
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
476
  }
@@ -482,59 +273,32 @@ class Create extends \Genesis\API\Request
482
  */
483
  protected function populateStructure()
484
  {
485
- $treeStructure = array(
486
- 'wpf_payment' => array(
487
- 'transaction_id' => $this->transaction_id,
488
- 'amount' => $this->transform(
489
  'amount',
490
- array(
491
  $this->amount,
492
- $this->currency,
493
- )
494
- ),
495
- 'currency' => $this->currency,
496
- 'usage' => $this->usage,
497
- 'description' => $this->description,
498
- 'customer_email' => $this->customer_email,
499
- 'customer_phone' => $this->customer_phone,
500
- 'notification_url' => $this->notification_url,
501
- 'return_success_url' => $this->return_success_url,
502
- 'return_failure_url' => $this->return_failure_url,
503
- 'return_cancel_url' => $this->return_cancel_url,
504
- 'billing_address' => array(
505
- 'first_name' => $this->billing_first_name,
506
- 'last_name' => $this->billing_last_name,
507
- 'address1' => $this->billing_address1,
508
- 'address2' => $this->billing_address2,
509
- 'zip_code' => $this->billing_zip_code,
510
- 'city' => $this->billing_city,
511
- 'state' => $this->billing_state,
512
- 'country' => $this->billing_country,
513
- ),
514
- 'shipping_address' => array(
515
- 'first_name' => $this->shipping_first_name,
516
- 'last_name' => $this->shipping_last_name,
517
- 'address1' => $this->shipping_address1,
518
- 'address2' => $this->shipping_address2,
519
- 'zip_code' => $this->shipping_zip_code,
520
- 'city' => $this->shipping_city,
521
- 'state' => $this->shipping_state,
522
- 'country' => $this->shipping_country,
523
  ),
524
- 'transaction_types' => $this->transaction_types,
525
- 'risk_params' => array(
526
- 'ssn' => $this->risk_ssn,
527
- 'mac_address' => $this->risk_mac_address,
528
- 'session_id' => $this->risk_session_id,
529
- 'user_id' => $this->risk_user_id,
530
- 'user_level' => $this->risk_user_level,
531
- 'email' => $this->risk_email,
532
- 'phone' => $this->risk_phone,
533
- 'remote_ip' => $this->risk_remote_ip,
534
- 'serial_number' => $this->risk_serial_number,
535
- ),
536
- )
537
- );
 
 
538
 
539
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
540
  }
22
  */
23
  namespace Genesis\API\Request\WPF;
24
 
25
+ use Genesis\API\Traits\Request\Financial\PaymentAttributes;
26
+ use Genesis\API\Traits\Request\AddressInfoAttributes;
27
+ use Genesis\API\Traits\Request\Financial\AsyncAttributes;
28
+ use Genesis\API\Traits\Request\Financial\NotificationAttributes;
29
+ use Genesis\API\Traits\Request\RiskAttributes;
30
+ use Genesis\API\Traits\Request\Financial\DescriptorAttributes;
31
+ use Genesis\Utils\Common as CommonUtils;
32
+
33
  /**
34
  * Web-Payment-Form Request
35
  *
36
  * @package Genesis
37
  * @subpackage Request
38
+ *
39
+ * @method $this setTransactionId($value) Set a Unique Transaction id
40
+ * @method $this setUsage($value) Set the description of the transaction for later use
41
+ * @method $this setDescription($value) Set a text describing the reason of the payment
42
+
43
+ * @method $this setReturnCancelUrl($value) Set the URL where the customer is sent to after they cancel the payment
44
  */
45
  class Create extends \Genesis\API\Request
46
  {
47
+ use PaymentAttributes, AddressInfoAttributes, AsyncAttributes,
48
+ NotificationAttributes, RiskAttributes, DescriptorAttributes;
49
+
50
  /**
51
  * unique transaction id defined by merchant
52
  *
54
  */
55
  protected $transaction_id;
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * Statement, as it appears in the customer’s bank statement
59
  *
70
  */
71
  protected $description;
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  /**
74
  * URL where the customer is sent to after they cancel the payment
75
  *
77
  */
78
  protected $return_cancel_url;
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  /**
81
  * The transaction types that the merchant is willing to accept payments for
82
  *
83
  * @var array
84
  */
85
+ protected $transaction_types = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  /**
88
  * Add transaction type to the list of available types
93
  *
94
  * @return $this
95
  */
96
+ public function addTransactionType($name, $parameters = [])
97
  {
98
  $this->verifyTransactionType($name, $parameters);
99
 
100
+ $structure = [
101
+ 'transaction_type' => [
102
+ '@attributes' => [
103
  'name' => $name
104
+ ],
105
  $parameters
106
+ ]
107
+ ];
108
 
109
  array_push($this->transaction_types, $structure);
110
 
118
  * @param array $parameters
119
  * @throws \Genesis\Exceptions\ErrorParameter
120
  */
121
+ protected function verifyTransactionType($transactionType, $parameters = [])
122
  {
123
  if (!\Genesis\API\Constants\Transaction\Types::isValidTransactionType($transactionType)) {
124
  throw new \Genesis\Exceptions\ErrorParameter(
129
  );
130
  }
131
 
132
+ $txnCustomRequiredParams = \Genesis\API\Constants\Transaction\Types::getCustomRequiredParameters(
133
  $transactionType
134
  );
135
 
136
+ if (!CommonUtils::isValidArray($txnCustomRequiredParams)) {
137
+ return;
138
+ }
139
+
140
+ foreach ($txnCustomRequiredParams as $customRequiredParam => $customRequiredParamValues) {
141
+ $this->checkEmptyRequiredParamsFor($transactionType, $customRequiredParam, $parameters);
142
+
143
+ if (!CommonUtils::isValidArray($customRequiredParamValues)) {
144
+ continue;
145
+ }
146
+
147
+ if (!CommonUtils::arrayContainsArrayItems($parameters)) {
148
+ if (!in_array($parameters[$customRequiredParam], $customRequiredParamValues)) {
149
+ sprintf(
150
+ 'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
151
+ $parameters[$customRequiredParam],
152
+ $customRequiredParam,
153
+ $transactionType
154
+ );
155
  }
156
 
157
+ continue;
158
+ }
159
+
160
+ foreach ($parameters as $parameter) {
161
+ if (!in_array($parameter[$customRequiredParam], $customRequiredParamValues)) {
162
+ throw new \Genesis\Exceptions\ErrorParameter(
163
+ sprintf(
164
+ 'Invalid value (%s) for required parameter: %s (Transaction type: %s)',
165
+ $parameter[$customRequiredParam],
166
+ $customRequiredParam,
167
+ $transactionType
168
+ )
169
+ );
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
  }
172
  }
173
  }
174
 
175
+ /**
176
+ * Performs a check there is an empty required param for the passed transaction type
177
+ *
178
+ * @param string $transactionType
179
+ * @param string $customRequiredParam
180
+ * @param array $txnParameters
181
+ *
182
+ * @throws \Genesis\Exceptions\ErrorParameter
183
+ */
184
+ protected function checkEmptyRequiredParamsFor($transactionType, $customRequiredParam, $txnParameters = [])
185
+ {
186
+ if (CommonUtils::isArrayKeyExists($customRequiredParam, $txnParameters)) {
187
+ return;
188
+ }
189
+
190
+ foreach ($txnParameters as $parameter) {
191
+ if (!CommonUtils::isArrayKeyExists($customRequiredParam, $parameter)) {
192
+ throw new \Genesis\Exceptions\ErrorParameter(
193
+ sprintf(
194
+ 'Empty (null) required parameter: %s for transaction type %s',
195
+ $customRequiredParam,
196
+ $transactionType
197
+ )
198
+ );
199
+ }
200
+ }
201
+ }
202
+
203
  /**
204
  * Add ISO 639-1 language code to the URL
205
  *
239
  */
240
  protected function initConfiguration()
241
  {
242
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
243
 
244
  $this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf', false));
245
  }
251
  */
252
  protected function setRequiredFields()
253
  {
254
+ $requiredFields = [
255
  'transaction_id',
256
  'amount',
257
  'currency',
260
  'return_success_url',
261
  'return_failure_url',
262
  'return_cancel_url',
263
+ 'transaction_types'
264
+ ];
265
 
266
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
267
  }
273
  */
274
  protected function populateStructure()
275
  {
276
+ $treeStructure = [
277
+ 'wpf_payment' => [
278
+ 'transaction_id' => $this->transaction_id,
279
+ 'amount' => $this->transform(
280
  'amount',
281
+ [
282
  $this->amount,
283
+ $this->currency
284
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  ),
286
+ 'currency' => $this->currency,
287
+ 'usage' => $this->usage,
288
+ 'description' => $this->description,
289
+ 'customer_email' => $this->customer_email,
290
+ 'customer_phone' => $this->customer_phone,
291
+ 'notification_url' => $this->notification_url,
292
+ 'return_success_url' => $this->return_success_url,
293
+ 'return_failure_url' => $this->return_failure_url,
294
+ 'return_cancel_url' => $this->return_cancel_url,
295
+ 'billing_address' => $this->getBillingAddressParamsStructure(),
296
+ 'shipping_address' => $this->getShippingAddressParamsStructure(),
297
+ 'transaction_types' => $this->transaction_types,
298
+ 'risk_params' => $this->getRiskParamsStructure(),
299
+ 'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
300
+ ]
301
+ ];
302
 
303
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
304
  }
lib/Genesis/src/Genesis/API/Request/WPF/Reconcile.php CHANGED
@@ -44,14 +44,7 @@ class Reconcile extends \Genesis\API\Request
44
  */
45
  protected function initConfiguration()
46
  {
47
- $this->config = \Genesis\Utils\Common::createArrayObject(
48
- array(
49
- 'protocol' => 'https',
50
- 'port' => 443,
51
- 'type' => 'POST',
52
- 'format' => 'xml',
53
- )
54
- );
55
 
56
  $this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf/reconcile', false));
57
  }
@@ -63,9 +56,9 @@ class Reconcile extends \Genesis\API\Request
63
  */
64
  protected function setRequiredFields()
65
  {
66
- $requiredFields = array(
67
- 'unique_id',
68
- );
69
 
70
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
71
  }
@@ -77,11 +70,11 @@ class Reconcile extends \Genesis\API\Request
77
  */
78
  protected function populateStructure()
79
  {
80
- $treeStructure = array(
81
- 'wpf_reconcile' => array(
82
- 'unique_id' => $this->unique_id,
83
- )
84
- );
85
 
86
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
87
  }
44
  */
45
  protected function initConfiguration()
46
  {
47
+ $this->initXmlConfiguration();
 
 
 
 
 
 
 
48
 
49
  $this->setApiConfig('url', $this->buildRequestURL('wpf', 'wpf/reconcile', false));
50
  }
56
  */
57
  protected function setRequiredFields()
58
  {
59
+ $requiredFields = [
60
+ 'unique_id'
61
+ ];
62
 
63
  $this->requiredFields = \Genesis\Utils\Common::createArrayObject($requiredFields);
64
  }
70
  */
71
  protected function populateStructure()
72
  {
73
+ $treeStructure = [
74
+ 'wpf_reconcile' => [
75
+ 'unique_id' => $this->unique_id
76
+ ]
77
+ ];
78
 
79
  $this->treeStructure = \Genesis\Utils\Common::createArrayObject($treeStructure);
80
  }
lib/Genesis/src/Genesis/API/Response.php CHANGED
@@ -27,6 +27,8 @@ namespace Genesis\API;
27
  *
28
  * @package Genesis
29
  * @subpackage API
 
 
30
  */
31
  class Response
32
  {
@@ -92,6 +94,9 @@ class Response
92
  );
93
  }
94
 
 
 
 
95
  if (isset($this->responseObj->status)) {
96
  $state = new Constants\Transaction\States($this->responseObj->status);
97
 
@@ -109,9 +114,6 @@ class Response
109
  );
110
  }
111
  }
112
-
113
- // Apply per-field transformations
114
- $this->transform(array($this->responseObj));
115
  }
116
 
117
  /**
@@ -129,17 +131,10 @@ class Response
129
  );
130
 
131
  if ($status->isValid()) {
132
- if ($status->isError()) {
133
- $result = false;
134
- } else {
135
- $result = true;
136
- }
137
- } else {
138
- // return null if status is inapplicable
139
- $result = null;
140
  }
141
 
142
- return $result;
143
  }
144
 
145
  /**
@@ -166,11 +161,11 @@ class Response
166
  */
167
  public function suppressReconciliationException()
168
  {
169
- $instances = array(
170
  new \Genesis\API\Request\NonFinancial\Reconcile\DateRange(),
171
  new \Genesis\API\Request\NonFinancial\Reconcile\Transaction(),
172
  new \Genesis\API\Request\WPF\Reconcile()
173
- );
174
 
175
  if (isset($this->requestCtx) && isset($this->responseObj->unique_id)) {
176
  foreach ($instances as $instance) {
@@ -258,14 +253,14 @@ class Response
258
  */
259
  public static function transformObject(&$entry)
260
  {
261
- $filters = array(
262
  'transformFilterAmount',
263
  'transformFilterTimestamp'
264
- );
265
 
266
  foreach ($filters as $filter) {
267
  if (method_exists(__CLASS__, $filter)) {
268
- $result = call_user_func(array(__CLASS__, $filter), $entry);
269
 
270
  if ($result) {
271
  $entry = $result;
27
  *
28
  * @package Genesis
29
  * @subpackage API
30
+ *
31
+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
32
  */
33
  class Response
34
  {
94
  );
95
  }
96
 
97
+ // Apply per-field transformations
98
+ $this->transform([$this->responseObj]);
99
+
100
  if (isset($this->responseObj->status)) {
101
  $state = new Constants\Transaction\States($this->responseObj->status);
102
 
114
  );
115
  }
116
  }
 
 
 
117
  }
118
 
119
  /**
131
  );
132
 
133
  if ($status->isValid()) {
134
+ return !$status->isError();
 
 
 
 
 
 
 
135
  }
136
 
137
+ return null;
138
  }
139
 
140
  /**
161
  */
162
  public function suppressReconciliationException()
163
  {
164
+ $instances = [
165
  new \Genesis\API\Request\NonFinancial\Reconcile\DateRange(),
166
  new \Genesis\API\Request\NonFinancial\Reconcile\Transaction(),
167
  new \Genesis\API\Request\WPF\Reconcile()
168
+ ];
169
 
170
  if (isset($this->requestCtx) && isset($this->responseObj->unique_id)) {
171
  foreach ($instances as $instance) {
253
  */
254
  public static function transformObject(&$entry)
255
  {
256
+ $filters = [
257
  'transformFilterAmount',
258
  'transformFilterTimestamp'
259
+ ];
260
 
261
  foreach ($filters as $filter) {
262
  if (method_exists(__CLASS__, $filter)) {
263
+ $result = call_user_func([__CLASS__, $filter], $entry);
264
 
265
  if ($result) {
266
  $entry = $result;
lib/Genesis/src/Genesis/API/Traits/Request/AddressInfoAttributes.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request;
25
+
26
+ use Genesis\API\Traits\Request\CustomerAddress;
27
+
28
+ /**
29
+ * Trait AddressInfoAttributes
30
+ * @package Genesis\API\Traits\Request
31
+ */
32
+ trait AddressInfoAttributes
33
+ {
34
+ use CustomerAddress\BillingInfoAttributes,
35
+ CustomerAddress\CustomerInfoAttributes,
36
+ CustomerAddress\ShippingInfoAttributes;
37
+ }
lib/Genesis/src/Genesis/API/Traits/Request/BaseAttributes.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request;
25
+
26
+ /**
27
+ * Trait BaseAttributes
28
+ *
29
+ * Trait for all Financial Request Classes
30
+ *
31
+ * @package Genesis\API\Traits\Request
32
+ *
33
+ * @method $this setTransactionId($value) Set a Unique Transaction id
34
+ * @method $this setUsage($value) Set the description of the transaction for later use
35
+ * @method $this setRemoteIp($value) Set the IPv4 address of customer
36
+ */
37
+ trait BaseAttributes
38
+ {
39
+ /**
40
+ * Unique transaction id defined by merchant
41
+ *
42
+ * @var string
43
+ */
44
+ protected $transaction_id;
45
+
46
+ /**
47
+ * Description of the transaction for later use
48
+ *
49
+ * @var string
50
+ */
51
+ protected $usage;
52
+
53
+ /**
54
+ * IPv4 address of customer
55
+ *
56
+ * @var string
57
+ */
58
+ protected $remote_ip;
59
+ }
lib/Genesis/src/Genesis/API/Traits/Request/CreditCardAttributes.php ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request;
25
+
26
+ use Genesis\API\Validators\Request\RegexValidator;
27
+
28
+ /**
29
+ * Trait CreditCardAttributes
30
+ * @package Genesis\API\Traits\Request
31
+ *
32
+ * @method $this setCardHolder($value) Set Full name of customer as printed on credit card
33
+ * @method $this setCardNumber($value) Set Complete CC number of customer
34
+ * @method $this setCvv($value) Set CVV of CC, requirement is based on terminal configuration
35
+ * @method $this setExpirationMonth($value) Set Expiration month as printed on credit card
36
+ * @method $this setExpirationYear($value) Set Expiration year as printed on credit card
37
+ * @method $this setBirthDate($value) Set Birth date of the customer
38
+ */
39
+ trait CreditCardAttributes
40
+ {
41
+ /**
42
+ * Full name of customer as printed on credit card (first name and last name at least)
43
+ *
44
+ * @var string
45
+ */
46
+ protected $card_holder;
47
+
48
+ /**
49
+ * Complete CC number of customer
50
+ *
51
+ * @var int
52
+ */
53
+ protected $card_number;
54
+
55
+ /**
56
+ * CVV of CC, requirement is based on terminal configuration
57
+ *
58
+ * @var int
59
+ */
60
+ protected $cvv;
61
+
62
+ /**
63
+ * Expiration month as printed on credit card
64
+ *
65
+ * @var string (mm)
66
+ */
67
+ protected $expiration_month;
68
+
69
+ /**
70
+ * Expiration year as printed on credit card
71
+ *
72
+ * @var string (yyyy)
73
+ */
74
+ protected $expiration_year;
75
+
76
+ /**
77
+ * Birth date of the customer
78
+ *
79
+ * @var string
80
+ */
81
+ protected $birth_date;
82
+
83
+ /**
84
+ * Returns a list with all CC Validators
85
+ *
86
+ * @return array
87
+ */
88
+ protected function getCCFieldValueFormatValidators()
89
+ {
90
+ return [
91
+ 'card_holder' => $this->getCreditCardHolderValidator(),
92
+ 'card_number' => $this->getCreditCardNumberValidator(),
93
+ 'expiration_month' => $this->getCreditCardExpMonthValidator(),
94
+ 'expiration_year' => $this->getCreditCardExpYearValidator()
95
+ ];
96
+ }
97
+
98
+ /**
99
+ * Instance of CC Holder Validator
100
+ *
101
+ * @return RegexValidator
102
+ */
103
+ protected function getCreditCardHolderValidator()
104
+ {
105
+ return new RegexValidator(
106
+ RegexValidator::PATTERN_CREDIT_CARD_HOLDER
107
+ );
108
+ }
109
+
110
+ /**
111
+ * Instance of CC Number Format Validator
112
+ *
113
+ * @return RegexValidator
114
+ */
115
+ protected function getCreditCardNumberValidator()
116
+ {
117
+ return new RegexValidator(
118
+ RegexValidator::PATTERN_CREDIT_CARD_NUMBER
119
+ );
120
+ }
121
+
122
+ /**
123
+ * Instance of CC CVV Format Validator
124
+ *
125
+ * @return RegexValidator
126
+ */
127
+ protected function getCreditCardCVVValidator()
128
+ {
129
+ return new RegexValidator(
130
+ RegexValidator::PATTERN_CREDIT_CARD_CVV
131
+ );
132
+ }
133
+
134
+ /**
135
+ * Instance of CC Expiration Month Format Validator
136
+ *
137
+ * @return RegexValidator
138
+ */
139
+ protected function getCreditCardExpMonthValidator()
140
+ {
141
+ return new RegexValidator(
142
+ RegexValidator::PATTERN_CREDIT_CART_EXP_MONTH
143
+ );
144
+ }
145
+
146
+ /**
147
+ * Instance of CC Expiration Year Format Validator
148
+ *
149
+ * @return RegexValidator
150
+ */
151
+ protected function getCreditCardExpYearValidator()
152
+ {
153
+ return new RegexValidator(
154
+ RegexValidator::PATTERN_CREDIT_CART_EXP_YEAR
155
+ );
156
+ }
157
+ }
lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/BillingInfoAttributes.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\CustomerAddress;
25
+
26
+ /**
27
+ * Trait BillingInfoAttributes
28
+ * @package Genesis\API\Traits\Request\CustomerAddress
29
+ *
30
+ * @method $this setBillingFirstName($value) Set Customer's Billing Address: First name
31
+ * @method $this setBillingLastName($value) Set Customer's Billing Address: First name
32
+ * @method $this setBillingAddress1($value) Set Customer's Billing Address: Part 1
33
+ * @method $this setBillingAddress2($value) Set Customer's Billing Address: Part 2
34
+ * @method $this setBillingZipCode($value) Set Customer's Billing Address: ZIP
35
+ * @method $this setBillingCity($value) Set Customer's Billing Address: City
36
+ * @method $this setBillingState($value) Set Customer's Billing Address: State
37
+ * @method $this setBillingCountry($value) Set Customer's Billing Address: Country
38
+ */
39
+ trait BillingInfoAttributes
40
+ {
41
+ /**
42
+ * Customer's Billing Address: First name
43
+ *
44
+ * @var string
45
+ */
46
+ protected $billing_first_name;
47
+
48
+ /**
49
+ * Customer's Billing Address: Last name
50
+ *
51
+ * @var string
52
+ */
53
+ protected $billing_last_name;
54
+
55
+ /**
56
+ * Customer's Billing Address: Part 1
57
+ *
58
+ * @var string
59
+ */
60
+ protected $billing_address1;
61
+
62
+ /**
63
+ * Customer's Billing Address: Part 2
64
+ * @var string
65
+ */
66
+ protected $billing_address2;
67
+
68
+ /**
69
+ * Customer's Billing Address: ZIP
70
+ *
71
+ * @var string
72
+ */
73
+ protected $billing_zip_code;
74
+
75
+ /**
76
+ * Customer's Billing Address: City
77
+ *
78
+ * @var string
79
+ */
80
+ protected $billing_city;
81
+
82
+ /**
83
+ * Customer's Billing Address: State
84
+ *
85
+ * format: ISO-3166-2
86
+ *
87
+ * @var string
88
+ */
89
+ protected $billing_state;
90
+
91
+ /**
92
+ * Customer's Billing Address: Country
93
+ *
94
+ * format: ISO-3166
95
+ *
96
+ * @var string
97
+ */
98
+ protected $billing_country;
99
+
100
+ /**
101
+ * Builds an array list with all Params
102
+ *
103
+ * @return array
104
+ */
105
+ protected function getBillingAddressParamsStructure()
106
+ {
107
+ return [
108
+ 'first_name' => $this->billing_first_name,
109
+ 'last_name' => $this->billing_last_name,
110
+ 'address1' => $this->billing_address1,
111
+ 'address2' => $this->billing_address2,
112
+ 'zip_code' => $this->billing_zip_code,
113
+ 'city' => $this->billing_city,
114
+ 'state' => $this->billing_state,
115
+ 'country' => $this->billing_country
116
+ ];
117
+ }
118
+ }
lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/CustomerInfoAttributes.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\CustomerAddress;
25
+
26
+ /**
27
+ * Trait CustomerInfoAttributes
28
+ * @package Genesis\API\Traits\Request\CustomerAddress
29
+ *
30
+ * @method $this setCustomerEmail($value) Set Email address of the Customer
31
+ * @method $this setCustomerPhone($value) Set Phone number of the Customer
32
+ */
33
+ trait CustomerInfoAttributes
34
+ {
35
+ /**
36
+ * Email address of the Customer
37
+ *
38
+ * @var string
39
+ */
40
+ protected $customer_email;
41
+
42
+ /**
43
+ * Phone number of the customer
44
+ *
45
+ * @var string
46
+ */
47
+ protected $customer_phone;
48
+ }
lib/Genesis/src/Genesis/API/Traits/Request/CustomerAddress/ShippingInfoAttributes.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\CustomerAddress;
25
+
26
+ /**
27
+ * Trait ShippingInfoAttributes
28
+ * @package Genesis\API\Traits\Request\CustomerAddress
29
+ *
30
+ * @method $this setShippingFirstName($value) Set Customer's Shipping Address: First name
31
+ * @method $this setShippingLastName($value) Set Customer's Shipping Address: First name
32
+ * @method $this setShippingAddress1($value) Set Customer's Shipping Address: Part 1
33
+ * @method $this setShippingAddress2($value) Set Customer's Shipping Address: Part 2
34
+ * @method $this setShippingZipCode($value) Set Customer's Shipping Address: ZIP
35
+ * @method $this setShippingCity($value) Set Customer's Shipping Address: City
36
+ * @method $this setShippingState($value) Set Customer's Shipping Address: State
37
+ * @method $this setShippingCountry($value) Set Customer's Shipping Address: Country
38
+ */
39
+ trait ShippingInfoAttributes
40
+ {
41
+ /**
42
+ * Customer's Shipping Address: First name
43
+ *
44
+ * @var string
45
+ */
46
+ protected $shipping_first_name;
47
+
48
+ /**
49
+ * Customer's Shipping Address: Last name
50
+ *
51
+ * @var string
52
+ */
53
+ protected $shipping_last_name;
54
+
55
+ /**
56
+ * Customer's Shipping Address: Part 1
57
+ *
58
+ * @var string
59
+ */
60
+ protected $shipping_address1;
61
+
62
+ /**
63
+ * Customer's Shipping Address: Part 2
64
+ *
65
+ * @var string
66
+ */
67
+ protected $shipping_address2;
68
+
69
+ /**
70
+ * Customer's Shipping Address: ZIP
71
+ *
72
+ * @var string
73
+ */
74
+ protected $shipping_zip_code;
75
+
76
+ /**
77
+ * Customer's Shipping Address: City
78
+ *
79
+ * @var string
80
+ */
81
+ protected $shipping_city;
82
+
83
+ /**
84
+ * Customer's Shipping Address: State
85
+ *
86
+ * format: ISO-3166-2
87
+ *
88
+ * @var string
89
+ */
90
+ protected $shipping_state;
91
+
92
+ /**
93
+ * Customer's Shipping Address
94
+ *
95
+ * format: ISO-3166
96
+ *
97
+ * @var string
98
+ */
99
+ protected $shipping_country;
100
+
101
+ /**
102
+ * Builds an array list with all Params
103
+ *
104
+ * @return array
105
+ */
106
+ protected function getShippingAddressParamsStructure()
107
+ {
108
+ return [
109
+ 'first_name' => $this->shipping_first_name,
110
+ 'last_name' => $this->shipping_last_name,
111
+ 'address1' => $this->shipping_address1,
112
+ 'address2' => $this->shipping_address2,
113
+ 'zip_code' => $this->shipping_zip_code,
114
+ 'city' => $this->shipping_city,
115
+ 'state' => $this->shipping_state,
116
+ 'country' => $this->shipping_country
117
+ ];
118
+ }
119
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/AsyncAttributes.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait AsyncAttributes
28
+ * @package Genesis\API\Traits\Request\Financial
29
+ *
30
+ * @method $this setReturnSuccessUrl($value) Set the URL where customer is sent to after successful payment
31
+ * @method $this setReturnFailureUrl($value) Set the URL where customer is sent to after un-successful payment
32
+ */
33
+ trait AsyncAttributes
34
+ {
35
+ /**
36
+ * URL where customer is sent to after successful payment
37
+ *
38
+ * @var string
39
+ */
40
+ protected $return_success_url;
41
+
42
+ /**
43
+ * URL where customer is sent to after un-successful payment
44
+ *
45
+ * @var string
46
+ */
47
+ protected $return_failure_url;
48
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/DescriptorAttributes.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait DescriptorAttributes
28
+ *
29
+ * Trait for Transactions with Dynamic Descriptor Params
30
+ *
31
+ * @package Genesis\API\Traits\Request\Financial
32
+ *
33
+ * @method $this setDynamicMerchantName($value) Dynamically override the charge descriptor
34
+ * @method $this setDynamicMerchantCity($value) Dynamically override the merchant phone number
35
+ */
36
+ trait DescriptorAttributes
37
+ {
38
+ /**
39
+ * Allows to dynamically override the charge descriptor
40
+ *
41
+ * @var string
42
+ */
43
+ protected $dynamic_merchant_name;
44
+
45
+ /**
46
+ * Allows to dynamically override the mer- chant phone number
47
+ *
48
+ * @var string
49
+ */
50
+ protected $dynamic_merchant_city;
51
+
52
+ /**
53
+ * Builds an array list with all Params
54
+ *
55
+ * @return array
56
+ */
57
+ protected function getDynamicDescriptorParamsStructure()
58
+ {
59
+ return [
60
+ 'merchant_name' => $this->dynamic_merchant_name,
61
+ 'merchant_city' => $this->dynamic_merchant_city
62
+ ];
63
+ }
64
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/GamingAttributes.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait GamingAttributes
28
+ * @package Genesis\API\Traits\Request\Financial
29
+ *
30
+ * @method $this setGaming($value) Signifies whether a gaming transaction is performed.
31
+ */
32
+ trait GamingAttributes
33
+ {
34
+ /**
35
+ * Signifies whether a gaming transaction is performed.
36
+ *
37
+ * Gaming transactions usually use MCC 7995, contact tech support for more details.
38
+ *
39
+ * @var bool
40
+ */
41
+ protected $gaming;
42
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/MpiAttributes.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait MpiAttributes
28
+ * @package Genesis\API\Traits\Request\Financial
29
+ *
30
+ * @method $this setMpiCavv($value) Set the Verification Id of the authentication.
31
+ * @method $this setMpiEci($value) Set Electric Commerce Indicator as returned from the MPI.
32
+ * @method $this setMpiXid($value) Set Transaction ID that uniquely identifies a 3D Secure check request
33
+ */
34
+ trait MpiAttributes
35
+ {
36
+ /**
37
+ * Verification Id of the authentication.
38
+ *
39
+ * Please note this can be the CAVV for Visa Card or UCAF to identify MasterCard.
40
+ *
41
+ * @var string
42
+ */
43
+ protected $mpi_cavv;
44
+
45
+ /**
46
+ * Electric Commerce Indicator as returned from the MPI.
47
+ *
48
+ * @var string
49
+ */
50
+ protected $mpi_eci;
51
+
52
+ /**
53
+ * Transaction ID generated by the 3D Secure service
54
+ * that uniquely identifies a 3D Secure check request
55
+ *
56
+ * @var string
57
+ */
58
+ protected $mpi_xid;
59
+
60
+ /**
61
+ * Builds an array list with all Params
62
+ *
63
+ * @return array
64
+ */
65
+ protected function getMpiParamsStructure()
66
+ {
67
+ return [
68
+ 'cavv' => $this->mpi_cavv,
69
+ 'eci' => $this->mpi_eci,
70
+ 'xid' => $this->mpi_xid,
71
+ ];
72
+ }
73
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/NotificationAttributes.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+ namespace Genesis\API\Traits\Request\Financial;
24
+
25
+ /**
26
+ * Trait NotificationAttributes
27
+ * @package Genesis\API\Traits\Request\Financial
28
+ *
29
+ * @method $this setNotificationUrl($value) Set the URL endpoint for Genesis Notifications
30
+ */
31
+ trait NotificationAttributes
32
+ {
33
+ /**
34
+ * URL endpoint for Genesis Notifications
35
+ *
36
+ * @var string
37
+ */
38
+ protected $notification_url;
39
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/PaymentAttributes.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait PaymentAttributes
28
+ *
29
+ * Trait for all AmountBased Financial Requests
30
+ *
31
+ * @package Genesis\API\Traits\Request\Financial
32
+ *
33
+ * @method $this setAmount($value) Set the amount of transaction in minor currency unit
34
+ * @method $this setCurrency($value) Set the currency code in ISO-4217
35
+ */
36
+ trait PaymentAttributes
37
+ {
38
+ /**
39
+ * Amount of transaction in minor currency unit
40
+ *
41
+ * @var int|float|double
42
+ */
43
+ protected $amount;
44
+
45
+ /**
46
+ * Currency code in ISO-4217
47
+ *
48
+ * @var string
49
+ */
50
+ protected $currency;
51
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/ReferenceAttributes.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait ReferenceAttributes
28
+ *
29
+ * Trait for all Reference Financial Requests
30
+ *
31
+ * @package Genesis\API\Traits\Request\Financial
32
+ *
33
+ * @method $this setReferenceId($value) Set Unique id of the existing (target) transaction
34
+ */
35
+ trait ReferenceAttributes
36
+ {
37
+ /**
38
+ * Unique id of the existing (target) transaction
39
+ *
40
+ * @var string
41
+ */
42
+ protected $reference_id;
43
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/SddBankAttributes.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait SddBankAttributes
28
+ * @package Genesis\API\Traits\Request\Financial
29
+ *
30
+ * @method $this setIban($value) Set a valid IBAN bank account
31
+ * @method $this setBic($value) Set a valid BIC code
32
+ */
33
+ trait SddBankAttributes
34
+ {
35
+ /**
36
+ * Must contain valid IBAN, check
37
+ * in the official API documentation
38
+ *
39
+ * @var string
40
+ */
41
+ protected $iban;
42
+
43
+ /**
44
+ * Must contain valid BIC, check
45
+ * in the official API documentation
46
+ *
47
+ * @var string
48
+ */
49
+ protected $bic;
50
+ }
lib/Genesis/src/Genesis/API/Traits/Request/Financial/VoucherAttributes.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request\Financial;
25
+
26
+ /**
27
+ * Trait VoucherAttributes
28
+ * @package Genesis\API\Traits\Request\Financial
29
+ *
30
+ * @method $this setCardType($value) Set Card type for the voucher - can be ’virtual’ or ’physical’ only
31
+ * @method $this setRedeemType($value) Set Redeem type for the voucher - can be ’stored’ or ’instant’ only
32
+ */
33
+ trait VoucherAttributes
34
+ {
35
+ /**
36
+ * Card type for the voucher - can be ’virtual’ or ’physical’ only
37
+ *
38
+ * @var string
39
+ */
40
+ protected $card_type;
41
+
42
+ /**
43
+ * Redeem type for the voucher - can be ’stored’ or ’instant’ only
44
+ *
45
+ * @var string
46
+ */
47
+ protected $redeem_type;
48
+ }
lib/Genesis/src/Genesis/API/Traits/Request/MotoAttributes.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request;
25
+
26
+ /**
27
+ * Trait MotoAttributes
28
+ * @package Genesis\API\Traits\Request
29
+ *
30
+ * @method $this setMoto($value) Signifies whether a MOTO (mail order telephone order) transaction is performed.
31
+ */
32
+ trait MotoAttributes
33
+ {
34
+ /**
35
+ * Signifies whether a MOTO (mail order telephone order) transaction is performed.
36
+ *
37
+ * Contact tech support for more details.
38
+ *
39
+ * @var bool
40
+ */
41
+ protected $moto;
42
+ }
lib/Genesis/src/Genesis/API/Traits/Request/RiskAttributes.php ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Traits\Request;
25
+
26
+ /**
27
+ * Trait RiskAttributes
28
+ * @package Genesis\API\Traits\Request
29
+ *
30
+ * @method $this setRiskSsn($value) Set the Social Security number or equivalent value for non US customers.
31
+ * @method $this setRiskMacAddress($value) Set the Customer's MAC address
32
+ * @method $this setRiskSessionId($value) Set the Customer's Session Id
33
+ * @method $this setRiskUserId($value) Set the Customer's User Id
34
+ * @method $this setRiskUserLevel($value) Set the Customer's User Level
35
+ * @method $this setRiskEmail($value) Set the Customer's Email address
36
+ * @method $this setRiskPhone($value) Set the Customer's Phone number
37
+ * @method $this setRiskRemoteIp($value) Set the Customer's IP address
38
+ * @method $this setRiskSerialNumber($value) Set the Customer's Serial Number
39
+ * @method $this setRiskPanTail($value) Set the last 4 digits of the card number
40
+ * @method $this setRiskBin($value) Set the first 6 digits of the card number
41
+ * @method $this setRiskFirstName($value) Set the Customer's First Name
42
+ * @method $this setRiskLastName($value) Set the Customer's Last Name
43
+ * @method $this setRiskCountry($value) Set the Customer's Country
44
+ * @method $this setRiskPan($value) Set the Pan hash of the Customer's card number
45
+ * @method $this setRiskForwardedIp($value) Set the Customer's Forwarded IP Address. MaxMind specific risk param.
46
+ * @method $this setRiskUsername($value) Set the Customer's username. MaxMind specific risk param.
47
+ * @method $this setRiskPassword($value) Set the Customer's password. MaxMind specific risk param.
48
+ * @method $this setRiskBinName($value) Set the Customer's Bin Name. MaxMind specific risk param.
49
+ * @method $this setRiskBinPhone($value) Set the Customer's Bin Phone. MaxMind specific risk param.
50
+ */
51
+ trait RiskAttributes
52
+ {
53
+ /**
54
+ * Social Security number or equivalent value for non US customers.
55
+ *
56
+ * @var string
57
+ */
58
+ protected $risk_ssn;
59
+
60
+ /**
61
+ * Customer's MAC address
62
+ *
63
+ * @var string
64
+ */
65
+ protected $risk_mac_address;
66
+
67
+ /**
68
+ * Customer's Session Id
69
+ *
70
+ * @var string
71
+ */
72
+ protected $risk_session_id;
73
+
74
+ /**
75
+ * Customer's User Id
76
+ *
77
+ * @var string
78
+ */
79
+ protected $risk_user_id;
80
+
81
+ /**
82
+ * Customer's User Level
83
+ *
84
+ * @var string
85
+ */
86
+ protected $risk_user_level;
87
+
88
+ /**
89
+ * Customer's Email address
90
+ *
91
+ * @note Set here if different from
92
+ * shipping / billing
93
+ *
94
+ * @var string
95
+ */
96
+ protected $risk_email;
97
+
98
+ /**
99
+ * Customer's Phone number
100
+ *
101
+ * @note Set here if different from
102
+ * shipping / billing
103
+ *
104
+ * @var string
105
+ */
106
+ protected $risk_phone;
107
+
108
+ /**
109
+ * Customer's IP address
110
+ *
111
+ * @note Set here if different from remote_ip
112
+ *
113
+ * @var string
114
+ */
115
+ protected $risk_remote_ip;
116
+
117
+ /**
118
+ * Customer's Serial Number
119
+ *
120
+ * @var string
121
+ */
122
+ protected $risk_serial_number;
123
+
124
+ /**
125
+ * The last 4 digits of the Customer's card number
126
+ *
127
+ * @var string
128
+ */
129
+ protected $risk_pan_tail;
130
+
131
+ /**
132
+ * The first 6 digits of the Customer's card number
133
+ *
134
+ * @var string
135
+ */
136
+ protected $risk_bin;
137
+
138
+ /**
139
+ * Customer's First Name
140
+ *
141
+ * @var string
142
+ */
143
+ protected $risk_first_name;
144
+
145
+ /**
146
+ * Customer's Last Name
147
+ *
148
+ * @var string
149
+ */
150
+ protected $risk_last_name;
151
+
152
+ /**
153
+ * Customer's Country
154
+ *
155
+ * @var string
156
+ */
157
+ protected $risk_country;
158
+
159
+ /**
160
+ * PAN Hash of the Customer's card number
161
+ *
162
+ * @var string
163
+ */
164
+ protected $risk_pan;
165
+
166
+ /**
167
+ * Customer's Forwarded IP Address
168
+ *
169
+ * @note MaxMind specific risk param.
170
+ *
171
+ * @var string
172
+ */
173
+ protected $risk_forwarded_ip;
174
+
175
+ /**
176
+ * Customer's Username
177
+ *
178
+ * @note MaxMind specific risk param.
179
+ *
180
+ * @var string
181
+ */
182
+ protected $risk_username;
183
+
184
+ /**
185
+ * Customer's Password
186
+ *
187
+ * @note MaxMind specific risk param.
188
+ *
189
+ * @var string
190
+ */
191
+ protected $risk_password;
192
+
193
+ /**
194
+ * Customer's Bin Name
195
+ *
196
+ * @note MaxMind specific risk param.
197
+ *
198
+ * @var string
199
+ */
200
+ protected $risk_bin_name;
201
+
202
+ /**
203
+ * Customer's Bin Phone
204
+ *
205
+ * @note MaxMind specific risk param.
206
+ *
207
+ * @var string
208
+ */
209
+ protected $risk_bin_phone;
210
+
211
+ /**
212
+ * Builds an array list with all Risk Params
213
+ *
214
+ * @return array
215
+ */
216
+ protected function getRiskParamsStructure()
217
+ {
218
+ return [
219
+ 'ssn' => $this->risk_ssn,
220
+ 'mac_address' => $this->risk_mac_address,
221
+ 'session_id' => $this->risk_session_id,
222
+ 'user_id' => $this->risk_user_id,
223
+ 'user_level' => $this->risk_user_level,
224
+ 'email' => $this->risk_email,
225
+ 'phone' => $this->risk_phone,
226
+ 'remote_ip' => $this->risk_remote_ip,
227
+ 'serial_number' => $this->risk_serial_number,
228
+ 'pan_tail' => $this->risk_pan_tail,
229
+ 'bin' => $this->risk_bin,
230
+ 'first_name' => $this->risk_first_name,
231
+ 'last_name' => $this->risk_last_name,
232
+ 'country' => $this->risk_country,
233
+ 'pan' => $this->risk_pan,
234
+ 'forwarded_ip' => $this->risk_forwarded_ip,
235
+ 'username' => $this->risk_username,
236
+ 'password' => $this->risk_password,
237
+ 'bin_name' => $this->risk_bin_name,
238
+ 'bin_phone' => $this->risk_bin_phone
239
+ ];
240
+ }
241
+ }
lib/Genesis/src/Genesis/API/Validators/Request/Base/Validator.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Validators\Request\Base;
25
+
26
+ use Genesis\Utils\Common as CommonUtils;
27
+
28
+ /**
29
+ * Class Validator
30
+ * @package Genesis\API\Validators\Request\Base
31
+ */
32
+ abstract class Validator
33
+ {
34
+ /**
35
+ * API Request Instance
36
+ *
37
+ * @var \Genesis\API\Request
38
+ */
39
+ protected $request;
40
+
41
+ /**
42
+ * Validation error message
43
+ *
44
+ * @var string|null
45
+ */
46
+ protected $message;
47
+
48
+ /**
49
+ * Request field name to validate
50
+ *
51
+ * @var string
52
+ */
53
+ protected $field;
54
+
55
+ /**
56
+ * Validator constructor.
57
+ *
58
+ * @param null|string $message
59
+ */
60
+ public function __construct($message = null)
61
+ {
62
+ $this->message = $message;
63
+ }
64
+
65
+ /**
66
+ * @param \Genesis\API\Request $request
67
+ * @param string $field
68
+ * @return void
69
+ * @throws \Genesis\Exceptions\InvalidArgument
70
+ */
71
+ public function run($request, $field)
72
+ {
73
+ $this->request = $request;
74
+ $this->field = $field;
75
+
76
+ if (!$this->validate()) {
77
+ $this->throwInvalidArgument();
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Execute field name validation
83
+ *
84
+ * @return bool
85
+ */
86
+ abstract protected function validate();
87
+
88
+ /**
89
+ * @return void
90
+ * @throws \Genesis\Exceptions\InvalidArgument
91
+ */
92
+ protected function throwInvalidArgument()
93
+ {
94
+ $exceptionMessage =
95
+ $this->message
96
+ ? sprintf($this->message, $this->field)
97
+ : "Please check input data for errors. '{$this->field}' has invalid format";
98
+
99
+ throw new \Genesis\Exceptions\InvalidArgument($exceptionMessage);
100
+ }
101
+
102
+ /**
103
+ * @return mixed|null
104
+ * @throws \Genesis\Exceptions\ErrorParameter
105
+ */
106
+ protected function getRequestValue()
107
+ {
108
+ if (!property_exists($this->request, $this->field)) {
109
+ throw new \Genesis\Exceptions\ErrorParameter("Property {$this->field} not found in API Request");
110
+ }
111
+
112
+ $method = CommonUtils::snakeCaseToCamelCase($this->field);
113
+
114
+ return call_user_func([$this->request, "get$method"]);
115
+ }
116
+ }
lib/Genesis/src/Genesis/API/Validators/Request/RegexValidator.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to deal
5
+ * in the Software without restriction, including without limitation the rights
6
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ * copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ * THE SOFTWARE.
20
+ *
21
+ * @license http://opensource.org/licenses/MIT The MIT License
22
+ */
23
+
24
+ namespace Genesis\API\Validators\Request;
25
+
26
+ use Genesis\Utils\Common as CommonUtils;
27
+
28
+ /**
29
+ * Class RegexValidator
30
+ * @package Genesis\API\Validators\Request
31
+ */
32
+ class RegexValidator extends \Genesis\API\Validators\Request\Base\Validator
33
+ {
34
+ /**
35
+ * CC Regex Validation Patterns
36
+ */
37
+ const PATTERN_CREDIT_CARD_HOLDER = '/^[\p{L}\'\-,.]+[ ]+[\p{L}\'\-,. ]+$/u';
38
+ const PATTERN_CREDIT_CARD_NUMBER = '/\A[0-9]{13,19}\Z/';
39
+ const PATTERN_CREDIT_CARD_CVV = '/\A[0-9]{3,4}\Z/';
40
+ const PATTERN_CREDIT_CART_EXP_MONTH = '/^(0?[1-9]|1[012])$/';
41
+ const PATTERN_CREDIT_CART_EXP_YEAR = '/^(20)\d{2}$/';
42
+
43
+ /**
44
+ * Regex expression
45
+ *
46
+ * @var string
47
+ */
48
+ protected $pattern;
49
+
50
+ /**
51
+ * RegexValidator constructor.
52
+ *
53
+ * @param string $pattern
54
+ * @param null|string $message
55
+ */
56
+ public function __construct($pattern, $message = null)
57
+ {
58
+ parent::__construct($message);
59
+
60
+ $this->pattern = $pattern;
61
+ }
62
+
63
+ /**
64
+ * Execute field name validation
65
+ *
66
+ * @return bool
67
+ */
68
+ protected function validate()
69
+ {
70
+ if (!CommonUtils::isRegexExpr($this->pattern)) {
71
+ return false;
72
+ }
73
+
74
+ return (bool) preg_match(
75
+ $this->pattern,
76
+ $this->getRequestValue()
77
+ );
78
+ }
79
+ }
lib/Genesis/src/Genesis/Builder.php CHANGED
@@ -73,7 +73,7 @@ class Builder
73
  *
74
  * @param array $structure
75
  */
76
- public function parseStructure(Array $structure)
77
  {
78
  $this->context->populateNodes($structure);
79
  }
73
  *
74
  * @param array $structure
75
  */
76
+ public function parseStructure(array $structure)
77
  {
78
  $this->context->populateNodes($structure);
79
  }
lib/Genesis/src/Genesis/Builders/XML.php CHANGED
@@ -65,7 +65,7 @@ final class XML implements \Genesis\Interfaces\Builder
65
  * Insert tree-structured array as nodes in XMLWriter
66
  * and end the current Document.
67
  *
68
- * @param $data Array - tree-structured array
69
  *
70
  * @throws \Genesis\Exceptions\InvalidArgument
71
  *
@@ -158,6 +158,8 @@ final class XML implements \Genesis\Interfaces\Builder
158
  * Write Element's CData
159
  *
160
  * @param $value
 
 
161
  */
162
  public function writeCData($value)
163
  {
@@ -174,6 +176,8 @@ final class XML implements \Genesis\Interfaces\Builder
174
  * Write Element's Text
175
  *
176
  * @param $value
 
 
177
  */
178
  public function writeText($value)
179
  {
@@ -191,6 +195,8 @@ final class XML implements \Genesis\Interfaces\Builder
191
  *
192
  * @param $key
193
  * @param $value
 
 
194
  */
195
  public function writeElement($key, $value)
196
  {
65
  * Insert tree-structured array as nodes in XMLWriter
66
  * and end the current Document.
67
  *
68
+ * @param array $data - tree-structured array
69
  *
70
  * @throws \Genesis\Exceptions\InvalidArgument
71
  *
158
  * Write Element's CData
159
  *
160
  * @param $value
161
+ *
162
+ * @SuppressWarnings(PHPMD.ElseExpression)
163
  */
164
  public function writeCData($value)
165
  {
176
  * Write Element's Text
177
  *
178
  * @param $value
179
+ *
180
+ * @SuppressWarnings(PHPMD.ElseExpression)
181
  */
182
  public function writeText($value)
183
  {
195
  *
196
  * @param $key
197
  * @param $value
198
+ *
199
+ * @SuppressWarnings(PHPMD.ElseExpression)
200
  */
201
  public function writeElement($key, $value)
202
  {
lib/Genesis/src/Genesis/Config.php CHANGED
@@ -29,64 +29,61 @@ namespace Genesis;
29
  *
30
  * @package Genesis
31
  *
32
- * @method static \Genesis\Config getUsername() Get the Username, set in configuration
33
- * @method static \Genesis\Config getPassword() Get the Password, set in the configuration
34
- * @method static \Genesis\Config getToken() Get the Terminal Token, set in configuration
35
  *
36
- * @method static \Genesis\Config setUsername() Set the Username
37
- * @method static \Genesis\Config setPassword() Set the Password
38
- * @method static \Genesis\Config setToken() Set the Terminal
39
  */
40
  final class Config
41
  {
42
  /**
43
  * Library Version
44
  */
45
- const VERSION = '1.4.2';
46
 
47
  /**
48
  * Core configuration settings
49
  *
50
- * @var Array
51
  */
52
- public static $vault
53
- = array(
54
- 'endpoint' => null,
55
- 'username' => null,
56
- 'password' => null,
57
- 'token' => null,
58
- 'environment' => \Genesis\API\Constants\Environments::STAGING,
59
- );
60
 
61
  /**
62
  * Interface settings
63
  *
64
  * @var array
65
  */
66
- public static $interfaces
67
- = array(
68
- 'builder' => 'xml',
69
- 'network' => 'curl',
70
- );
71
 
72
  /**
73
  * Some requests are targeting different sub-domains.
74
  * This should map all available requests/sub-domains
75
  * for each configuration type (develop,sandbox,production)
76
  *
77
- * @var Array
78
  */
79
- public static $domains
80
- = array(
81
- 'gateway' => array(
82
- 'production' => 'gate.',
83
- 'sandbox' => 'staging.gate.'
84
- ),
85
- 'wpf' => array(
86
- 'production' => 'wpf.',
87
- 'sandbox' => 'staging.wpf.',
88
- ),
89
- );
90
 
91
  /**
92
  * Dynamic Getters/Setter for getting/setting configuration parameters
@@ -191,20 +188,20 @@ final class Config
191
  {
192
  $environmentArg = strtolower(trim($environmentArg));
193
 
194
- $aliases = array(
195
- \Genesis\API\Constants\Environments::STAGING => array(
196
  'test',
197
  'testing',
198
  'staging',
199
  \Genesis\API\Constants\Environments::STAGING
200
- ),
201
- \Genesis\API\Constants\Environments::PRODUCTION => array(
202
  'live',
203
  'prod',
204
  'production',
205
  \Genesis\API\Constants\Environments::PRODUCTION
206
- ),
207
- );
208
 
209
  foreach ($aliases as $environment => $endpointAlias) {
210
  foreach ($endpointAlias as $alias) {
@@ -241,19 +238,19 @@ final class Config
241
  {
242
  $endpointArg = strtolower(trim($endpointArg));
243
 
244
- $aliases = array(
245
- \Genesis\API\Constants\Endpoints::EMERCHANTPAY => array(
246
  'emp',
247
  'emerchantpay',
248
- \Genesis\API\Constants\Endpoints::EMERCHANTPAY,
249
- ),
250
- \Genesis\API\Constants\Endpoints::ECOMPROCESSING => array(
251
  'ecp',
252
  'ecomprocessing',
253
  'e-comprocessing',
254
  \Genesis\API\Constants\Endpoints::ECOMPROCESSING
255
- ),
256
- );
257
 
258
  foreach ($aliases as $endpoint => $endpointAlias) {
259
  foreach ($endpointAlias as $alias) {
29
  *
30
  * @package Genesis
31
  *
32
+ * @method static string getUsername() Get the Username, set in configuration
33
+ * @method static string getPassword() Get the Password, set in the configuration
34
+ * @method static string getToken() Get the Terminal Token, set in configuration
35
  *
36
+ * @method static \Genesis\Config setUsername($value) Set the Username
37
+ * @method static \Genesis\Config setPassword($value) Set the Password
38
+ * @method static \Genesis\Config setToken($value) Set the Terminal
39
  */
40
  final class Config
41
  {
42
  /**
43
  * Library Version
44
  */
45
+ const VERSION = '1.7.0';
46
 
47
  /**
48
  * Core configuration settings
49
  *
50
+ * @var array
51
  */
52
+ public static $vault = [
53
+ 'endpoint' => null,
54
+ 'username' => null,
55
+ 'password' => null,
56
+ 'token' => null,
57
+ 'environment' => \Genesis\API\Constants\Environments::STAGING
58
+ ];
 
59
 
60
  /**
61
  * Interface settings
62
  *
63
  * @var array
64
  */
65
+ public static $interfaces = [
66
+ 'builder' => 'xml',
67
+ 'network' => 'curl'
68
+ ];
 
69
 
70
  /**
71
  * Some requests are targeting different sub-domains.
72
  * This should map all available requests/sub-domains
73
  * for each configuration type (develop,sandbox,production)
74
  *
75
+ * @var array
76
  */
77
+ public static $domains = [
78
+ 'gateway' => [
79
+ 'production' => 'gate.',
80
+ 'sandbox' => 'staging.gate.'
81
+ ],
82
+ 'wpf' => [
83
+ 'production' => 'wpf.',
84
+ 'sandbox' => 'staging.wpf.'
85
+ ]
86
+ ];
 
87
 
88
  /**
89
  * Dynamic Getters/Setter for getting/setting configuration parameters
188
  {
189
  $environmentArg = strtolower(trim($environmentArg));
190
 
191
+ $aliases = [
192
+ \Genesis\API\Constants\Environments::STAGING => [
193
  'test',
194
  'testing',
195
  'staging',
196
  \Genesis\API\Constants\Environments::STAGING
197
+ ],
198
+ \Genesis\API\Constants\Environments::PRODUCTION => [
199
  'live',
200
  'prod',
201
  'production',
202
  \Genesis\API\Constants\Environments::PRODUCTION
203
+ ]
204
+ ];
205
 
206
  foreach ($aliases as $environment => $endpointAlias) {
207
  foreach ($endpointAlias as $alias) {
238
  {
239
  $endpointArg = strtolower(trim($endpointArg));
240
 
241
+ $aliases = [
242
+ \Genesis\API\Constants\Endpoints::EMERCHANTPAY => [
243
  'emp',
244
  'emerchantpay',
245
+ \Genesis\API\Constants\Endpoints::EMERCHANTPAY
246
+ ],
247
+ \Genesis\API\Constants\Endpoints::ECOMPROCESSING => [
248
  'ecp',
249
  'ecomprocessing',
250
  'e-comprocessing',
251
  \Genesis\API\Constants\Endpoints::ECOMPROCESSING
252
+ ]
253
+ ];
254
 
255
  foreach ($aliases as $endpoint => $endpointAlias) {
256
  foreach ($endpointAlias as $alias) {
lib/Genesis/src/Genesis/Genesis.php CHANGED
@@ -65,14 +65,19 @@ class Genesis
65
  // Initialize the request
66
  $request = sprintf('\Genesis\API\Request\%s', $request);
67
 
68
- if (class_exists($request)) {
69
- $this->requestCtx = new $request;
70
- } else {
71
  throw new \Genesis\Exceptions\InvalidMethod(
72
  'The selected transaction type is invalid!'
73
  );
74
  }
75
 
 
 
 
 
 
 
 
76
  // Initialize the Network
77
  $this->networkCtx = new \Genesis\Network();
78
 
65
  // Initialize the request
66
  $request = sprintf('\Genesis\API\Request\%s', $request);
67
 
68
+ if (!class_exists($request)) {
 
 
69
  throw new \Genesis\Exceptions\InvalidMethod(
70
  'The selected transaction type is invalid!'
71
  );
72
  }
73
 
74
+ if (\Genesis\Utils\Common::isClassAbstract($request)) {
75
+ throw new \Genesis\Exceptions\InvalidMethod(
76
+ 'The selected transaction type is invalid, because it is abstract!'
77
+ );
78
+ }
79
+ $this->requestCtx = new $request;
80
+
81
  // Initialize the Network
82
  $this->networkCtx = new \Genesis\Network();
83
 
lib/Genesis/src/Genesis/Network.php CHANGED
@@ -95,7 +95,7 @@ class Network
95
  public function setApiCtxData($apiContext)
96
  {
97
  $this->context->prepareRequestBody(
98
- array(
99
  'body' => $apiContext->getDocument(),
100
  'url' => $apiContext->getApiConfig('url'),
101
  'type' => $apiContext->getApiConfig('type'),
@@ -104,8 +104,8 @@ class Network
104
  'timeout' => \Genesis\Config::getNetworkTimeout(),
105
  'ca_bundle' => \Genesis\Config::getCertificateBundle(),
106
  'user_agent' => sprintf('Genesis PHP Client v%s', \Genesis\Config::getVersion()),
107
- 'user_login' => sprintf('%s:%s', \Genesis\Config::getUsername(), \Genesis\Config::getPassword()),
108
- )
109
  );
110
  }
111
 
95
  public function setApiCtxData($apiContext)
96
  {
97
  $this->context->prepareRequestBody(
98
+ [
99
  'body' => $apiContext->getDocument(),
100
  'url' => $apiContext->getApiConfig('url'),
101
  'type' => $apiContext->getApiConfig('type'),
104
  'timeout' => \Genesis\Config::getNetworkTimeout(),
105
  'ca_bundle' => \Genesis\Config::getCertificateBundle(),
106
  'user_agent' => sprintf('Genesis PHP Client v%s', \Genesis\Config::getVersion()),
107
+ 'user_login' => sprintf('%s:%s', \Genesis\Config::getUsername(), \Genesis\Config::getPassword())
108
+ ]
109
  );
110
  }
111
 
lib/Genesis/src/Genesis/Network/Stream.php CHANGED
@@ -103,26 +103,28 @@ class Stream implements \Genesis\Interfaces\Network
103
  * @param array $requestData
104
  *
105
  * @return void
 
 
106
  */
107
  public function prepareRequestBody($requestData)
108
  {
109
  $url = parse_url($requestData['url']);
110
 
111
- $headers = array(
112
  'Content-Type: text/xml',
113
  sprintf('Authorization: Basic %s', base64_encode($requestData['user_login'])),
114
  sprintf('Content-Length: %s', strlen($requestData['body'])),
115
  sprintf('User-Agent: %s', $requestData['user_agent']),
116
- );
117
 
118
- $contextOptions = array(
119
- 'http' => array(
120
  'method' => $requestData['type'],
121
  'header' => implode("\r\n", $headers),
122
  'content' => $requestData['body'],
123
  'timeout' => $requestData['timeout']
124
- ),
125
- 'ssl' => array(
126
  // DO NOT allow self-signed certificates
127
  'allow_self_signed' => false,
128
  // Path to certificate/s PEM files used to validate the server authenticity
@@ -137,8 +139,8 @@ class Stream implements \Genesis\Interfaces\Network
137
  'SNI_enabled' => true,
138
  // You can tweak the accepted Cipher list (if needed)
139
  'ciphers' => implode(':', self::getCiphers())
140
- )
141
- );
142
 
143
  // Note: Mitigate CRIME/BEAST attacks
144
  if (\Genesis\Utils\Common::compareVersions('5.4.13', '>=')) {
@@ -166,7 +168,7 @@ class Stream implements \Genesis\Interfaces\Network
166
  */
167
  public function execute()
168
  {
169
- set_error_handler(array($this, 'processErrors'), E_WARNING);
170
 
171
  $stream = fopen($this->requestData['url'], 'r', false, $this->streamContext);
172
 
@@ -203,7 +205,7 @@ class Stream implements \Genesis\Interfaces\Network
203
  */
204
  public static function getCiphers()
205
  {
206
- return array(
207
  'ECDHE-RSA-AES128-GCM-SHA256',
208
  'ECDHE-ECDSA-AES128-GCM-SHA256',
209
  'ECDHE-RSA-AES256-GCM-SHA384',
@@ -235,6 +237,6 @@ class Stream implements \Genesis\Interfaces\Network
235
  '!PSK',
236
  '!SSLv2',
237
  '!SSLv3'
238
- );
239
  }
240
  }
103
  * @param array $requestData
104
  *
105
  * @return void
106
+ *
107
+ * @SuppressWarnings(PHPMD.ElseExpression)
108
  */
109
  public function prepareRequestBody($requestData)
110
  {
111
  $url = parse_url($requestData['url']);
112
 
113
+ $headers = [
114
  'Content-Type: text/xml',
115
  sprintf('Authorization: Basic %s', base64_encode($requestData['user_login'])),
116
  sprintf('Content-Length: %s', strlen($requestData['body'])),
117
  sprintf('User-Agent: %s', $requestData['user_agent']),
118
+ ];
119
 
120
+ $contextOptions = [
121
+ 'http' => [
122
  'method' => $requestData['type'],
123
  'header' => implode("\r\n", $headers),
124
  'content' => $requestData['body'],
125
  'timeout' => $requestData['timeout']
126
+ ],
127
+ 'ssl' => [
128
  // DO NOT allow self-signed certificates
129
  'allow_self_signed' => false,
130
  // Path to certificate/s PEM files used to validate the server authenticity
139
  'SNI_enabled' => true,
140
  // You can tweak the accepted Cipher list (if needed)
141
  'ciphers' => implode(':', self::getCiphers())
142
+ ]
143
+ ];
144
 
145
  // Note: Mitigate CRIME/BEAST attacks
146
  if (\Genesis\Utils\Common::compareVersions('5.4.13', '>=')) {
168
  */
169
  public function execute()
170
  {
171
+ set_error_handler([$this, 'processErrors'], E_WARNING);
172
 
173
  $stream = fopen($this->requestData['url'], 'r', false, $this->streamContext);
174
 
205
  */
206
  public static function getCiphers()
207
  {
208
+ return [
209
  'ECDHE-RSA-AES128-GCM-SHA256',
210
  'ECDHE-ECDSA-AES128-GCM-SHA256',
211
  'ECDHE-RSA-AES256-GCM-SHA384',
237
  '!PSK',
238
  '!SSLv2',
239
  '!SSLv3'
240
+ ];
241
  }
242
  }
lib/Genesis/src/Genesis/Network/cURL.php CHANGED
@@ -118,18 +118,18 @@ class cURL implements \Genesis\Interfaces\Network
118
  */
119
  public function prepareRequestBody($requestData)
120
  {
121
- $options = array(
122
  CURLOPT_URL => $requestData['url'],
123
  CURLOPT_TIMEOUT => $requestData['timeout'],
124
  CURLOPT_USERAGENT => $requestData['user_agent'],
125
  CURLOPT_USERPWD => $requestData['user_login'],
126
  CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
127
  CURLOPT_ENCODING => 'gzip',
128
- CURLOPT_HTTPHEADER => array(
129
  'Content-Type: text/xml',
130
  // Workaround to prevent cURL from parsing HTTP 100 as separate request
131
  'Expect:'
132
- ),
133
  CURLOPT_HEADER => true,
134
  CURLOPT_FAILONERROR => true,
135
  CURLOPT_FRESH_CONNECT => true,
@@ -137,14 +137,14 @@ class cURL implements \Genesis\Interfaces\Network
137
  // SSL/TLS Configuration
138
  CURLOPT_CAINFO => $requestData['ca_bundle'],
139
  CURLOPT_SSL_VERIFYPEER => true,
140
- CURLOPT_SSL_VERIFYHOST => 2,
141
- );
142
 
143
  if ('POST' == strtoupper($requestData['type'])) {
144
- $post = array(
145
  CURLOPT_POST => true,
146
  CURLOPT_POSTFIELDS => $requestData['body']
147
- );
148
 
149
  $options = $options + $post;
150
  }
118
  */
119
  public function prepareRequestBody($requestData)
120
  {
121
+ $options = [
122
  CURLOPT_URL => $requestData['url'],
123
  CURLOPT_TIMEOUT => $requestData['timeout'],
124
  CURLOPT_USERAGENT => $requestData['user_agent'],
125
  CURLOPT_USERPWD => $requestData['user_login'],
126
  CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
127
  CURLOPT_ENCODING => 'gzip',
128
+ CURLOPT_HTTPHEADER => [
129
  'Content-Type: text/xml',
130
  // Workaround to prevent cURL from parsing HTTP 100 as separate request
131
  'Expect:'
132
+ ],
133
  CURLOPT_HEADER => true,
134
  CURLOPT_FAILONERROR => true,
135
  CURLOPT_FRESH_CONNECT => true,
137
  // SSL/TLS Configuration
138
  CURLOPT_CAINFO => $requestData['ca_bundle'],
139
  CURLOPT_SSL_VERIFYPEER => true,
140
+ CURLOPT_SSL_VERIFYHOST => 2
141
+ ];
142
 
143
  if ('POST' == strtoupper($requestData['type'])) {
144
+ $post = [
145
  CURLOPT_POST => true,
146
  CURLOPT_POSTFIELDS => $requestData['body']
147
+ ];
148
 
149
  $options = $options + $post;
150
  }
lib/Genesis/src/Genesis/Parsers/XML.php CHANGED
@@ -131,6 +131,8 @@ final class XML implements \Genesis\Interfaces\Parser
131
  *
132
  * @param $reader
133
  * @param $tree
 
 
134
  */
135
  public function processElement(&$reader, &$tree)
136
  {
@@ -158,6 +160,8 @@ final class XML implements \Genesis\Interfaces\Parser
158
  *
159
  * @param \XMLReader $reader
160
  * @param \stdClass $tree
 
 
161
  */
162
  public function processAttributes(&$reader, &$tree)
163
  {
131
  *
132
  * @param $reader
133
  * @param $tree
134
+ *
135
+ * @SuppressWarnings(PHPMD.ElseExpression)
136
  */
137
  public function processElement(&$reader, &$tree)
138
  {
160
  *
161
  * @param \XMLReader $reader
162
  * @param \stdClass $tree
163
+ *
164
+ * @SuppressWarnings(PHPMD.ElseExpression)
165
  */
166
  public function processAttributes(&$reader, &$tree)
167
  {
lib/Genesis/src/Genesis/Utils/Common.php CHANGED
@@ -95,7 +95,7 @@ final class Common
95
  {
96
  $snakeCase = explode('_', self::pascalToSnakeCase($input));
97
 
98
- $result = array(
99
  current(
100
  array_slice($snakeCase, 0, 1)
101
  ),
@@ -103,7 +103,7 @@ final class Common
103
  '_',
104
  array_slice($snakeCase, 1)
105
  )
106
- );
107
 
108
  return $result;
109
  }
@@ -179,6 +179,96 @@ final class Common
179
  return true;
180
  }
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  /**
183
  * Check if the passed argument is a valid XML tag name
184
  *
@@ -211,9 +301,9 @@ final class Common
211
  return true;
212
  } elseif (is_null($flag)) {
213
  return $string;
214
- } else {
215
- return false;
216
  }
 
 
217
  }
218
 
219
  /**
@@ -228,9 +318,9 @@ final class Common
228
  if (is_bool($bool)) {
229
  if ($bool) {
230
  return 'true';
231
- } else {
232
- return 'false';
233
  }
 
 
234
  }
235
 
236
  return $bool;
@@ -270,4 +360,47 @@ final class Common
270
 
271
  return false;
272
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  }
95
  {
96
  $snakeCase = explode('_', self::pascalToSnakeCase($input));
97
 
98
+ $result = [
99
  current(
100
  array_slice($snakeCase, 0, 1)
101
  ),
103
  '_',
104
  array_slice($snakeCase, 1)
105
  )
106
+ ];
107
 
108
  return $result;
109
  }
179
  return true;
180
  }
181
 
182
+ /**
183
+ * Check if the passed key exists in the supplied array
184
+ *
185
+ * @param string $key
186
+ * @param array $arr
187
+ *
188
+ * @return bool
189
+ */
190
+ public static function isArrayKeyExists($key, $arr)
191
+ {
192
+ if (!self::isValidArray($arr)) {
193
+ return false;
194
+ }
195
+
196
+ return array_key_exists($key, $arr);
197
+ }
198
+
199
+ /**
200
+ * Makes a copy of an array
201
+ *
202
+ * @param array $arr
203
+ * @return array|null
204
+ */
205
+ public static function copyArray($arr)
206
+ {
207
+ if (!self::isValidArray($arr)) {
208
+ return null;
209
+ }
210
+
211
+ return array_merge([], $arr);
212
+ }
213
+
214
+ /**
215
+ * Sorts an array by value and returns a new instance
216
+ *
217
+ * @param array $arr
218
+ * @return array
219
+ */
220
+ public static function getSortedArrayByValue($arr)
221
+ {
222
+ $duplicate = self::copyArray($arr);
223
+
224
+ if ($duplicate === null) {
225
+ return null;
226
+ }
227
+
228
+ asort($duplicate);
229
+
230
+ return $duplicate;
231
+ }
232
+
233
+ /**
234
+ * Appends items to an ArrayObject by key
235
+ *
236
+ * @param \ArrayObject $arrObj
237
+ * @param string $key
238
+ * @param array $values
239
+ * @return \ArrayObject|null
240
+ */
241
+ public static function appendItemsToArrayObj(&$arrObj, $key, $values)
242
+ {
243
+ if (! $arrObj instanceof \ArrayObject) {
244
+ return null;
245
+ }
246
+
247
+ $arr = $arrObj->getArrayCopy();
248
+
249
+ $commonArrKeyValues =
250
+ Common::isArrayKeyExists($key, $arr)
251
+ ? $arr[$key]
252
+ : [];
253
+
254
+ $arr[$key] = array_merge($commonArrKeyValues, $values);
255
+
256
+ return $arrObj = self::createArrayObject($arr);
257
+ }
258
+
259
+ /**
260
+ * @param array $arr
261
+ * @return array
262
+ */
263
+ public static function getArrayKeys($arr)
264
+ {
265
+ if (self::isValidArray($arr)) {
266
+ return array_keys($arr);
267
+ }
268
+
269
+ return [];
270
+ }
271
+
272
  /**
273
  * Check if the passed argument is a valid XML tag name
274
  *
301
  return true;
302
  } elseif (is_null($flag)) {
303
  return $string;
 
 
304
  }
305
+
306
+ return false;
307
  }
308
 
309
  /**
318
  if (is_bool($bool)) {
319
  if ($bool) {
320
  return 'true';
 
 
321
  }
322
+
323
+ return 'false';
324
  }
325
 
326
  return $bool;
360
 
361
  return false;
362
  }
363
+
364
+ /**
365
+ * Determines if the given class is Instantiable or not
366
+ * Helps to prevent from creating an instance of an abstract class
367
+ *
368
+ * @param string $className
369
+ * @return bool
370
+ */
371
+ public static function isClassAbstract($className)
372
+ {
373
+ if (!class_exists($className)) {
374
+ return false;
375
+ }
376
+
377
+ $reflectionClass = new \ReflectionClass($className);
378
+
379
+ return $reflectionClass->isAbstract();
380
+ }
381
+
382
+ /**
383
+ * Retrieves all constants in a class in a list
384
+ * @param string $className
385
+ * @return array
386
+ */
387
+ public static function getClassConstants($className)
388
+ {
389
+ if (!class_exists($className)) {
390
+ return [];
391
+ }
392
+
393
+ $reflection = new \ReflectionClass($className);
394
+
395
+ return $reflection->getConstants();
396
+ }
397
+
398
+ /**
399
+ * @param string $pattern
400
+ * @return bool
401
+ */
402
+ public static function isRegexExpr($pattern)
403
+ {
404
+ return @preg_match($pattern, null) !== false;
405
+ }
406
  }
lib/Genesis/src/Genesis/Utils/Country.php CHANGED
@@ -36,7 +36,7 @@ final class Country
36
  * @var array
37
  */
38
  public static $countries
39
- = array(
40
  'AF' => 'Afghanistan',
41
  'AX' => 'Aland Islands',
42
  'AL' => 'Albania',
@@ -281,8 +281,8 @@ final class Country
281
  'EH' => 'Western Sahara',
282
  'YE' => 'Yemen',
283
  'ZM' => 'Zambia',
284
- 'ZW' => 'Zimbabwe',
285
- );
286
 
287
  /**
288
  * Get a country's name by its ISO Code
@@ -311,4 +311,14 @@ final class Country
311
  {
312
  return array_search(strtolower($country_name), array_map('strtolower', self::$countries));
313
  }
 
 
 
 
 
 
 
 
 
 
314
  }
36
  * @var array
37
  */
38
  public static $countries
39
+ = [
40
  'AF' => 'Afghanistan',
41
  'AX' => 'Aland Islands',
42
  'AL' => 'Albania',
281
  'EH' => 'Western Sahara',
282
  'YE' => 'Yemen',
283
  'ZM' => 'Zambia',
284
+ 'ZW' => 'Zimbabwe'
285
+ ];
286
 
287
  /**
288
  * Get a country's name by its ISO Code
311
  {
312
  return array_search(strtolower($country_name), array_map('strtolower', self::$countries));
313
  }
314
+
315
+ /**
316
+ * Retrieves a list with all supported countries
317
+ *
318
+ * @return array
319
+ */
320
+ public static function getList()
321
+ {
322
+ return \Genesis\Utils\Common::getArrayKeys(self::$countries);
323
+ }
324
  }
lib/Genesis/src/Genesis/Utils/Currency.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  * Permission is hereby granted, free of charge, to any person obtaining a copy
4
- * of this software and associated documentation files (the "Software"), to deal
5
  * in the Software without restriction, including without limitation the rights
6
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
  * copies of the Software, and to permit persons to whom the Software is
@@ -35,1076 +35,1076 @@ final class Currency
35
  * @var array
36
  */
37
  public static $iso4217
38
- = array(
39
- 'AED' => array(
40
  'name' => 'UAE Dirham',
41
  'code' => '784',
42
  'country' => 'UNITED ARAB EMIRATES (THE)',
43
  'exponent' => '2'
44
- ),
45
- 'AFN' => array(
46
  'name' => 'Afghani',
47
  'code' => '971',
48
  'country' => 'AFGHANISTAN',
49
  'exponent' => '2'
50
- ),
51
- 'ALL' => array(
52
  'name' => 'Lek',
53
  'code' => '008',
54
  'country' => 'ALBANIA',
55
  'exponent' => '2'
56
- ),
57
- 'AMD' => array(
58
  'name' => 'Armenian Dram',
59
  'code' => '051',
60
  'country' => 'ARMENIA',
61
  'exponent' => '2'
62
- ),
63
- 'ANG' => array(
64
  'name' => 'Netherlands Antillean Guilder',
65
  'code' => '532',
66
  'country' => 'SINT MAARTEN (DUTCH PART)',
67
  'exponent' => '2'
68
- ),
69
- 'AOA' => array(
70
  'name' => 'Kwanza',
71
  'code' => '973',
72
  'country' => 'ANGOLA',
73
  'exponent' => '2'
74
- ),
75
- 'ARS' => array(
76
  'name' => 'Argentine Peso',
77
  'code' => '032',
78
  'country' => 'ARGENTINA',
79
  'exponent' => '2'
80
- ),
81
- 'AUD' => array(
82
  'name' => 'Australian Dollar',
83
  'code' => '036',
84
  'country' => 'TUVALU',
85
  'exponent' => '2'
86
- ),
87
- 'AWG' => array(
88
  'name' => 'Aruban Florin',
89
  'code' => '533',
90
  'country' => 'ARUBA',
91
  'exponent' => '2'
92
- ),
93
- 'AZN' => array(
94
  'name' => 'Azerbaijanian Manat',
95
  'code' => '944',
96
  'country' => 'AZERBAIJAN',
97
  'exponent' => '2'
98
- ),
99
- 'BAM' => array(
100
  'name' => 'Convertible Mark',
101
  'code' => '977',
102
  'country' => 'BOSNIA AND HERZEGOVINA',
103
  'exponent' => '2'
104
- ),
105
- 'BBD' => array(
106
  'name' => 'Barbados Dollar',
107
  'code' => '052',
108
  'country' => 'BARBADOS',
109
  'exponent' => '2'
110
- ),
111
- 'BDT' => array(
112
  'name' => 'Taka',
113
  'code' => '050',
114
  'country' => 'BANGLADESH',
115
  'exponent' => '2'
116
- ),
117
- 'BGN' => array(
118
  'name' => 'Bulgarian Lev',
119
  'code' => '975',
120
  'country' => 'BULGARIA',
121
  'exponent' => '2'
122
- ),
123
- 'BHD' => array(
124
  'name' => 'Bahraini Dinar',
125
  'code' => '048',
126
  'country' => 'BAHRAIN',
127
  'exponent' => '3'
128
- ),
129
- 'BIF' => array(
130
  'name' => 'Burundi Franc',
131
  'code' => '108',
132
  'country' => 'BURUNDI',
133
  'exponent' => '0'
134
- ),
135
- 'BMD' => array(
136
  'name' => 'Bermudian Dollar',
137
  'code' => '060',
138
  'country' => 'BERMUDA',
139
  'exponent' => '2'
140
- ),
141
- 'BND' => array(
142
  'name' => 'Brunei Dollar',
143
  'code' => '096',
144
  'country' => 'BRUNEI DARUSSALAM',
145
  'exponent' => '2'
146
- ),
147
- 'BOB' => array(
148
  'name' => 'Boliviano',
149
  'code' => '068',
150
  'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
151
  'exponent' => '2'
152
- ),
153
- 'BOV' => array(
154
  'name' => 'Mvdol',
155
  'code' => '984',
156
  'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
157
  'exponent' => '2'
158
- ),
159
- 'BRL' => array(
160
  'name' => 'Brazilian Real',
161
  'code' => '986',
162
  'country' => 'BRAZIL',
163
  'exponent' => '2'
164
- ),
165
- 'BSD' => array(
166
  'name' => 'Bahamian Dollar',
167
  'code' => '044',
168
  'country' => 'BAHAMAS (THE)',
169
  'exponent' => '2'
170
- ),
171
- 'BTN' => array(
172
  'name' => 'Ngultrum',
173
  'code' => '064',
174
  'country' => 'BHUTAN',
175
  'exponent' => '2'
176
- ),
177
- 'BWP' => array(
178
  'name' => 'Pula',
179
  'code' => '072',
180
  'country' => 'BOTSWANA',
181
  'exponent' => '2'
182
- ),
183
- 'BYR' => array(
184
  'name' => 'Belarussian Ruble',
185
  'code' => '974',
186
  'country' => 'BELARUS',
187
  'exponent' => '0'
188
- ),
189
- 'BZD' => array(
190
  'name' => 'Belize Dollar',
191
  'code' => '084',
192
  'country' => 'BELIZE',
193
  'exponent' => '2'
194
- ),
195
- 'CAD' => array(
196
  'name' => 'Canadian Dollar',
197
  'code' => '124',
198
  'country' => 'CANADA',
199
  'exponent' => '2'
200
- ),
201
- 'CDF' => array(
202
  'name' => 'Congolese Franc',
203
  'code' => '976',
204
  'country' => 'CONGO (THE DEMOCRATIC REPUBLIC OF THE)',
205
  'exponent' => '2'
206
- ),
207
- 'CHE' => array(
208
  'name' => 'WIR Euro',
209
  'code' => '947',
210
  'country' => 'SWITZERLAND',
211
  'exponent' => '2'
212
- ),
213
- 'CHF' => array(
214
  'name' => 'Swiss Franc',
215
  'code' => '756',
216
  'country' => 'SWITZERLAND',
217
  'exponent' => '2'
218
- ),
219
- 'CHW' => array(
220
  'name' => 'WIR Franc',
221
  'code' => '948',
222
  'country' => 'SWITZERLAND',
223
  'exponent' => '2'
224
- ),
225
- 'CLF' => array(
226
  'name' => 'Unidad de Fomento',
227
  'code' => '990',
228
  'country' => 'CHILE',
229
  'exponent' => '4'
230
- ),
231
- 'CLP' => array(
232
  'name' => 'Chilean Peso',
233
  'code' => '152',
234
  'country' => 'CHILE',
235
  'exponent' => '0'
236
- ),
237
- 'CNY' => array(
238
  'name' => 'Yuan Renminbi',
239
  'code' => '156',
240
  'country' => 'CHINA',
241
  'exponent' => '2'
242
- ),
243
- 'COP' => array(
244
  'name' => 'Colombian Peso',
245
  'code' => '170',
246
  'country' => 'COLOMBIA',
247
  'exponent' => '2'
248
- ),
249
- 'COU' => array(
250
  'name' => 'Unidad de Valor Real',
251
  'code' => '970',
252
  'country' => 'COLOMBIA',
253
  'exponent' => '2'
254
- ),
255
- 'CRC' => array(
256
  'name' => 'Costa Rican Colon',
257
  'code' => '188',
258
  'country' => 'COSTA RICA',
259
  'exponent' => '2'
260
- ),
261
- 'CUC' => array(
262
  'name' => 'Peso Convertible',
263
  'code' => '931',
264
  'country' => 'CUBA',
265
  'exponent' => '2'
266
- ),
267
- 'CUP' => array(
268
  'name' => 'Cuban Peso',
269
  'code' => '192',
270
  'country' => 'CUBA',
271
  'exponent' => '2'
272
- ),
273
- 'CVE' => array(
274
  'name' => 'Cabo Verde Escudo',
275
  'code' => '132',
276
  'country' => 'CABO VERDE',
277
  'exponent' => '2'
278
- ),
279
- 'CZK' => array(
280
  'name' => 'Czech Koruna',
281
  'code' => '203',
282
  'country' => 'CZECH REPUBLIC (THE)',
283
  'exponent' => '2'
284
- ),
285
- 'DJF' => array(
286
  'name' => 'Djibouti Franc',
287
  'code' => '262',
288
  'country' => 'DJIBOUTI',
289
  'exponent' => '0'
290
- ),
291
- 'DKK' => array(
292
  'name' => 'Danish Krone',
293
  'code' => '208',
294
  'country' => 'GREENLAND',
295
  'exponent' => '2'
296
- ),
297
- 'DOP' => array(
298
  'name' => 'Dominican Peso',
299
  'code' => '214',
300
  'country' => 'DOMINICAN REPUBLIC (THE)',
301
  'exponent' => '2'
302
- ),
303
- 'DZD' => array(
304
  'name' => 'Algerian Dinar',
305
  'code' => '012',
306
  'country' => 'ALGERIA',
307
  'exponent' => '2'
308
- ),
309
- 'EGP' => array(
310
  'name' => 'Egyptian Pound',
311
  'code' => '818',
312
  'country' => 'EGYPT',
313
  'exponent' => '2'
314
- ),
315
- 'ERN' => array(
316
  'name' => 'Nakfa',
317
  'code' => '232',
318
  'country' => 'ERITREA',
319
  'exponent' => '2'
320
- ),
321
- 'ETB' => array(
322
  'name' => 'Ethiopian Birr',
323
  'code' => '230',
324
  'country' => 'ETHIOPIA',
325
  'exponent' => '2'
326
- ),
327
- 'EUR' => array(
328
  'name' => 'Euro',
329
  'code' => '978',
330
  'country' => 'SPAIN',
331
  'exponent' => '2'
332
- ),
333
- 'FJD' => array(
334
  'name' => 'Fiji Dollar',
335
  'code' => '242',
336
  'country' => 'FIJI',
337
  'exponent' => '2'
338
- ),
339
- 'FKP' => array(
340
  'name' => 'Falkland Islands Pound',
341
  'code' => '238',
342
  'country' => 'FALKLAND ISLANDS (THE) [MALVINAS]',
343
  'exponent' => '2'
344
- ),
345
- 'GBP' => array(
346
  'name' => 'Pound Sterling',
347
  'code' => '826',
348
  'country' => 'UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)',
349
  'exponent' => '2'
350
- ),
351
- 'GEL' => array(
352
  'name' => 'Lari',
353
  'code' => '981',
354
  'country' => 'GEORGIA',
355
  'exponent' => '2'
356
- ),
357
- 'GHS' => array(
358
  'name' => 'Ghana Cedi',
359
  'code' => '936',
360
  'country' => 'GHANA',
361
  'exponent' => '2'
362
- ),
363
- 'GIP' => array(
364
  'name' => 'Gibraltar Pound',
365
  'code' => '292',
366
  'country' => 'GIBRALTAR',
367
  'exponent' => '2'
368
- ),
369
- 'GMD' => array(
370
  'name' => 'Dalasi',
371
  'code' => '270',
372
  'country' => 'GAMBIA (THE)',
373
  'exponent' => '2'
374
- ),
375
- 'GNF' => array(
376
  'name' => 'Guinea Franc',
377
  'code' => '324',
378
  'country' => 'GUINEA',
379
  'exponent' => '0'
380
- ),
381
- 'GTQ' => array(
382
  'name' => 'Quetzal',
383
  'code' => '320',
384
  'country' => 'GUATEMALA',
385
  'exponent' => '2'
386
- ),
387
- 'GYD' => array(
388
  'name' => 'Guyana Dollar',
389
  'code' => '328',
390
  'country' => 'GUYANA',
391
  'exponent' => '2'
392
- ),
393
- 'HKD' => array(
394
  'name' => 'Hong Kong Dollar',
395
  'code' => '344',
396
  'country' => 'HONG KONG',
397
  'exponent' => '2'
398
- ),
399
- 'HNL' => array(
400
  'name' => 'Lempira',
401
  'code' => '340',
402
  'country' => 'HONDURAS',
403
  'exponent' => '2'
404
- ),
405
- 'HRK' => array(
406
  'name' => 'Kuna',
407
  'code' => '191',
408
  'country' => 'CROATIA',
409
  'exponent' => '2'
410
- ),
411
- 'HTG' => array(
412
  'name' => 'Gourde',
413
  'code' => '332',
414
  'country' => 'HAITI',
415
  'exponent' => '2'
416
- ),
417
- 'HUF' => array(
418
  'name' => 'Forint',
419
  'code' => '348',
420
  'country' => 'HUNGARY',
421
  'exponent' => '2'
422
- ),
423
- 'IDR' => array(
424
  'name' => 'Rupiah',
425
  'code' => '360',
426
  'country' => 'INDONESIA',
427
  'exponent' => '2'
428
- ),
429
- 'ILS' => array(
430
  'name' => 'New Israeli Sheqel',
431
  'code' => '376',
432
  'country' => 'ISRAEL',
433
  'exponent' => '2'
434
- ),
435
- 'INR' => array(
436
  'name' => 'Indian Rupee',
437
  'code' => '356',
438
  'country' => 'INDIA',
439
  'exponent' => '2'
440
- ),
441
- 'IQD' => array(
442
  'name' => 'Iraqi Dinar',
443
  'code' => '368',
444
  'country' => 'IRAQ',
445
  'exponent' => '3'
446
- ),
447
- 'IRR' => array(
448
  'name' => 'Iranian Rial',
449
  'code' => '364',
450
  'country' => 'IRAN (ISLAMIC REPUBLIC OF)',
451
  'exponent' => '2'
452
- ),
453
- 'ISK' => array(
454
  'name' => 'Iceland Krona',
455
  'code' => '352',
456
  'country' => 'ICELAND',
457
  'exponent' => '0'
458
- ),
459
- 'JMD' => array(
460
  'name' => 'Jamaican Dollar',
461
  'code' => '388',
462
  'country' => 'JAMAICA',
463
  'exponent' => '2'
464
- ),
465
- 'JOD' => array(
466
  'name' => 'Jordanian Dinar',
467
  'code' => '400',
468
  'country' => 'JORDAN',
469
  'exponent' => '3'
470
- ),
471
- 'JPY' => array(
472
  'name' => 'Yen',
473
  'code' => '392',
474
  'country' => 'JAPAN',
475
  'exponent' => '0'
476
- ),
477
- 'KES' => array(
478
  'name' => 'Kenyan Shilling',
479
  'code' => '404',
480
  'country' => 'KENYA',
481
  'exponent' => '2'
482
- ),
483
- 'KGS' => array(
484
  'name' => 'Som',
485
  'code' => '417',
486
  'country' => 'KYRGYZSTAN',
487
  'exponent' => '2'
488
- ),
489
- 'KHR' => array(
490
  'name' => 'Riel',
491
  'code' => '116',
492
  'country' => 'CAMBODIA',
493
  'exponent' => '2'
494
- ),
495
- 'KMF' => array(
496
  'name' => 'Comoro Franc',
497
  'code' => '174',
498
  'country' => 'COMOROS (THE)',
499
  'exponent' => '0'
500
- ),
501
- 'KPW' => array(
502
  'name' => 'North Korean Won',
503
  'code' => '408',
504
  'country' => 'KOREA (THE DEMOCRATIC PEOPLE’S REPUBLIC OF)',
505
  'exponent' => '2'
506
- ),
507
- 'KRW' => array(
508
  'name' => 'Won',
509
  'code' => '410',
510
  'country' => 'KOREA (THE REPUBLIC OF)',
511
  'exponent' => '0'
512
- ),
513
- 'KWD' => array(
514
  'name' => 'Kuwaiti Dinar',
515
  'code' => '414',
516
  'country' => 'KUWAIT',
517
  'exponent' => '3'
518
- ),
519
- 'KYD' => array(
520
  'name' => 'Cayman Islands Dollar',
521
  'code' => '136',
522
  'country' => 'CAYMAN ISLANDS (THE)',
523
  'exponent' => '2'
524
- ),
525
- 'KZT' => array(
526
  'name' => 'Tenge',
527
  'code' => '398',
528
  'country' => 'KAZAKHSTAN',
529
  'exponent' => '2'
530
- ),
531
- 'LAK' => array(
532
  'name' => 'Kip',
533
  'code' => '418',
534
  'country' => 'LAO PEOPLE’S DEMOCRATIC REPUBLIC (THE)',
535
  'exponent' => '2'
536
- ),
537
- 'LBP' => array(
538
  'name' => 'Lebanese Pound',
539
  'code' => '422',
540
  'country' => 'LEBANON',
541
  'exponent' => '2'
542
- ),
543
- 'LKR' => array(
544
  'name' => 'Sri Lanka Rupee',
545
  'code' => '144',
546
  'country' => 'SRI LANKA',
547
  'exponent' => '2'
548
- ),
549
- 'LRD' => array(
550
  'name' => 'Liberian Dollar',
551
  'code' => '430',
552
  'country' => 'LIBERIA',
553
  'exponent' => '2'
554
- ),
555
- 'LSL' => array(
556
  'name' => 'Loti',
557
  'code' => '426',
558
  'country' => 'LESOTHO',
559
  'exponent' => '2'
560
- ),
561
- 'LYD' => array(
562
  'name' => 'Libyan Dinar',
563
  'code' => '434',
564
  'country' => 'LIBYA',
565
  'exponent' => '3'
566
- ),
567
- 'MAD' => array(
568
  'name' => 'Moroccan Dirham',
569
  'code' => '504',
570
  'country' => 'WESTERN SAHARA',
571
  'exponent' => '2'
572
- ),
573
- 'MDL' => array(
574
  'name' => 'Moldovan Leu',
575
  'code' => '498',
576
  'country' => 'MOLDOVA (THE REPUBLIC OF)',
577
  'exponent' => '2'
578
- ),
579
- 'MGA' => array(
580
  'name' => 'Malagasy Ariary',
581
  'code' => '969',
582
  'country' => 'MADAGASCAR',
583
  'exponent' => '2'
584
- ),
585
- 'MKD' => array(
586
  'name' => 'Denar',
587
  'code' => '807',
588
  'country' => 'MACEDONIA (THE FORMER YUGOSLAV REPUBLIC OF)',
589
  'exponent' => '2'
590
- ),
591
- 'MMK' => array(
592
  'name' => 'Kyat',
593
  'code' => '104',
594
  'country' => 'MYANMAR',
595
  'exponent' => '2'
596
- ),
597
- 'MNT' => array(
598
  'name' => 'Tugrik',
599
  'code' => '496',
600
  'country' => 'MONGOLIA',
601
  'exponent' => '2'
602
- ),
603
- 'MOP' => array(
604
  'name' => 'Pataca',
605
  'code' => '446',
606
  'country' => 'MACAO',
607
  'exponent' => '2'
608
- ),
609
- 'MRO' => array(
610
  'name' => 'Ouguiya',
611
  'code' => '478',
612
  'country' => 'MAURITANIA',
613
  'exponent' => '2'
614
- ),
615
- 'MUR' => array(
616
  'name' => 'Mauritius Rupee',
617
  'code' => '480',
618
  'country' => 'MAURITIUS',
619
  'exponent' => '2'
620
- ),
621
- 'MVR' => array(
622
  'name' => 'Rufiyaa',
623
  'code' => '462',
624
  'country' => 'MALDIVES',
625
  'exponent' => '2'
626
- ),
627
- 'MWK' => array(
628
  'name' => 'Kwacha',
629
  'code' => '454',
630
  'country' => 'MALAWI',
631
  'exponent' => '2'
632
- ),
633
- 'MXN' => array(
634
  'name' => 'Mexican Peso',
635
  'code' => '484',
636
  'country' => 'MEXICO',
637
  'exponent' => '2'
638
- ),
639
- 'MXV' => array(
640
  'name' => 'Mexican Unidad de Inversion (UDI)',
641
  'code' => '979',
642
  'country' => 'MEXICO',
643
  'exponent' => '2'
644
- ),
645
- 'MYR' => array(
646
  'name' => 'Malaysian Ringgit',
647
  'code' => '458',
648
  'country' => 'MALAYSIA',
649
  'exponent' => '2'
650
- ),
651
- 'MZN' => array(
652
  'name' => 'Mozambique Metical',
653
  'code' => '943',
654
  'country' => 'MOZAMBIQUE',
655
  'exponent' => '2'
656
- ),
657
- 'NAD' => array(
658
  'name' => 'Namibia Dollar',
659
  'code' => '516',
660
  'country' => 'NAMIBIA',
661
  'exponent' => '2'
662
- ),
663
- 'NGN' => array(
664
  'name' => 'Naira',
665
  'code' => '566',
666
  'country' => 'NIGERIA',
667
  'exponent' => '2'
668
- ),
669
- 'NIO' => array(
670
  'name' => 'Cordoba Oro',
671
  'code' => '558',
672
  'country' => 'NICARAGUA',
673
  'exponent' => '2'
674
- ),
675
- 'NOK' => array(
676
  'name' => 'Norwegian Krone',
677
  'code' => '578',
678
  'country' => 'SVALBARD AND JAN MAYEN',
679
  'exponent' => '2'
680
- ),
681
- 'NPR' => array(
682
  'name' => 'Nepalese Rupee',
683
  'code' => '524',
684
  'country' => 'NEPAL',
685
  'exponent' => '2'
686
- ),
687
- 'NZD' => array(
688
  'name' => 'New Zealand Dollar',
689
  'code' => '554',
690
  'country' => 'TOKELAU',
691
  'exponent' => '2'
692
- ),
693
- 'OMR' => array(
694
  'name' => 'Rial Omani',
695
  'code' => '512',
696
  'country' => 'OMAN',
697
  'exponent' => '3'
698
- ),
699
- 'PAB' => array(
700
  'name' => 'Balboa',
701
  'code' => '590',
702
  'country' => 'PANAMA',
703
  'exponent' => '2'
704
- ),
705
- 'PEN' => array(
706
  'name' => 'Nuevo Sol',
707
  'code' => '604',
708
  'country' => 'PERU',
709
  'exponent' => '2'
710
- ),
711
- 'PGK' => array(
712
  'name' => 'Kina',
713
  'code' => '598',
714
  'country' => 'PAPUA NEW GUINEA',
715
  'exponent' => '2'
716
- ),
717
- 'PHP' => array(
718
  'name' => 'Philippine Peso',
719
  'code' => '608',
720
  'country' => 'PHILIPPINES (THE)',
721
  'exponent' => '2'
722
- ),
723
- 'PKR' => array(
724
  'name' => 'Pakistan Rupee',
725
  'code' => '586',
726
  'country' => 'PAKISTAN',
727
  'exponent' => '2'
728
- ),
729
- 'PLN' => array(
730
  'name' => 'Zloty',
731
  'code' => '985',
732
  'country' => 'POLAND',
733
  'exponent' => '2'
734
- ),
735
- 'PYG' => array(
736
  'name' => 'Guarani',
737
  'code' => '600',
738
  'country' => 'PARAGUAY',
739
  'exponent' => '0'
740
- ),
741
- 'QAR' => array(
742
  'name' => 'Qatari Rial',
743
  'code' => '634',
744
  'country' => 'QATAR',
745
  'exponent' => '2'
746
- ),
747
- 'RON' => array(
748
  'name' => 'Romanian Leu',
749
  'code' => '946',
750
  'country' => 'ROMANIA',
751
  'exponent' => '2'
752
- ),
753
- 'RSD' => array(
754
  'name' => 'Serbian Dinar',
755
  'code' => '941',
756
  'country' => 'SERBIA',
757
  'exponent' => '2'
758
- ),
759
- 'RUB' => array(
760
  'name' => 'Russian Ruble',
761
  'code' => '643',
762
  'country' => 'RUSSIAN FEDERATION (THE)',
763
  'exponent' => '2'
764
- ),
765
- 'RWF' => array(
766
  'name' => 'Rwanda Franc',
767
  'code' => '646',
768
  'country' => 'RWANDA',
769
  'exponent' => '0'
770
- ),
771
- 'SAR' => array(
772
  'name' => 'Saudi Riyal',
773
  'code' => '682',
774
  'country' => 'SAUDI ARABIA',
775
  'exponent' => '2'
776
- ),
777
- 'SBD' => array(
778
  'name' => 'Solomon Islands Dollar',
779
  'code' => '090',
780
  'country' => 'SOLOMON ISLANDS',
781
  'exponent' => '2'
782
- ),
783
- 'SCR' => array(
784
  'name' => 'Seychelles Rupee',
785
  'code' => '690',
786
  'country' => 'SEYCHELLES',
787
  'exponent' => '2'
788
- ),
789
- 'SDG' => array(
790
  'name' => 'Sudanese Pound',
791
  'code' => '938',
792
  'country' => 'SUDAN (THE)',
793
  'exponent' => '2'
794
- ),
795
- 'SEK' => array(
796
  'name' => 'Swedish Krona',
797
  'code' => '752',
798
  'country' => 'SWEDEN',
799
  'exponent' => '2'
800
- ),
801
- 'SGD' => array(
802
  'name' => 'Singapore Dollar',
803
  'code' => '702',
804
  'country' => 'SINGAPORE',
805
  'exponent' => '2'
806
- ),
807
- 'SHP' => array(
808
  'name' => 'Saint Helena Pound',
809
  'code' => '654',
810
  'country' => 'SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA',
811
  'exponent' => '2'
812
- ),
813
- 'SLL' => array(
814
  'name' => 'Leone',
815
  'code' => '694',
816
  'country' => 'SIERRA LEONE',
817
  'exponent' => '2'
818
- ),
819
- 'SOS' => array(
820
  'name' => 'Somali Shilling',
821
  'code' => '706',
822
  'country' => 'SOMALIA',
823
  'exponent' => '2'
824
- ),
825
- 'SRD' => array(
826
  'name' => 'Surinam Dollar',
827
  'code' => '968',
828
  'country' => 'SURINAME',
829
  'exponent' => '2'
830
- ),
831
- 'SSP' => array(
832
  'name' => 'South Sudanese Pound',
833
  'code' => '728',
834
  'country' => 'SOUTH SUDAN',
835
  'exponent' => '2'
836
- ),
837
- 'STD' => array(
838
  'name' => 'Dobra',
839
  'code' => '678',
840
  'country' => 'SAO TOME AND PRINCIPE',
841
  'exponent' => '2'
842
- ),
843
- 'SVC' => array(
844
  'name' => 'El Salvador Colon',
845
  'code' => '222',
846
  'country' => 'EL SALVADOR',
847
  'exponent' => '2'
848
- ),
849
- 'SYP' => array(
850
  'name' => 'Syrian Pound',
851
  'code' => '760',
852
  'country' => 'SYRIAN ARAB REPUBLIC',
853
  'exponent' => '2'
854
- ),
855
- 'SZL' => array(
856
  'name' => 'Lilangeni',
857
  'code' => '748',
858
  'country' => 'SWAZILAND',
859
  'exponent' => '2'
860
- ),
861
- 'THB' => array(
862
  'name' => 'Baht',
863
  'code' => '764',
864
  'country' => 'THAILAND',
865
  'exponent' => '2'
866
- ),
867
- 'TJS' => array(
868
  'name' => 'Somoni',
869
  'code' => '972',
870
  'country' => 'TAJIKISTAN',
871
  'exponent' => '2'
872
- ),
873
- 'TMT' => array(
874
  'name' => 'Turkmenistan New Manat',
875
  'code' => '934',
876
  'country' => 'TURKMENISTAN',
877
  'exponent' => '2'
878
- ),
879
- 'TND' => array(
880
  'name' => 'Tunisian Dinar',
881
  'code' => '788',
882
  'country' => 'TUNISIA',
883
  'exponent' => '3'
884
- ),
885
- 'TOP' => array(
886
  'name' => 'Pa’anga',
887
  'code' => '776',
888
  'country' => 'TONGA',
889
  'exponent' => '2'
890
- ),
891
- 'TRY' => array(
892
  'name' => 'Turkish Lira',
893
  'code' => '949',
894
  'country' => 'TURKEY',
895
  'exponent' => '2'
896
- ),
897
- 'TTD' => array(
898
  'name' => 'Trinidad and Tobago Dollar',
899
  'code' => '780',
900
  'country' => 'TRINIDAD AND TOBAGO',
901
  'exponent' => '2'
902
- ),
903
- 'TWD' => array(
904
  'name' => 'New Taiwan Dollar',
905
  'code' => '901',
906
  'country' => 'TAIWAN (PROVINCE OF CHINA)',
907
  'exponent' => '2'
908
- ),
909
- 'TZS' => array(
910
  'name' => 'Tanzanian Shilling',
911
  'code' => '834',
912
  'country' => 'TANZANIA, UNITED REPUBLIC OF',
913
  'exponent' => '2'
914
- ),
915
- 'UAH' => array(
916
  'name' => 'Hryvnia',
917
  'code' => '980',
918
  'country' => 'UKRAINE',
919
  'exponent' => '2'
920
- ),
921
- 'UGX' => array(
922
  'name' => 'Uganda Shilling',
923
  'code' => '800',
924
  'country' => 'UGANDA',
925
  'exponent' => '0'
926
- ),
927
- 'USD' => array(
928
  'name' => 'US Dollar',
929
  'code' => '840',
930
  'country' => 'VIRGIN ISLANDS (U.S.)',
931
  'exponent' => '2'
932
- ),
933
- 'USN' => array(
934
  'name' => 'US Dollar (Next day)',
935
  'code' => '997',
936
  'country' => 'UNITED STATES OF AMERICA (THE)',
937
  'exponent' => '2'
938
- ),
939
- 'UYI' => array(
940
  'name' => 'Uruguay Peso en Unidades Indexadas (URUIURUI)',
941
  'code' => '940',
942
  'country' => 'URUGUAY',
943
  'exponent' => '0'
944
- ),
945
- 'UYU' => array(
946
  'name' => 'Peso Uruguayo',
947
  'code' => '858',
948
  'country' => 'URUGUAY',
949
  'exponent' => '2'
950
- ),
951
- 'UZS' => array(
952
  'name' => 'Uzbekistan Sum',
953
  'code' => '860',
954
  'country' => 'UZBEKISTAN',
955
  'exponent' => '2'
956
- ),
957
- 'VEF' => array(
958
  'name' => 'Bolivar',
959
  'code' => '937',
960
  'country' => 'VENEZUELA (BOLIVARIAN REPUBLIC OF)',
961
  'exponent' => '2'
962
- ),
963
- 'VND' => array(
964
  'name' => 'Dong',
965
  'code' => '704',
966
  'country' => 'VIET NAM',
967
  'exponent' => '0'
968
- ),
969
- 'VUV' => array(
970
  'name' => 'Vatu',
971
  'code' => '548',
972
  'country' => 'VANUATU',
973
  'exponent' => '0'
974
- ),
975
- 'WST' => array(
976
  'name' => 'Tala',
977
  'code' => '882',
978
  'country' => 'SAMOA',
979
  'exponent' => '2'
980
- ),
981
- 'XAF' => array(
982
  'name' => 'CFA Franc BEAC',
983
  'code' => '950',
984
  'country' => 'GABON',
985
  'exponent' => '0'
986
- ),
987
- 'XAG' => array(
988
  'name' => 'Silver',
989
  'code' => '961',
990
  'country' => 'ZZ11_Silver',
991
  'exponent' => 'N.A.'
992
- ),
993
- 'XAU' => array(
994
  'name' => 'Gold',
995
  'code' => '959',
996
  'country' => 'ZZ08_Gold',
997
  'exponent' => 'N.A.'
998
- ),
999
- 'XBA' => array(
1000
  'name' => 'Bond Markets Unit European Composite Unit (EURCO)',
1001
  'code' => '955',
1002
  'country' => 'ZZ01_Bond Markets Unit European_EURCO',
1003
  'exponent' => 'N.A.'
1004
- ),
1005
- 'XBB' => array(
1006
  'name' => 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
1007
  'code' => '956',
1008
  'country' => 'ZZ02_Bond Markets Unit European_EMU-6',
1009
  'exponent' => 'N.A.'
1010
- ),
1011
- 'XBC' => array(
1012
  'name' => 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
1013
  'code' => '957',
1014
  'country' => 'ZZ03_Bond Markets Unit European_EUA-9',
1015
  'exponent' => 'N.A.'
1016
- ),
1017
- 'XBD' => array(
1018
  'name' => 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
1019
  'code' => '958',
1020
  'country' => 'ZZ04_Bond Markets Unit European_EUA-17',
1021
  'exponent' => 'N.A.'
1022
- ),
1023
- 'XCD' => array(
1024
  'name' => 'East Caribbean Dollar',
1025
  'code' => '951',
1026
  'country' => 'SAINT VINCENT AND THE GRENADINES',
1027
  'exponent' => '2'
1028
- ),
1029
- 'XDR' => array(
1030
  'name' => 'SDR (Special Drawing Right)',
1031
  'code' => '960',
1032
  'country' => 'INTERNATIONAL MONETARY FUND (IMF)Â ',
1033
  'exponent' => 'N.A.'
1034
- ),
1035
- 'XOF' => array(
1036
  'name' => 'CFA Franc BCEAO',
1037
  'code' => '952',
1038
  'country' => 'TOGO',
1039
  'exponent' => '0'
1040
- ),
1041
- 'XPD' => array(
1042
  'name' => 'Palladium',
1043
  'code' => '964',
1044
  'country' => 'ZZ09_Palladium',
1045
  'exponent' => 'N.A.'
1046
- ),
1047
- 'XPF' => array(
1048
  'name' => 'CFP Franc',
1049
  'code' => '953',
1050
  'country' => 'WALLIS AND FUTUNA',
1051
  'exponent' => '0'
1052
- ),
1053
- 'XPT' => array(
1054
  'name' => 'Platinum',
1055
  'code' => '962',
1056
  'country' => 'ZZ10_Platinum',
1057
  'exponent' => 'N.A.'
1058
- ),
1059
- 'XSU' => array(
1060
  'name' => 'Sucre',
1061
  'code' => '994',
1062
  'country' => 'SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS "SUCRE"',
1063
  'exponent' => 'N.A.'
1064
- ),
1065
- 'XTS' => array(
1066
  'name' => 'Codes specifically reserved for testing purposes',
1067
  'code' => '963',
1068
  'country' => 'ZZ06_Testing_Code',
1069
  'exponent' => 'N.A.'
1070
- ),
1071
- 'XUA' => array(
1072
  'name' => 'ADB Unit of Account',
1073
  'code' => '965',
1074
  'country' => 'MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP',
1075
  'exponent' => 'N.A.'
1076
- ),
1077
- 'XXX' => array(
1078
  'name' => 'The codes assigned for transactions where no currency is involved',
1079
  'code' => '999',
1080
  'country' => 'ZZ07_No_Currency',
1081
  'exponent' => 'N.A.'
1082
- ),
1083
- 'YER' => array(
1084
  'name' => 'Yemeni Rial',
1085
  'code' => '886',
1086
  'country' => 'YEMEN',
1087
  'exponent' => '2'
1088
- ),
1089
- 'ZAR' => array(
1090
  'name' => 'Rand',
1091
  'code' => '710',
1092
  'country' => 'SOUTH AFRICA',
1093
  'exponent' => '2'
1094
- ),
1095
- 'ZMW' => array(
1096
  'name' => 'Zambian Kwacha',
1097
  'code' => '967',
1098
  'country' => 'ZAMBIA',
1099
  'exponent' => '2'
1100
- ),
1101
- 'ZWL' => array(
1102
  'name' => 'Zimbabwe Dollar',
1103
  'code' => '932',
1104
  'country' => 'ZIMBABWE',
1105
  'exponent' => '2'
1106
- ),
1107
- );
1108
 
1109
  /**
1110
  * Convert amount to ISO-4217 minor currency unit
@@ -1153,4 +1153,14 @@ final class Currency
1153
 
1154
  return strval($amount);
1155
  }
 
 
 
 
 
 
 
 
 
 
1156
  }
1
  <?php
2
  /*
3
  * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"], to deal
5
  * in the Software without restriction, including without limitation the rights
6
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
  * copies of the Software, and to permit persons to whom the Software is
35
  * @var array
36
  */
37
  public static $iso4217
38
+ = [
39
+ 'AED' => [
40
  'name' => 'UAE Dirham',
41
  'code' => '784',
42
  'country' => 'UNITED ARAB EMIRATES (THE)',
43
  'exponent' => '2'
44
+ ],
45
+ 'AFN' => [
46
  'name' => 'Afghani',
47
  'code' => '971',
48
  'country' => 'AFGHANISTAN',
49
  'exponent' => '2'
50
+ ],
51
+ 'ALL' => [
52
  'name' => 'Lek',
53
  'code' => '008',
54
  'country' => 'ALBANIA',
55
  'exponent' => '2'
56
+ ],
57
+ 'AMD' => [
58
  'name' => 'Armenian Dram',
59
  'code' => '051',
60
  'country' => 'ARMENIA',
61
  'exponent' => '2'
62
+ ],
63
+ 'ANG' => [
64
  'name' => 'Netherlands Antillean Guilder',
65
  'code' => '532',
66
  'country' => 'SINT MAARTEN (DUTCH PART)',
67
  'exponent' => '2'
68
+ ],
69
+ 'AOA' => [
70
  'name' => 'Kwanza',
71
  'code' => '973',
72
  'country' => 'ANGOLA',
73
  'exponent' => '2'
74
+ ],
75
+ 'ARS' => [
76
  'name' => 'Argentine Peso',
77
  'code' => '032',
78
  'country' => 'ARGENTINA',
79
  'exponent' => '2'
80
+ ],
81
+ 'AUD' => [
82
  'name' => 'Australian Dollar',
83
  'code' => '036',
84
  'country' => 'TUVALU',
85
  'exponent' => '2'
86
+ ],
87
+ 'AWG' => [
88
  'name' => 'Aruban Florin',
89
  'code' => '533',
90
  'country' => 'ARUBA',
91
  'exponent' => '2'
92
+ ],
93
+ 'AZN' => [
94
  'name' => 'Azerbaijanian Manat',
95
  'code' => '944',
96
  'country' => 'AZERBAIJAN',
97
  'exponent' => '2'
98
+ ],
99
+ 'BAM' => [
100
  'name' => 'Convertible Mark',
101
  'code' => '977',
102
  'country' => 'BOSNIA AND HERZEGOVINA',
103
  'exponent' => '2'
104
+ ],
105
+ 'BBD' => [
106
  'name' => 'Barbados Dollar',
107
  'code' => '052',
108
  'country' => 'BARBADOS',
109
  'exponent' => '2'
110
+ ],
111
+ 'BDT' => [
112
  'name' => 'Taka',
113
  'code' => '050',
114
  'country' => 'BANGLADESH',
115
  'exponent' => '2'
116
+ ],
117
+ 'BGN' => [
118
  'name' => 'Bulgarian Lev',
119
  'code' => '975',
120
  'country' => 'BULGARIA',
121
  'exponent' => '2'
122
+ ],
123
+ 'BHD' => [
124
  'name' => 'Bahraini Dinar',
125
  'code' => '048',
126
  'country' => 'BAHRAIN',
127
  'exponent' => '3'
128
+ ],
129
+ 'BIF' => [
130
  'name' => 'Burundi Franc',
131
  'code' => '108',
132
  'country' => 'BURUNDI',
133
  'exponent' => '0'
134
+ ],
135
+ 'BMD' => [
136
  'name' => 'Bermudian Dollar',
137
  'code' => '060',
138
  'country' => 'BERMUDA',
139
  'exponent' => '2'
140
+ ],
141
+ 'BND' => [
142
  'name' => 'Brunei Dollar',
143
  'code' => '096',
144
  'country' => 'BRUNEI DARUSSALAM',
145
  'exponent' => '2'
146
+ ],
147
+ 'BOB' => [
148
  'name' => 'Boliviano',
149
  'code' => '068',
150
  'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
151
  'exponent' => '2'
152
+ ],
153
+ 'BOV' => [
154
  'name' => 'Mvdol',
155
  'code' => '984',
156
  'country' => 'BOLIVIA (PLURINATIONAL STATE OF)',
157
  'exponent' => '2'
158
+ ],
159
+ 'BRL' => [
160
  'name' => 'Brazilian Real',
161
  'code' => '986',
162
  'country' => 'BRAZIL',
163
  'exponent' => '2'
164
+ ],
165
+ 'BSD' => [
166
  'name' => 'Bahamian Dollar',
167
  'code' => '044',
168
  'country' => 'BAHAMAS (THE)',
169
  'exponent' => '2'
170
+ ],
171
+ 'BTN' => [
172
  'name' => 'Ngultrum',
173
  'code' => '064',
174
  'country' => 'BHUTAN',
175
  'exponent' => '2'
176
+ ],
177
+ 'BWP' => [
178
  'name' => 'Pula',
179
  'code' => '072',
180
  'country' => 'BOTSWANA',
181
  'exponent' => '2'
182
+ ],
183
+ 'BYR' => [
184
  'name' => 'Belarussian Ruble',
185
  'code' => '974',
186
  'country' => 'BELARUS',
187
  'exponent' => '0'
188
+ ],
189
+ 'BZD' => [
190
  'name' => 'Belize Dollar',
191
  'code' => '084',
192
  'country' => 'BELIZE',
193
  'exponent' => '2'
194
+ ],
195
+ 'CAD' => [
196
  'name' => 'Canadian Dollar',
197
  'code' => '124',
198
  'country' => 'CANADA',
199
  'exponent' => '2'
200
+ ],
201
+ 'CDF' => [
202
  'name' => 'Congolese Franc',
203
  'code' => '976',
204
  'country' => 'CONGO (THE DEMOCRATIC REPUBLIC OF THE)',
205
  'exponent' => '2'
206
+ ],
207
+ 'CHE' => [
208
  'name' => 'WIR Euro',
209
  'code' => '947',
210
  'country' => 'SWITZERLAND',
211
  'exponent' => '2'
212
+ ],
213
+ 'CHF' => [
214
  'name' => 'Swiss Franc',
215
  'code' => '756',
216
  'country' => 'SWITZERLAND',
217
  'exponent' => '2'
218
+ ],
219
+ 'CHW' => [
220
  'name' => 'WIR Franc',
221
  'code' => '948',
222
  'country' => 'SWITZERLAND',
223
  'exponent' => '2'
224
+ ],
225
+ 'CLF' => [
226
  'name' => 'Unidad de Fomento',
227
  'code' => '990',
228
  'country' => 'CHILE',
229
  'exponent' => '4'
230
+ ],
231
+ 'CLP' => [
232
  'name' => 'Chilean Peso',
233
  'code' => '152',
234
  'country' => 'CHILE',
235
  'exponent' => '0'
236
+ ],
237
+ 'CNY' => [
238
  'name' => 'Yuan Renminbi',
239
  'code' => '156',
240
  'country' => 'CHINA',
241
  'exponent' => '2'
242
+ ],
243
+ 'COP' => [
244
  'name' => 'Colombian Peso',
245
  'code' => '170',
246
  'country' => 'COLOMBIA',
247
  'exponent' => '2'
248
+ ],
249
+ 'COU' => [
250
  'name' => 'Unidad de Valor Real',
251
  'code' => '970',
252
  'country' => 'COLOMBIA',
253
  'exponent' => '2'
254
+ ],
255
+ 'CRC' => [
256
  'name' => 'Costa Rican Colon',
257
  'code' => '188',
258
  'country' => 'COSTA RICA',
259
  'exponent' => '2'
260
+ ],
261
+ 'CUC' => [
262
  'name' => 'Peso Convertible',
263
  'code' => '931',
264
  'country' => 'CUBA',
265
  'exponent' => '2'
266
+ ],
267
+ 'CUP' => [
268
  'name' => 'Cuban Peso',
269
  'code' => '192',
270
  'country' => 'CUBA',
271
  'exponent' => '2'
272
+ ],
273
+ 'CVE' => [
274
  'name' => 'Cabo Verde Escudo',
275
  'code' => '132',
276
  'country' => 'CABO VERDE',
277
  'exponent' => '2'
278
+ ],
279
+ 'CZK' => [
280
  'name' => 'Czech Koruna',
281
  'code' => '203',
282
  'country' => 'CZECH REPUBLIC (THE)',
283
  'exponent' => '2'
284
+ ],
285
+ 'DJF' => [
286
  'name' => 'Djibouti Franc',
287
  'code' => '262',
288
  'country' => 'DJIBOUTI',
289
  'exponent' => '0'
290
+ ],
291
+ 'DKK' => [
292
  'name' => 'Danish Krone',
293
  'code' => '208',
294
  'country' => 'GREENLAND',
295
  'exponent' => '2'
296
+ ],
297
+ 'DOP' => [
298
  'name' => 'Dominican Peso',
299
  'code' => '214',
300
  'country' => 'DOMINICAN REPUBLIC (THE)',
301
  'exponent' => '2'
302
+ ],
303
+ 'DZD' => [
304
  'name' => 'Algerian Dinar',
305
  'code' => '012',
306
  'country' => 'ALGERIA',
307
  'exponent' => '2'
308
+ ],
309
+ 'EGP' => [
310
  'name' => 'Egyptian Pound',
311
  'code' => '818',
312
  'country' => 'EGYPT',
313
  'exponent' => '2'
314
+ ],
315
+ 'ERN' => [
316
  'name' => 'Nakfa',
317
  'code' => '232',
318
  'country' => 'ERITREA',
319
  'exponent' => '2'
320
+ ],
321
+ 'ETB' => [
322
  'name' => 'Ethiopian Birr',
323
  'code' => '230',
324
  'country' => 'ETHIOPIA',
325
  'exponent' => '2'
326
+ ],
327
+ 'EUR' => [
328
  'name' => 'Euro',
329
  'code' => '978',
330
  'country' => 'SPAIN',
331
  'exponent' => '2'
332
+ ],
333
+ 'FJD' => [
334
  'name' => 'Fiji Dollar',
335
  'code' => '242',
336
  'country' => 'FIJI',
337
  'exponent' => '2'
338
+ ],
339
+ 'FKP' => [
340
  'name' => 'Falkland Islands Pound',
341
  'code' => '238',
342
  'country' => 'FALKLAND ISLANDS (THE) [MALVINAS]',
343
  'exponent' => '2'
344
+ ],
345
+ 'GBP' => [
346
  'name' => 'Pound Sterling',
347
  'code' => '826',
348
  'country' => 'UNITED KINGDOM OF GREAT BRITAIN AND NORTHERN IRELAND (THE)',
349
  'exponent' => '2'
350
+ ],
351
+ 'GEL' => [
352
  'name' => 'Lari',
353
  'code' => '981',
354
  'country' => 'GEORGIA',
355
  'exponent' => '2'
356
+ ],
357
+ 'GHS' => [
358
  'name' => 'Ghana Cedi',
359
  'code' => '936',
360
  'country' => 'GHANA',
361
  'exponent' => '2'
362
+ ],
363
+ 'GIP' => [
364
  'name' => 'Gibraltar Pound',
365
  'code' => '292',
366
  'country' => 'GIBRALTAR',
367
  'exponent' => '2'
368
+ ],
369
+ 'GMD' => [
370
  'name' => 'Dalasi',
371
  'code' => '270',
372
  'country' => 'GAMBIA (THE)',
373
  'exponent' => '2'
374
+ ],
375
+ 'GNF' => [
376
  'name' => 'Guinea Franc',
377
  'code' => '324',
378
  'country' => 'GUINEA',
379
  'exponent' => '0'
380
+ ],
381
+ 'GTQ' => [
382
  'name' => 'Quetzal',
383
  'code' => '320',
384
  'country' => 'GUATEMALA',
385
  'exponent' => '2'
386
+ ],
387
+ 'GYD' => [
388
  'name' => 'Guyana Dollar',
389
  'code' => '328',
390
  'country' => 'GUYANA',
391
  'exponent' => '2'
392
+ ],
393
+ 'HKD' => [
394
  'name' => 'Hong Kong Dollar',
395
  'code' => '344',
396
  'country' => 'HONG KONG',
397
  'exponent' => '2'
398
+ ],
399
+ 'HNL' => [
400
  'name' => 'Lempira',
401
  'code' => '340',
402
  'country' => 'HONDURAS',
403
  'exponent' => '2'
404
+ ],
405
+ 'HRK' => [
406
  'name' => 'Kuna',
407
  'code' => '191',
408
  'country' => 'CROATIA',
409
  'exponent' => '2'
410
+ ],
411
+ 'HTG' => [
412
  'name' => 'Gourde',
413
  'code' => '332',
414
  'country' => 'HAITI',
415
  'exponent' => '2'
416
+ ],
417
+ 'HUF' => [
418
  'name' => 'Forint',
419
  'code' => '348',
420
  'country' => 'HUNGARY',
421
  'exponent' => '2'
422
+ ],
423
+ 'IDR' => [
424
  'name' => 'Rupiah',
425
  'code' => '360',
426
  'country' => 'INDONESIA',
427
  'exponent' => '2'
428
+ ],
429
+ 'ILS' => [
430
  'name' => 'New Israeli Sheqel',
431
  'code' => '376',
432
  'country' => 'ISRAEL',
433
  'exponent' => '2'
434
+ ],
435
+ 'INR' => [
436
  'name' => 'Indian Rupee',
437
  'code' => '356',
438
  'country' => 'INDIA',
439
  'exponent' => '2'
440
+ ],
441
+ 'IQD' => [
442
  'name' => 'Iraqi Dinar',
443
  'code' => '368',
444
  'country' => 'IRAQ',
445
  'exponent' => '3'
446
+ ],
447
+ 'IRR' => [
448
  'name' => 'Iranian Rial',
449
  'code' => '364',
450
  'country' => 'IRAN (ISLAMIC REPUBLIC OF)',
451
  'exponent' => '2'
452
+ ],
453
+ 'ISK' => [
454
  'name' => 'Iceland Krona',
455
  'code' => '352',
456
  'country' => 'ICELAND',
457
  'exponent' => '0'
458
+ ],
459
+ 'JMD' => [
460
  'name' => 'Jamaican Dollar',
461
  'code' => '388',
462
  'country' => 'JAMAICA',
463
  'exponent' => '2'
464
+ ],
465
+ 'JOD' => [
466
  'name' => 'Jordanian Dinar',
467
  'code' => '400',
468
  'country' => 'JORDAN',
469
  'exponent' => '3'
470
+ ],
471
+ 'JPY' => [
472
  'name' => 'Yen',
473
  'code' => '392',
474
  'country' => 'JAPAN',
475
  'exponent' => '0'
476
+ ],
477
+ 'KES' => [
478
  'name' => 'Kenyan Shilling',
479
  'code' => '404',
480
  'country' => 'KENYA',
481
  'exponent' => '2'
482
+ ],
483
+ 'KGS' => [
484
  'name' => 'Som',
485
  'code' => '417',
486
  'country' => 'KYRGYZSTAN',
487
  'exponent' => '2'
488
+ ],
489
+ 'KHR' => [
490
  'name' => 'Riel',
491
  'code' => '116',
492
  'country' => 'CAMBODIA',
493
  'exponent' => '2'
494
+ ],
495
+ 'KMF' => [
496
  'name' => 'Comoro Franc',
497
  'code' => '174',
498
  'country' => 'COMOROS (THE)',
499
  'exponent' => '0'
500
+ ],
501
+ 'KPW' => [
502
  'name' => 'North Korean Won',
503
  'code' => '408',
504
  'country' => 'KOREA (THE DEMOCRATIC PEOPLE’S REPUBLIC OF)',
505
  'exponent' => '2'
506
+ ],
507
+ 'KRW' => [
508
  'name' => 'Won',
509
  'code' => '410',
510
  'country' => 'KOREA (THE REPUBLIC OF)',
511
  'exponent' => '0'
512
+ ],
513
+ 'KWD' => [
514
  'name' => 'Kuwaiti Dinar',
515
  'code' => '414',
516
  'country' => 'KUWAIT',
517
  'exponent' => '3'
518
+ ],
519
+ 'KYD' => [
520
  'name' => 'Cayman Islands Dollar',
521
  'code' => '136',
522
  'country' => 'CAYMAN ISLANDS (THE)',
523
  'exponent' => '2'
524
+ ],
525
+ 'KZT' => [
526
  'name' => 'Tenge',
527
  'code' => '398',
528
  'country' => 'KAZAKHSTAN',
529
  'exponent' => '2'
530
+ ],
531
+ 'LAK' => [
532
  'name' => 'Kip',
533
  'code' => '418',
534
  'country' => 'LAO PEOPLE’S DEMOCRATIC REPUBLIC (THE)',
535
  'exponent' => '2'
536
+ ],
537
+ 'LBP' => [
538
  'name' => 'Lebanese Pound',
539
  'code' => '422',
540
  'country' => 'LEBANON',
541
  'exponent' => '2'
542
+ ],
543
+ 'LKR' => [
544
  'name' => 'Sri Lanka Rupee',
545
  'code' => '144',
546
  'country' => 'SRI LANKA',
547
  'exponent' => '2'
548
+ ],
549
+ 'LRD' => [
550
  'name' => 'Liberian Dollar',
551
  'code' => '430',
552
  'country' => 'LIBERIA',
553
  'exponent' => '2'
554
+ ],
555
+ 'LSL' => [
556
  'name' => 'Loti',
557
  'code' => '426',
558
  'country' => 'LESOTHO',
559
  'exponent' => '2'
560
+ ],
561
+ 'LYD' => [
562
  'name' => 'Libyan Dinar',
563
  'code' => '434',
564
  'country' => 'LIBYA',
565
  'exponent' => '3'
566
+ ],
567
+ 'MAD' => [
568
  'name' => 'Moroccan Dirham',
569
  'code' => '504',
570
  'country' => 'WESTERN SAHARA',
571
  'exponent' => '2'
572
+ ],
573
+ 'MDL' => [
574
  'name' => 'Moldovan Leu',
575
  'code' => '498',
576
  'country' => 'MOLDOVA (THE REPUBLIC OF)',
577
  'exponent' => '2'
578
+ ],
579
+ 'MGA' => [
580
  'name' => 'Malagasy Ariary',
581
  'code' => '969',
582
  'country' => 'MADAGASCAR',
583
  'exponent' => '2'
584
+ ],
585
+ 'MKD' => [
586
  'name' => 'Denar',
587
  'code' => '807',
588
  'country' => 'MACEDONIA (THE FORMER YUGOSLAV REPUBLIC OF)',
589
  'exponent' => '2'
590
+ ],
591
+ 'MMK' => [
592
  'name' => 'Kyat',
593
  'code' => '104',
594
  'country' => 'MYANMAR',
595
  'exponent' => '2'
596
+ ],
597
+ 'MNT' => [
598
  'name' => 'Tugrik',
599
  'code' => '496',
600
  'country' => 'MONGOLIA',
601
  'exponent' => '2'
602
+ ],
603
+ 'MOP' => [
604
  'name' => 'Pataca',
605
  'code' => '446',
606
  'country' => 'MACAO',
607
  'exponent' => '2'
608
+ ],
609
+ 'MRO' => [
610
  'name' => 'Ouguiya',
611
  'code' => '478',
612
  'country' => 'MAURITANIA',
613
  'exponent' => '2'
614
+ ],
615
+ 'MUR' => [
616
  'name' => 'Mauritius Rupee',
617
  'code' => '480',
618
  'country' => 'MAURITIUS',
619
  'exponent' => '2'
620
+ ],
621
+ 'MVR' => [
622
  'name' => 'Rufiyaa',
623
  'code' => '462',
624
  'country' => 'MALDIVES',
625
  'exponent' => '2'
626
+ ],
627
+ 'MWK' => [
628
  'name' => 'Kwacha',
629
  'code' => '454',
630
  'country' => 'MALAWI',
631
  'exponent' => '2'
632
+ ],
633
+ 'MXN' => [
634
  'name' => 'Mexican Peso',
635
  'code' => '484',
636
  'country' => 'MEXICO',
637
  'exponent' => '2'
638
+ ],
639
+ 'MXV' => [
640
  'name' => 'Mexican Unidad de Inversion (UDI)',
641
  'code' => '979',
642
  'country' => 'MEXICO',
643
  'exponent' => '2'
644
+ ],
645
+ 'MYR' => [
646
  'name' => 'Malaysian Ringgit',
647
  'code' => '458',
648
  'country' => 'MALAYSIA',
649
  'exponent' => '2'
650
+ ],
651
+ 'MZN' => [
652
  'name' => 'Mozambique Metical',
653
  'code' => '943',
654
  'country' => 'MOZAMBIQUE',
655
  'exponent' => '2'
656
+ ],
657
+ 'NAD' => [
658
  'name' => 'Namibia Dollar',
659
  'code' => '516',
660
  'country' => 'NAMIBIA',
661
  'exponent' => '2'
662
+ ],
663
+ 'NGN' => [
664
  'name' => 'Naira',
665
  'code' => '566',
666
  'country' => 'NIGERIA',
667
  'exponent' => '2'
668
+ ],
669
+ 'NIO' => [
670
  'name' => 'Cordoba Oro',
671
  'code' => '558',
672
  'country' => 'NICARAGUA',
673
  'exponent' => '2'
674
+ ],
675
+ 'NOK' => [
676
  'name' => 'Norwegian Krone',
677
  'code' => '578',
678
  'country' => 'SVALBARD AND JAN MAYEN',
679
  'exponent' => '2'
680
+ ],
681
+ 'NPR' => [
682
  'name' => 'Nepalese Rupee',
683
  'code' => '524',
684
  'country' => 'NEPAL',
685
  'exponent' => '2'
686
+ ],
687
+ 'NZD' => [
688
  'name' => 'New Zealand Dollar',
689
  'code' => '554',
690
  'country' => 'TOKELAU',
691
  'exponent' => '2'
692
+ ],
693
+ 'OMR' => [
694
  'name' => 'Rial Omani',
695
  'code' => '512',
696
  'country' => 'OMAN',
697
  'exponent' => '3'
698
+ ],
699
+ 'PAB' => [
700
  'name' => 'Balboa',
701
  'code' => '590',
702
  'country' => 'PANAMA',
703
  'exponent' => '2'
704
+ ],
705
+ 'PEN' => [
706
  'name' => 'Nuevo Sol',
707
  'code' => '604',
708
  'country' => 'PERU',
709
  'exponent' => '2'
710
+ ],
711
+ 'PGK' => [
712
  'name' => 'Kina',
713
  'code' => '598',
714
  'country' => 'PAPUA NEW GUINEA',
715
  'exponent' => '2'
716
+ ],
717
+ 'PHP' => [
718
  'name' => 'Philippine Peso',
719
  'code' => '608',
720
  'country' => 'PHILIPPINES (THE)',
721
  'exponent' => '2'
722
+ ],
723
+ 'PKR' => [
724
  'name' => 'Pakistan Rupee',
725
  'code' => '586',
726
  'country' => 'PAKISTAN',
727
  'exponent' => '2'
728
+ ],
729
+ 'PLN' => [
730
  'name' => 'Zloty',
731
  'code' => '985',
732
  'country' => 'POLAND',
733
  'exponent' => '2'
734
+ ],
735
+ 'PYG' => [
736
  'name' => 'Guarani',
737
  'code' => '600',
738
  'country' => 'PARAGUAY',
739
  'exponent' => '0'
740
+ ],
741
+ 'QAR' => [
742
  'name' => 'Qatari Rial',
743
  'code' => '634',
744
  'country' => 'QATAR',
745
  'exponent' => '2'
746
+ ],
747
+ 'RON' => [
748
  'name' => 'Romanian Leu',
749
  'code' => '946',
750
  'country' => 'ROMANIA',
751
  'exponent' => '2'
752
+ ],
753
+ 'RSD' => [
754
  'name' => 'Serbian Dinar',
755
  'code' => '941',
756
  'country' => 'SERBIA',
757
  'exponent' => '2'
758
+ ],
759
+ 'RUB' => [
760
  'name' => 'Russian Ruble',
761
  'code' => '643',
762
  'country' => 'RUSSIAN FEDERATION (THE)',
763
  'exponent' => '2'
764
+ ],
765
+ 'RWF' => [
766
  'name' => 'Rwanda Franc',
767
  'code' => '646',
768
  'country' => 'RWANDA',
769
  'exponent' => '0'
770
+ ],
771
+ 'SAR' => [
772
  'name' => 'Saudi Riyal',
773
  'code' => '682',
774
  'country' => 'SAUDI ARABIA',
775
  'exponent' => '2'
776
+ ],
777
+ 'SBD' => [
778
  'name' => 'Solomon Islands Dollar',
779
  'code' => '090',
780
  'country' => 'SOLOMON ISLANDS',
781
  'exponent' => '2'
782
+ ],
783
+ 'SCR' => [
784
  'name' => 'Seychelles Rupee',
785
  'code' => '690',
786
  'country' => 'SEYCHELLES',
787
  'exponent' => '2'
788
+ ],
789
+ 'SDG' => [
790
  'name' => 'Sudanese Pound',
791
  'code' => '938',
792
  'country' => 'SUDAN (THE)',
793
  'exponent' => '2'
794
+ ],
795
+ 'SEK' => [
796
  'name' => 'Swedish Krona',
797
  'code' => '752',
798
  'country' => 'SWEDEN',
799
  'exponent' => '2'
800
+ ],
801
+ 'SGD' => [
802
  'name' => 'Singapore Dollar',
803
  'code' => '702',
804
  'country' => 'SINGAPORE',
805
  'exponent' => '2'
806
+ ],
807
+ 'SHP' => [
808
  'name' => 'Saint Helena Pound',
809
  'code' => '654',
810
  'country' => 'SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA',
811
  'exponent' => '2'
812
+ ],
813
+ 'SLL' => [
814
  'name' => 'Leone',
815
  'code' => '694',
816
  'country' => 'SIERRA LEONE',
817
  'exponent' => '2'
818
+ ],
819
+ 'SOS' => [
820
  'name' => 'Somali Shilling',
821
  'code' => '706',
822
  'country' => 'SOMALIA',
823
  'exponent' => '2'
824
+ ],
825
+ 'SRD' => [
826
  'name' => 'Surinam Dollar',
827
  'code' => '968',
828
  'country' => 'SURINAME',
829
  'exponent' => '2'
830
+ ],
831
+ 'SSP' => [
832
  'name' => 'South Sudanese Pound',
833
  'code' => '728',
834
  'country' => 'SOUTH SUDAN',
835
  'exponent' => '2'
836
+ ],
837
+ 'STD' => [
838
  'name' => 'Dobra',
839
  'code' => '678',
840
  'country' => 'SAO TOME AND PRINCIPE',
841
  'exponent' => '2'
842
+ ],
843
+ 'SVC' => [
844
  'name' => 'El Salvador Colon',
845
  'code' => '222',
846
  'country' => 'EL SALVADOR',
847
  'exponent' => '2'
848
+ ],
849
+ 'SYP' => [
850
  'name' => 'Syrian Pound',
851
  'code' => '760',
852
  'country' => 'SYRIAN ARAB REPUBLIC',
853
  'exponent' => '2'
854
+ ],
855
+ 'SZL' => [
856
  'name' => 'Lilangeni',
857
  'code' => '748',
858
  'country' => 'SWAZILAND',
859
  'exponent' => '2'
860
+ ],
861
+ 'THB' => [
862
  'name' => 'Baht',
863
  'code' => '764',
864
  'country' => 'THAILAND',
865
  'exponent' => '2'
866
+ ],
867
+ 'TJS' => [
868
  'name' => 'Somoni',
869
  'code' => '972',
870
  'country' => 'TAJIKISTAN',
871
  'exponent' => '2'
872
+ ],
873
+ 'TMT' => [
874
  'name' => 'Turkmenistan New Manat',
875
  'code' => '934',
876
  'country' => 'TURKMENISTAN',
877
  'exponent' => '2'
878
+ ],
879
+ 'TND' => [
880
  'name' => 'Tunisian Dinar',
881
  'code' => '788',
882
  'country' => 'TUNISIA',
883
  'exponent' => '3'
884
+ ],
885
+ 'TOP' => [
886
  'name' => 'Pa’anga',
887
  'code' => '776',
888
  'country' => 'TONGA',
889
  'exponent' => '2'
890
+ ],
891
+ 'TRY' => [
892
  'name' => 'Turkish Lira',
893
  'code' => '949',
894
  'country' => 'TURKEY',
895
  'exponent' => '2'
896
+ ],
897
+ 'TTD' => [
898
  'name' => 'Trinidad and Tobago Dollar',
899
  'code' => '780',
900
  'country' => 'TRINIDAD AND TOBAGO',
901
  'exponent' => '2'
902
+ ],
903
+ 'TWD' => [
904
  'name' => 'New Taiwan Dollar',
905
  'code' => '901',
906
  'country' => 'TAIWAN (PROVINCE OF CHINA)',
907
  'exponent' => '2'
908
+ ],
909
+ 'TZS' => [
910
  'name' => 'Tanzanian Shilling',
911
  'code' => '834',
912
  'country' => 'TANZANIA, UNITED REPUBLIC OF',
913
  'exponent' => '2'
914
+ ],
915
+ 'UAH' => [
916
  'name' => 'Hryvnia',
917
  'code' => '980',
918
  'country' => 'UKRAINE',
919
  'exponent' => '2'
920
+ ],
921
+ 'UGX' => [
922
  'name' => 'Uganda Shilling',
923
  'code' => '800',
924
  'country' => 'UGANDA',
925
  'exponent' => '0'
926
+ ],
927
+ 'USD' => [
928
  'name' => 'US Dollar',
929
  'code' => '840',
930
  'country' => 'VIRGIN ISLANDS (U.S.)',
931
  'exponent' => '2'
932
+ ],
933
+ 'USN' => [
934
  'name' => 'US Dollar (Next day)',
935
  'code' => '997',
936
  'country' => 'UNITED STATES OF AMERICA (THE)',
937
  'exponent' => '2'
938
+ ],
939
+ 'UYI' => [
940
  'name' => 'Uruguay Peso en Unidades Indexadas (URUIURUI)',
941
  'code' => '940',
942
  'country' => 'URUGUAY',
943
  'exponent' => '0'
944
+ ],
945
+ 'UYU' => [
946
  'name' => 'Peso Uruguayo',
947
  'code' => '858',
948
  'country' => 'URUGUAY',
949
  'exponent' => '2'
950
+ ],
951
+ 'UZS' => [
952
  'name' => 'Uzbekistan Sum',
953
  'code' => '860',
954
  'country' => 'UZBEKISTAN',
955
  'exponent' => '2'
956
+ ],
957
+ 'VEF' => [
958
  'name' => 'Bolivar',
959
  'code' => '937',
960
  'country' => 'VENEZUELA (BOLIVARIAN REPUBLIC OF)',
961
  'exponent' => '2'
962
+ ],
963
+ 'VND' => [
964
  'name' => 'Dong',
965
  'code' => '704',
966
  'country' => 'VIET NAM',
967
  'exponent' => '0'
968
+ ],
969
+ 'VUV' => [
970
  'name' => 'Vatu',
971
  'code' => '548',
972
  'country' => 'VANUATU',
973
  'exponent' => '0'
974
+ ],
975
+ 'WST' => [
976
  'name' => 'Tala',
977
  'code' => '882',
978
  'country' => 'SAMOA',
979
  'exponent' => '2'
980
+ ],
981
+ 'XAF' => [
982
  'name' => 'CFA Franc BEAC',
983
  'code' => '950',
984
  'country' => 'GABON',
985
  'exponent' => '0'
986
+ ],
987
+ 'XAG' => [
988
  'name' => 'Silver',
989
  'code' => '961',
990
  'country' => 'ZZ11_Silver',
991
  'exponent' => 'N.A.'
992
+ ],
993
+ 'XAU' => [
994
  'name' => 'Gold',
995
  'code' => '959',
996
  'country' => 'ZZ08_Gold',
997
  'exponent' => 'N.A.'
998
+ ],
999
+ 'XBA' => [
1000
  'name' => 'Bond Markets Unit European Composite Unit (EURCO)',
1001
  'code' => '955',
1002
  'country' => 'ZZ01_Bond Markets Unit European_EURCO',
1003
  'exponent' => 'N.A.'
1004
+ ],
1005
+ 'XBB' => [
1006
  'name' => 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
1007
  'code' => '956',
1008
  'country' => 'ZZ02_Bond Markets Unit European_EMU-6',
1009
  'exponent' => 'N.A.'
1010
+ ],
1011
+ 'XBC' => [
1012
  'name' => 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
1013
  'code' => '957',
1014
  'country' => 'ZZ03_Bond Markets Unit European_EUA-9',
1015
  'exponent' => 'N.A.'
1016
+ ],
1017
+ 'XBD' => [
1018
  'name' => 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
1019
  'code' => '958',
1020
  'country' => 'ZZ04_Bond Markets Unit European_EUA-17',
1021
  'exponent' => 'N.A.'
1022
+ ],
1023
+ 'XCD' => [
1024
  'name' => 'East Caribbean Dollar',
1025
  'code' => '951',
1026
  'country' => 'SAINT VINCENT AND THE GRENADINES',
1027
  'exponent' => '2'
1028
+ ],
1029
+ 'XDR' => [
1030
  'name' => 'SDR (Special Drawing Right)',
1031
  'code' => '960',
1032
  'country' => 'INTERNATIONAL MONETARY FUND (IMF)Â ',
1033
  'exponent' => 'N.A.'
1034
+ ],
1035
+ 'XOF' => [
1036
  'name' => 'CFA Franc BCEAO',
1037
  'code' => '952',
1038
  'country' => 'TOGO',
1039
  'exponent' => '0'
1040
+ ],
1041
+ 'XPD' => [
1042
  'name' => 'Palladium',
1043
  'code' => '964',
1044
  'country' => 'ZZ09_Palladium',
1045
  'exponent' => 'N.A.'
1046
+ ],
1047
+ 'XPF' => [
1048
  'name' => 'CFP Franc',
1049
  'code' => '953',
1050
  'country' => 'WALLIS AND FUTUNA',
1051
  'exponent' => '0'
1052
+ ],
1053
+ 'XPT' => [
1054
  'name' => 'Platinum',
1055
  'code' => '962',
1056
  'country' => 'ZZ10_Platinum',
1057
  'exponent' => 'N.A.'
1058
+ ],
1059
+ 'XSU' => [
1060
  'name' => 'Sucre',
1061
  'code' => '994',
1062
  'country' => 'SISTEMA UNITARIO DE COMPENSACION REGIONAL DE PAGOS "SUCRE"',
1063
  'exponent' => 'N.A.'
1064
+ ],
1065
+ 'XTS' => [
1066
  'name' => 'Codes specifically reserved for testing purposes',
1067
  'code' => '963',
1068
  'country' => 'ZZ06_Testing_Code',
1069
  'exponent' => 'N.A.'
1070
+ ],
1071
+ 'XUA' => [
1072
  'name' => 'ADB Unit of Account',
1073
  'code' => '965',
1074
  'country' => 'MEMBER COUNTRIES OF THE AFRICAN DEVELOPMENT BANK GROUP',
1075
  'exponent' => 'N.A.'
1076
+ ],
1077
+ 'XXX' => [
1078
  'name' => 'The codes assigned for transactions where no currency is involved',
1079
  'code' => '999',
1080
  'country' => 'ZZ07_No_Currency',
1081
  'exponent' => 'N.A.'
1082
+ ],
1083
+ 'YER' => [
1084
  'name' => 'Yemeni Rial',
1085
  'code' => '886',
1086
  'country' => 'YEMEN',
1087
  'exponent' => '2'
1088
+ ],
1089
+ 'ZAR' => [
1090
  'name' => 'Rand',
1091
  'code' => '710',
1092
  'country' => 'SOUTH AFRICA',
1093
  'exponent' => '2'
1094
+ ],
1095
+ 'ZMW' => [
1096
  'name' => 'Zambian Kwacha',
1097
  'code' => '967',
1098
  'country' => 'ZAMBIA',
1099
  'exponent' => '2'
1100
+ ],
1101
+ 'ZWL' => [
1102
  'name' => 'Zimbabwe Dollar',
1103
  'code' => '932',
1104
  'country' => 'ZIMBABWE',
1105
  'exponent' => '2'
1106
+ ]
1107
+ ];
1108
 
1109
  /**
1110
  * Convert amount to ISO-4217 minor currency unit
1153
 
1154
  return strval($amount);
1155
  }
1156
+
1157
+ /**
1158
+ * Retrieves a list with all supported currencies
1159
+ *
1160
+ * @return array
1161
+ */
1162
+ public static function getList()
1163
+ {
1164
+ return \Genesis\Utils\Common::getArrayKeys(self::$iso4217);
1165
+ }
1166
  }
lib/Genesis/src/Genesis/Utils/Requirements.php CHANGED
@@ -29,6 +29,13 @@ namespace Genesis\Utils;
29
  */
30
  final class Requirements
31
  {
 
 
 
 
 
 
 
32
  /**
33
  * Check if the current system fulfils the project's dependencies
34
  *
@@ -70,7 +77,7 @@ final class Requirements
70
  */
71
  public static function checkSystemVersion()
72
  {
73
- if (\Genesis\Utils\Common::compareVersions('5.3.2', '<')) {
74
  throw new \Exception(self::getErrorMessage('system'));
75
  }
76
  }
@@ -126,9 +133,9 @@ final class Requirements
126
  */
127
  public static function getErrorMessage($name)
128
  {
129
- $messages = array(
130
  'system' => 'Unsupported PHP version, please upgrade!' . PHP_EOL .
131
- 'This library requires PHP version 5.3.2 or newer.',
132
  'bcmath' => 'BCMath extension is required!' . PHP_EOL .
133
  'Please install the extension or rebuild with "--enable-bcmath" option.',
134
  'filter' => 'Filter extensions is required!' . PHP_EOL .
@@ -141,12 +148,12 @@ final class Requirements
141
  'Please install the extension or rebuild with "--enable-xmlwriter" option.',
142
  'curl' => 'cURL interface is selected, but its not installed on your system!' . PHP_EOL .
143
  'Please install the extension or select "stream" as your network interface.'
144
- );
145
 
146
  if (array_key_exists($name, $messages)) {
147
  return $messages[$name];
148
- } else {
149
- return '[' . $name . '] Missing project dependency!';
150
  }
 
 
151
  }
152
  }
29
  */
30
  final class Requirements
31
  {
32
+ /**
33
+ * The earliest supported PHP Version
34
+ *
35
+ * @var string
36
+ */
37
+ protected static $minPHPVersion = '5.5.9';
38
+
39
  /**
40
  * Check if the current system fulfils the project's dependencies
41
  *
77
  */
78
  public static function checkSystemVersion()
79
  {
80
+ if (\Genesis\Utils\Common::compareVersions(self::$minPHPVersion, '<')) {
81
  throw new \Exception(self::getErrorMessage('system'));
82
  }
83
  }
133
  */
134
  public static function getErrorMessage($name)
135
  {
136
+ $messages = [
137
  'system' => 'Unsupported PHP version, please upgrade!' . PHP_EOL .
138
+ 'This library requires PHP version ' . self::$minPHPVersion . ' or newer.',
139
  'bcmath' => 'BCMath extension is required!' . PHP_EOL .
140
  'Please install the extension or rebuild with "--enable-bcmath" option.',
141
  'filter' => 'Filter extensions is required!' . PHP_EOL .
148
  'Please install the extension or rebuild with "--enable-xmlwriter" option.',
149
  'curl' => 'cURL interface is selected, but its not installed on your system!' . PHP_EOL .
150
  'Please install the extension or select "stream" as your network interface.'
151
+ ];
152
 
153
  if (array_key_exists($name, $messages)) {
154
  return $messages[$name];
 
 
155
  }
156
+
157
+ return '[' . $name . '] Missing project dependency!';
158
  }
159
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EMerchantPay_Genesis_Client</name>
4
- <version>1.3.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
@@ -10,12 +10,32 @@
10
  <description>This is a Payment Module for Magento Community Edition, that gives you the ability to process payments through eMerchantPay's Payment Gateway - Genesis.&#xD;
11
  &#xD;
12
  The Payment Gateway supports all of the major credit/debit card brands and more than 40 alternative payment methods (APMs) and e-wallets. When using the module, the merchant benefits from eMerchantPay&#x2019;s vast payment industry experience and a full suite of value-added services such as sophisticated risk management and monitoring tools, with the added benefit of removing the burden of PCI DSS compliance from the merchant.</description>
13
- <notes>1.) Fix for Order Confirmation Emails - were not queued for asynchronous transactions&#xD;
14
- 2.) Better Error Handlers for asynchronous transactions - reconciliation used for failed transactions</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  <authors><author><name>eMerchantPay Ltd.</name><user>chrisrive</user><email>chris@emerchantpay.com</email></author></authors>
16
- <date>2017-05-09</date>
17
- <time>15:17:30</time>
18
- <contents><target name="magecommunity"><dir name="EMerchantPay"><dir name="Genesis"><dir name="Block"><dir name="Form"><file name="Checkout.php" hash="abe450bd6746651abf03c32b8db17543"/><file name="Direct.php" hash="93fc65487691d59876b0c1cf08fa87c9"/></dir><dir name="Info"><file name="Checkout.php" hash="3233f4ade14cee154c064f2deea1bd8f"/><file name="Direct.php" hash="76a10eddefc97b01fafb6fff0f36f837"/></dir><dir name="Redirect"><file name="Checkout.php" hash="b00b4e6cc7d3f93fbd2ac67f5d2e960f"/><file name="Direct.php" hash="2f6d4ffa32f737df09c3b6aa659add4e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="6dbc9f16bcb42e3d638f5ded5b5f703d"/></dir><dir name="Model"><dir name="Admin"><dir name="Checkout"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="41338f33c9f649701e5fd8a47363ffea"/></dir><file name="Type.php" hash="bbe07732d7febf995c470ab36eec2234"/></dir></dir></dir><dir name="Direct"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="c5bcbb4e6c62daac0ecdfe8ef0315023"/></dir><file name="Type.php" hash="a8ee95bff6d13736e1639fe4a52fb862"/></dir></dir></dir><file name="Environment.php" hash="168ae448e5478560e079be92b3810507"/></dir><file name="Checkout.php" hash="dee656441f987934644818fec1eae939"/><file name="Direct.php" hash="0620a7a6a71f9b8047a07e9aad8b5f74"/><dir name="Task"><file name="Recurring.php" hash="09af9e1894b8d078df64b8dc4d70124d"/></dir></dir><dir name="Observer"><file name="CheckoutSubmitAllAfter.php" hash="3dd69fb21f72e6283d1ca1c89bc1c1d8"/><file name="SalesQuoteAddressCollectTotalsBefore.php" hash="e26c5af345b7a475f9f719979597111b"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="acbb813e3bc0171eba836a02e89232d6"/><file name="DirectController.php" hash="16c090d446438f9f37a2625bfaaeb6ce"/></dir><dir name="etc"><file name="config.xml" hash="84454fe453cc3baf18117763636da8e9"/><file name="system.xml" hash="63a9042dcf422feaeb4eb116b90313e2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="info"><file name="checkout.phtml" hash="121f777049b801219f2792ca9aaedd3e"/><file name="direct.phtml" hash="121f777049b801219f2792ca9aaedd3e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="form"><file name="checkout.phtml" hash="835a61d301f75e3d39a84ed412941ae0"/><file name="direct.phtml" hash="adbe6e9f00f15ea5db9de983cd6a7880"/></dir><dir name="info"><file name="checkout.phtml" hash="939277e4db9bda19b6932775a03fbaac"/><file name="direct.phtml" hash="939277e4db9bda19b6932775a03fbaac"/></dir><dir name="redirect"><file name="checkout.phtml" hash="caee38fbfc90ebc340730b83066486d3"/><file name="direct.phtml" hash="caee38fbfc90ebc340730b83066486d3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EMerchantPay_Genesis.xml" hash="83879cf40aba5587eecc86c162398e43"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir><dir name="en_US"><file name="EMerchantPay_Genesis.csv" hash="4bfb9000f103576377a939c945860e1c"/></dir></target><target name="magelib"><dir name="Genesis"><dir name="src"><dir name="Genesis"><dir name="API"><dir name="Constants"><file name="Banks.php" hash="b7b1fc98be9aa2c0e2bd7c03086ca397"/><file name="Endpoints.php" hash="2036dc4c26f6e7418d5ce198170f96a1"/><file name="Environments.php" hash="4054e40a140cd9b4010a49e7928457f4"/><file name="Errors.php" hash="434b001eb137e74e654020d63b7c4f72"/><dir name="Payment"><file name="Methods.php" hash="de89e5298e49aea3f5eb8c9f89317576"/></dir><dir name="Transaction"><dir name="Parameters"><dir name="PayByVouchers"><file name="CardTypes.php" hash="d9e632a4b269948079af8f96bf3c56f1"/><file name="RedeemTypes.php" hash="ed1c30bc2b9cc435e7b66afad9ab3832"/></dir></dir><file name="States.php" hash="52a8c37ba2ab1597b928b5a4de89cdf3"/><file name="Types.php" hash="40db1b4803eb29d2987d1e7cef04230a"/></dir><file name="i18n.php" hash="577058e53e7c935e3e883fd4792ee548"/></dir><file name="Notification.php" hash="1642e5c9b7ff9a249e2d26d1db64861a"/><dir name="Request"><dir name="Financial"><dir name="Alternatives"><file name="ABNiDEAL.php" hash="9ad0d2f75fcdf5b2cb94c78b3b3d6ea3"/><file name="CashU.php" hash="f28471dfff04de6e8e0c7b47aa1c08da"/><file name="POLi.php" hash="31ef3c44fa6c367f207c0633950ec8f1"/><file name="PPRO.php" hash="48ba59d3f53d5b15720b0b4f4e5fbc26"/><file name="Paysafecard.php" hash="83a298fd99434d6c207f1e1f23905061"/><file name="Sofort.php" hash="6cf9bcb7a47eb0ea7c1fa1e97ca5887c"/></dir><file name="Capture.php" hash="4074b82a2cd3ace1e655316c4dcc8064"/><dir name="Cards"><file name="Authorize.php" hash="f8cd42657ba5655af03de32c829f65ea"/><file name="Authorize3D.php" hash="57a35302fa7e08d72ec577169b64fd3c"/><file name="Credit.php" hash="a24fb37241999072f55319baf5056415"/><file name="Payout.php" hash="dae3a6cb34dc29dc583a8958a82e3628"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="5903a5d82a5eceee4ac266099b708894"/><file name="InitRecurringSale3D.php" hash="ec06f91acaf4ad5d79682ec61058eac2"/><file name="RecurringSale.php" hash="324d2bf186578303a0ad084a78013051"/></dir><file name="Sale.php" hash="84b08a879c9f10b2c766a34de9878207"/><file name="Sale3D.php" hash="f6517e874dc37d123808bfa0ee5a5a1d"/></dir><dir name="PayByVouchers"><file name="Sale.php" hash="367c3036c60014aa0804ce22323001da"/><file name="oBeP.php" hash="af5b1586d15aed1b85defee8e6907d12"/></dir><file name="Refund.php" hash="399b75255fa787009e978053314a6925"/><file name="Void.php" hash="5d8d5744bb55bc4821a06f5b36ab29db"/><dir name="Wallets"><file name="Neteller.php" hash="404e7eb71cb655f9abbc0febb6783a1a"/><file name="WebMoney.php" hash="1a326d4502743c7c63c132e1911e9f78"/><file name="eZeeWallet.php" hash="6cb8d492a5ada59163f4cebad6b0d7dc"/></dir></dir><dir name="NonFinancial"><file name="AVS.php" hash="28c1506a04b88a6e0e3d19a27d00a335"/><file name="AccountVerification.php" hash="bc1e2775bef0a1f23345dac5b24b72f8"/><file name="Blacklist.php" hash="5da01bedc92c6979953d29901c3f113c"/><dir name="Fraud"><dir name="Chargeback"><file name="DateRange.php" hash="fb33c10f6375d145b5e159b883d37f3c"/><file name="Transaction.php" hash="eb8997ced7f9cc45b4df3056415dce3e"/></dir><dir name="Reports"><file name="DateRange.php" hash="53419659a6c5aff80edf0c7a31a31d31"/><file name="Transaction.php" hash="a8dd1ab07cca3537687c126572a39d25"/></dir><dir name="Retrieval"><file name="DateRange.php" hash="899f1bc77c47c6fde65451f2d2257a55"/><file name="Transaction.php" hash="73b7e9bfda8e385ea7dde1dab66bcb63"/></dir></dir><dir name="Reconcile"><file name="DateRange.php" hash="83d388eae9785c04ab2b961496faf490"/><file name="Transaction.php" hash="ed77990ff74e33faf4d26ba5e1cf7431"/></dir><dir name="Retrieve"><file name="AbniDealBanks.php" hash="0c0b187f29a20cf84550dc535e365a6b"/></dir></dir><dir name="WPF"><file name="Create.php" hash="169fdc03b480e6dd45ec54496c590b21"/><file name="Reconcile.php" hash="45aa4cd09b512b04a6b5a19c259d45ab"/></dir></dir><file name="Request.php" hash="590d63882937f1c558f1e31fe6add200"/><file name="Response.php" hash="59db1b505572d73f7ba5eb373eb18fde"/></dir><file name="Builder.php" hash="a1d259798cb8a118d59b2f3c5a313e3e"/><dir name="Builders"><file name="JSON.php" hash="387f44beabc6271d60cfdfa4de42b2b0"/><file name="XML.php" hash="c5dc6d4dcef1036c154e2833d21819c4"/></dir><dir name="Certificates"><file name="ca-bundle.pem" hash="1d4f036201f82a743da147db09a6d8ca"/></dir><file name="Config.php" hash="47d41b358bc7acaeed7492896e057536"/><dir name="Exceptions"><file name="EnvironmentNotSet.php" hash="a6f425cd8922b3615fa79cc9885328e9"/><file name="ErrorAPI.php" hash="f437c2e2423397ceaee0491e5e43d136"/><file name="ErrorNetwork.php" hash="ef4686482899ebfa53a79dd470fb751c"/><file name="ErrorParameter.php" hash="c9518f203b97e168c7db12e091635946"/><file name="InvalidArgument.php" hash="6c0f4c620ec5fda8cb46e3ff9c61d07d"/><file name="InvalidMethod.php" hash="f90abed4eb6a22d6c77da9a2c60ad5c9"/><file name="InvalidResponse.php" hash="0bab84b8816d83418062dc960648ca30"/></dir><file name="Genesis.php" hash="c14b9c20cbc534f09e891332a2794ded"/><dir name="Interfaces"><file name="Builder.php" hash="ce3aaa42bf5be788488142c420e2160f"/><file name="Network.php" hash="97f13f574a31683fd25c69b930a4b39d"/><file name="Parser.php" hash="391f365d54bfd245e901f56071238c0f"/></dir><dir name="Network"><file name="Stream.php" hash="36b286e49b6b998a883511f9902f8a5a"/><file name="cURL.php" hash="e3534bf2e3254343b0cd344d9eca6b77"/></dir><file name="Network.php" hash="9a7152dd32fee74a103e08eef03c7bbf"/><file name="Parser.php" hash="b32834c751a57c9cc2e971792d125aa0"/><dir name="Parsers"><file name="XML.php" hash="7c8c64ea006668a25b0aa0cb882425d7"/></dir><dir name="Utils"><file name="Common.php" hash="f669b461894af8650fe9af3d4b7b2f81"/><file name="Country.php" hash="53890c12438b00a5908d3a4f7f92c785"/><file name="Currency.php" hash="29fc4143a6ed046917fef3fd3286b811"/><file name="Requirements.php" hash="f2b8ab0a131e878ff35d30d7512dd133"/></dir></dir></dir><dir name="vendor"><file name="autoload.php" hash="59c384c9fd04a63a1609c0c507cdc384"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="LICENSE" hash="caa653f07bb161e830d67b0ab35dd642"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="af4fa780231e7182bbd1430a1973a21d"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="a80c290f6d5d3cc4b7d03108d55b36eb"/><file name="installed.json" hash="30a799458964967a17ca693a6b2d1c65"/></dir></dir></dir></target></contents>
19
  <compatible/>
20
- <dependencies><required><php><min>5.3.2</min><max>7.1.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max>1.9.9.9</max></package><extension><name>bcmath</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>filter</name><min/><max/></extension><extension><name>hash</name><min/><max/></extension><extension><name>xmlreader</name><min/><max/></extension><extension><name>xmlwriter</name><min/><max/></extension></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EMerchantPay_Genesis_Client</name>
4
+ <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
10
  <description>This is a Payment Module for Magento Community Edition, that gives you the ability to process payments through eMerchantPay's Payment Gateway - Genesis.&#xD;
11
  &#xD;
12
  The Payment Gateway supports all of the major credit/debit card brands and more than 40 alternative payment methods (APMs) and e-wallets. When using the module, the merchant benefits from eMerchantPay&#x2019;s vast payment industry experience and a full suite of value-added services such as sophisticated risk management and monitoring tools, with the added benefit of removing the burden of PCI DSS compliance from the merchant.</description>
13
+ <notes>1) Added Support for PHP 7.1 and removed Support for PHP &lt; 5.5.9&#xD;
14
+ &#xD;
15
+ 2) Update Genesis Client Library to 1.7.0&#xD;
16
+ &#xD;
17
+ 3) Added new Transaction Types&#xD;
18
+ - Citadel&#xD;
19
+ - eZeeWallet&#xD;
20
+ - iDebit&#xD;
21
+ - INPay&#xD;
22
+ - InstaDebit&#xD;
23
+ - P24&#xD;
24
+ - PayPal Express&#xD;
25
+ - Sepa Direct Debit&#xD;
26
+ - Trustly&#xD;
27
+ &#xD;
28
+ 4) Added new Payment Methods to PPRO&#xD;
29
+ - Mr.Cash&#xD;
30
+ - MyBank&#xD;
31
+ &#xD;
32
+ 5) Added missing "usage" parameter to backend transactions.&#xD;
33
+ &#xD;
34
+ 6) Extended backend transactions validations.</notes>
35
  <authors><author><name>eMerchantPay Ltd.</name><user>chrisrive</user><email>chris@emerchantpay.com</email></author></authors>
36
+ <date>2017-06-20</date>
37
+ <time>11:03:23</time>
38
+ <contents><target name="magecommunity"><dir name="EMerchantPay"><dir name="Genesis"><dir name="Block"><dir name="Form"><file name="Checkout.php" hash="abe450bd6746651abf03c32b8db17543"/><file name="Direct.php" hash="93fc65487691d59876b0c1cf08fa87c9"/></dir><dir name="Info"><file name="Checkout.php" hash="3233f4ade14cee154c064f2deea1bd8f"/><file name="Direct.php" hash="76a10eddefc97b01fafb6fff0f36f837"/></dir><dir name="Redirect"><file name="Checkout.php" hash="b00b4e6cc7d3f93fbd2ac67f5d2e960f"/><file name="Direct.php" hash="2f6d4ffa32f737df09c3b6aa659add4e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f08f20b616b01d800b159cd63e191862"/></dir><dir name="Model"><dir name="Admin"><dir name="Checkout"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="41338f33c9f649701e5fd8a47363ffea"/></dir><file name="Type.php" hash="c8efdd30ea2f23066aee2aa426853f50"/></dir></dir></dir><dir name="Direct"><dir name="Options"><dir name="Transaction"><dir name="Recurring"><file name="Type.php" hash="c5bcbb4e6c62daac0ecdfe8ef0315023"/></dir><file name="Type.php" hash="a8ee95bff6d13736e1639fe4a52fb862"/></dir></dir></dir><file name="Environment.php" hash="168ae448e5478560e079be92b3810507"/></dir><file name="Checkout.php" hash="f4f8679ee6c63cb31d8ff828e28850e0"/><file name="Direct.php" hash="7f5fdd17755fab08a17979aa9dd6ee94"/><dir name="Task"><file name="Recurring.php" hash="09af9e1894b8d078df64b8dc4d70124d"/></dir></dir><dir name="Observer"><file name="CheckoutSubmitAllAfter.php" hash="3dd69fb21f72e6283d1ca1c89bc1c1d8"/><file name="SalesQuoteAddressCollectTotalsBefore.php" hash="e26c5af345b7a475f9f719979597111b"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="acbb813e3bc0171eba836a02e89232d6"/><file name="DirectController.php" hash="16c090d446438f9f37a2625bfaaeb6ce"/></dir><dir name="etc"><file name="config.xml" hash="84454fe453cc3baf18117763636da8e9"/><file name="system.xml" hash="63a9042dcf422feaeb4eb116b90313e2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="info"><file name="checkout.phtml" hash="121f777049b801219f2792ca9aaedd3e"/><file name="direct.phtml" hash="121f777049b801219f2792ca9aaedd3e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="emerchantpay"><dir name="form"><file name="checkout.phtml" hash="835a61d301f75e3d39a84ed412941ae0"/><file name="direct.phtml" hash="adbe6e9f00f15ea5db9de983cd6a7880"/></dir><dir name="info"><file name="checkout.phtml" hash="939277e4db9bda19b6932775a03fbaac"/><file name="direct.phtml" hash="939277e4db9bda19b6932775a03fbaac"/></dir><dir name="redirect"><file name="checkout.phtml" hash="caee38fbfc90ebc340730b83066486d3"/><file name="direct.phtml" hash="caee38fbfc90ebc340730b83066486d3"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EMerchantPay_Genesis.xml" hash="83879cf40aba5587eecc86c162398e43"/></dir></target><target name="magelocale"><dir name="en_GB"><file name="EMerchantPay_Genesis.csv" hash="aa4f2d9c4751ab35278f42cbee4d3498"/></dir><dir name="en_US"><file name="EMerchantPay_Genesis.csv" hash="aa4f2d9c4751ab35278f42cbee4d3498"/></dir></target><target name="magelib"><dir name="Genesis"><dir name="src"><dir name="Genesis"><dir name="API"><dir name="Constants"><file name="Banks.php" hash="b7b1fc98be9aa2c0e2bd7c03086ca397"/><file name="Endpoints.php" hash="2036dc4c26f6e7418d5ce198170f96a1"/><file name="Environments.php" hash="4054e40a140cd9b4010a49e7928457f4"/><file name="Errors.php" hash="c93c843cb07d6ec7f6f8bee6f31b01f4"/><dir name="Payment"><file name="Methods.php" hash="91774638e9514c47c0bca068da5f9286"/></dir><dir name="Transaction"><dir name="Parameters"><dir name="PayByVouchers"><file name="CardTypes.php" hash="2b315a773249a226f756a880ced1f091"/><file name="RedeemTypes.php" hash="fb36c9e53c814220a1334f0775728fd7"/></dir></dir><file name="States.php" hash="d88acfd5cfe78324f632b7ca416a9903"/><file name="Types.php" hash="326d955e507be4e61cc1816f773964ae"/></dir><file name="i18n.php" hash="577058e53e7c935e3e883fd4792ee548"/></dir><file name="Notification.php" hash="838a4647821426c8b970c9f2eb3618a2"/><dir name="Request"><dir name="Base"><dir name="Financial"><file name="Alternative.php" hash="20f9ae42dc399e85a921cfb412767a49"/><file name="Reference.php" hash="dfa708444d5f9c560f4120cb8728f235"/></dir><file name="Financial.php" hash="9baa837c377e9ff0da9d97e1045555f5"/></dir><dir name="Financial"><dir name="Alternatives"><file name="ABNiDEAL.php" hash="0e2500a870b4f99fb7fb83137db882f5"/><file name="CashU.php" hash="bde7f4a0017fe91d55e351a98111a597"/><file name="INPay.php" hash="3a1cd871b67078818536e82b66fa08b5"/><file name="P24.php" hash="f75459dcdc56df13d0e5578133d3d577"/><file name="POLi.php" hash="26cb8e1ea7268957578d1099a2be0688"/><file name="PPRO.php" hash="24e4c55215ed02a4360b7c21e16a988c"/><file name="PaypalExpress.php" hash="1b782b6c9c46d78faae99c41287070de"/><file name="Paysafecard.php" hash="6208597fd83356c9016f83fb53b8b32a"/><file name="Sofort.php" hash="ff1636861635435c14f770f7ede063c6"/><dir name="Trustly"><file name="Sale.php" hash="4bc5759cb4f24a8df1a7ea98ce14d040"/><file name="Withdrawal.php" hash="7f98f0c2ac79cde913e7c7da09ce2a18"/></dir></dir><file name="Cancel.php" hash="b650abb6567246f1a3a6aeed55261cda"/><file name="Capture.php" hash="5063882ccf5d033941a7f5627d013bbc"/><dir name="Cards"><file name="Authorize.php" hash="048906d3fd4661306824861d0f8ba989"/><file name="Authorize3D.php" hash="eac08115e5719f05537274e59df47ca0"/><file name="Credit.php" hash="87b975fa0df37672a890ad6ed83b01e0"/><file name="Payout.php" hash="6f97580ebabc13ff2b03e6f518ef00b4"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="1f1f0a1564b1316bf1b100c3454e4d16"/><file name="InitRecurringSale3D.php" hash="a2d19a484636d394b96ac8f8730e325c"/><file name="RecurringSale.php" hash="d1009a9ba0577788d4b1d8a8e756623c"/></dir><file name="Sale.php" hash="674027e2391893b4d18be7f4c26de56e"/><file name="Sale3D.php" hash="dc80ca30f5e649d90bb5f4cef3bb648a"/></dir><dir name="OnlineBankingPayments"><dir name="Citadel"><file name="Payin.php" hash="e16ffff4ae23bf994fd0095a97870514"/><file name="Payout.php" hash="d5ac32e37a8293f53037c8833b5ba038"/></dir><dir name="InstaDebit"><file name="Payin.php" hash="e260ecb59aad879fd8b2272645ee054a"/><file name="Payout.php" hash="13786d9c3231d9dd2e13b1a38e6922cf"/></dir><dir name="iDebit"><file name="Payin.php" hash="24da226e52bf6bdd302301adc94427c8"/><file name="Payout.php" hash="1e30a37cefe989ef3b44ee897083e918"/></dir></dir><dir name="PayByVouchers"><file name="Sale.php" hash="d994d93e9258ec62f95c8e0ed5f75683"/><file name="oBeP.php" hash="2fce81fd9fd8ce6f11bd765c9ad2264d"/></dir><file name="Refund.php" hash="84cf6b54a079a9273ca3764bf9baf5de"/><dir name="SDD"><file name="Payout.php" hash="2dd7a96712054517857e34bf66b91855"/><dir name="Recurring"><file name="InitRecurringSale.php" hash="b2a1cd03c400229cd3c065f98743ed53"/><file name="RecurringSale.php" hash="682bc50534bb35ff0ca9c06e94478d71"/></dir><file name="Refund.php" hash="5959d41481b87fea1e3e51baa8ab4d25"/><file name="Sale.php" hash="94b4a1e82eb6cb9a7e412697f934aea1"/></dir><dir name="Wallets"><file name="Neteller.php" hash="d3446451b0b1c9e20425094965761276"/><file name="WebMoney.php" hash="779bdcd53112b51f29fea40f0162afcd"/><file name="eZeeWallet.php" hash="fada13819fadf113bd5c9040ccb00b1c"/></dir></dir><dir name="NonFinancial"><file name="AVS.php" hash="733abf685f43b346c25643e9d899d4f3"/><file name="AccountVerification.php" hash="46bad246cb859f37a011a2ef6c84b9ba"/><file name="Blacklist.php" hash="42a82c3e0a69241fc4a097c8729f5ffe"/><dir name="Fraud"><dir name="Chargeback"><file name="DateRange.php" hash="e764b38207499a79e1a7e2d0c501ecd0"/><file name="Transaction.php" hash="cd14a442abb7c442f2fab713c73bde85"/></dir><dir name="Reports"><file name="DateRange.php" hash="20fdd074645ef52fc0def23293b9e8ee"/><file name="Transaction.php" hash="438e344654db135fdd8b1fb6ff1c2e60"/></dir><dir name="Retrieval"><file name="DateRange.php" hash="0aa43bdeba801899bef8805791487589"/><file name="Transaction.php" hash="85b8c5f197ffa0a0aec212a0b6f5e6d7"/></dir></dir><dir name="Reconcile"><file name="DateRange.php" hash="8ac4eaedd9ed78a74b5321cdaa0406c6"/><file name="Transaction.php" hash="3c01884d67b5c611ce53cfc15a213b93"/></dir><dir name="Retrieve"><file name="AbniDealBanks.php" hash="40bce2d5a24ee610c613818297cbf7f0"/></dir></dir><dir name="WPF"><file name="Create.php" hash="4333fa24ad28844e3aaae5db219b9a0e"/><file name="Reconcile.php" hash="04067f63ed3b0a378434ec93b7fbc242"/></dir></dir><file name="Request.php" hash="f2dbcbaa557ff0e6dcccfb548fd426c3"/><file name="Response.php" hash="79b19ec9b3215f3ffcd5854044719737"/><dir name="Traits"><dir name="Request"><file name="AddressInfoAttributes.php" hash="b58e8f4ada9e475c279c8e6b952dc759"/><file name="BaseAttributes.php" hash="42f7b435745c88c5903928387ff7c263"/><file name="CreditCardAttributes.php" hash="10d9b289b3a1ebcc9947083b60e14c00"/><dir name="CustomerAddress"><file name="BillingInfoAttributes.php" hash="64bf6ac03ed48e33b62d82f929f38e1b"/><file name="CustomerInfoAttributes.php" hash="d66534a5bf898efecdba7c92589779de"/><file name="ShippingInfoAttributes.php" hash="2df191d3b22ffe2857224b8154590d11"/></dir><dir name="Financial"><file name="AsyncAttributes.php" hash="695118d5b6badb5efe2cf5306f84d21e"/><file name="DescriptorAttributes.php" hash="02b9f121c88dea47e26d95421c8be29c"/><file name="GamingAttributes.php" hash="a7bedf95080d1931b2f730d8833bf49f"/><file name="MpiAttributes.php" hash="0e6f8de31a5ffffc713f3921969406eb"/><file name="NotificationAttributes.php" hash="6ded6d0c2b1247404ae639cc63f3d464"/><file name="PaymentAttributes.php" hash="34c2d37f9b6df3db86a493903e4cb928"/><file name="ReferenceAttributes.php" hash="c31e788a3e1ebbef893d026ffa99c489"/><file name="SddBankAttributes.php" hash="9f8424a8cdc7f942a0b2d9b1d0b45a3c"/><file name="VoucherAttributes.php" hash="fd94cf2d4b90e6fc83b1047c8615e87f"/></dir><file name="MotoAttributes.php" hash="0924b1abaa62637b0ab66ae2fe9006dd"/><file name="RiskAttributes.php" hash="4389f1394e575bcd822e166c0299af7d"/></dir></dir><dir name="Validators"><dir name="Request"><dir name="Base"><file name="Validator.php" hash="085348eadd1f161cff4a8b11d661e469"/></dir><file name="RegexValidator.php" hash="39d419e5b987a58e33a7e610f8e74f20"/></dir></dir></dir><file name="Builder.php" hash="9ba410d2a51c17a84b3c44917ba8a810"/><dir name="Builders"><file name="JSON.php" hash="387f44beabc6271d60cfdfa4de42b2b0"/><file name="XML.php" hash="7f7ed19f843f4a75974d3c2f841e3c68"/></dir><dir name="Certificates"><file name="ca-bundle.pem" hash="1d4f036201f82a743da147db09a6d8ca"/></dir><file name="Config.php" hash="03b2f52044b91340e38d35d656022da0"/><dir name="Exceptions"><file name="EnvironmentNotSet.php" hash="a6f425cd8922b3615fa79cc9885328e9"/><file name="ErrorAPI.php" hash="f437c2e2423397ceaee0491e5e43d136"/><file name="ErrorNetwork.php" hash="ef4686482899ebfa53a79dd470fb751c"/><file name="ErrorParameter.php" hash="c9518f203b97e168c7db12e091635946"/><file name="InvalidArgument.php" hash="6c0f4c620ec5fda8cb46e3ff9c61d07d"/><file name="InvalidMethod.php" hash="f90abed4eb6a22d6c77da9a2c60ad5c9"/><file name="InvalidResponse.php" hash="0bab84b8816d83418062dc960648ca30"/></dir><file name="Genesis.php" hash="4c8485b5c00009c2283c6284b61334f0"/><dir name="Interfaces"><file name="Builder.php" hash="ce3aaa42bf5be788488142c420e2160f"/><file name="Network.php" hash="97f13f574a31683fd25c69b930a4b39d"/><file name="Parser.php" hash="391f365d54bfd245e901f56071238c0f"/></dir><dir name="Network"><file name="Stream.php" hash="ce01419864d09db699498f42e47cff38"/><file name="cURL.php" hash="510da7f4126316918be87ec49d927d83"/></dir><file name="Network.php" hash="4a8f6fbb44be0627014233a96c1b17ff"/><file name="Parser.php" hash="b32834c751a57c9cc2e971792d125aa0"/><dir name="Parsers"><file name="XML.php" hash="b2af9f76223a2f71038753b47d33e734"/></dir><dir name="Utils"><file name="Common.php" hash="af50a7f99d7f2e7aeec589eae67d858c"/><file name="Country.php" hash="4b4a684b3ff223ff41abe97e5da7b8d5"/><file name="Currency.php" hash="0b24c86f9bcf5e4a648ac2c4bee4cbac"/><file name="Requirements.php" hash="420572f06c2cec0530e616aee7aee079"/></dir></dir></dir><dir name="vendor"><file name="autoload.php" hash="59c384c9fd04a63a1609c0c507cdc384"/><dir name="composer"><file name="ClassLoader.php" hash="479613a7d15cfdf2bcdf0399a032ff9a"/><file name="LICENSE" hash="caa653f07bb161e830d67b0ab35dd642"/><file name="autoload_classmap.php" hash="8645d3a4e3ad87e7cf4d88a46717aab4"/><file name="autoload_namespaces.php" hash="af4fa780231e7182bbd1430a1973a21d"/><file name="autoload_psr4.php" hash="dd3a00f0d13eb29781edd8c77d4c5100"/><file name="autoload_real.php" hash="a80c290f6d5d3cc4b7d03108d55b36eb"/><file name="installed.json" hash="30a799458964967a17ca693a6b2d1c65"/></dir></dir></dir></target></contents>
39
  <compatible/>
40
+ <dependencies><required><php><min>5.5.9</min><max>7.1.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7</min><max>1.9.9.9</max></package><extension><name>bcmath</name><min/><max/></extension><extension><name>curl</name><min/><max/></extension><extension><name>filter</name><min/><max/></extension><extension><name>hash</name><min/><max/></extension><extension><name>xmlreader</name><min/><max/></extension><extension><name>xmlwriter</name><min/><max/></extension></required></dependencies>
41
  </package>