Jmango360_Japi - Version 3.5.0

Version Notes

* Bug fixes

Download this release

Release Info

Developer Duc Ngo
Extension Jmango360_Japi
Version 3.5.0
Comparing to
See all releases


Code changes from version 3.4.1 to 3.5.0

Files changed (199) hide show
  1. app/code/community/Jmango360/Japi/Block/Adminhtml/System/Config/Form/Button/Paypal.php +36 -0
  2. app/code/community/Jmango360/Japi/Block/Adminhtml/System/Config/Form/Log.php +6 -4
  3. app/code/community/Jmango360/Japi/Block/Checkout/Onepage.php +6 -0
  4. app/code/community/Jmango360/Japi/Block/Customer/Widget/Name.php +30 -0
  5. app/code/community/Jmango360/Japi/Block/Payment/Form.php +9 -0
  6. app/code/community/Jmango360/Japi/Block/Payment/Info.php +39 -0
  7. app/code/community/Jmango360/Japi/Block/Socolissimosimplicite/Iframe.php +35 -0
  8. app/code/community/Jmango360/Japi/Helper/Product.php +152 -0
  9. app/code/community/Jmango360/Japi/Helper/Review/Bazaarvoice.php +178 -28
  10. app/code/community/Jmango360/Japi/Model/Observer.php +39 -0
  11. app/code/community/Jmango360/Japi/Model/Payment.php +100 -0
  12. app/code/community/Jmango360/Japi/Model/Payment/Braintree.php +74 -0
  13. app/code/community/Jmango360/Japi/Model/Payment/Paypal.php +186 -0
  14. app/code/community/Jmango360/Japi/Model/Rest/Checkout.php +14 -0
  15. app/code/community/Jmango360/Japi/Model/Rest/Checkout/Onepage.php +104 -2
  16. app/code/community/Jmango360/Japi/Model/Rest/Checkout/Submit.php +8 -5
  17. app/code/community/Jmango360/Japi/Model/Rest/Product/Search.php +7 -0
  18. app/code/community/Jmango360/Japi/controllers/Adminhtml/Japi/PaymentController.php +59 -0
  19. app/code/community/Jmango360/Japi/controllers/CheckoutController.php +43 -4
  20. app/code/community/Jmango360/Japi/controllers/Rest/CheckoutController.php +7 -0
  21. app/code/community/Jmango360/Japi/etc/config.xml +45 -1
  22. app/code/community/Jmango360/Japi/etc/system.xml +245 -2
  23. app/design/adminhtml/default/default/template/japi/system/config/form/button/paypal.phtml +46 -0
  24. app/design/frontend/base/default/layout/jmango360_japi.xml +1 -1
  25. app/design/frontend/base/default/template/japi/TIG/PostNL/av/checkout/onepage/billing.phtml +1 -0
  26. app/design/frontend/base/default/template/japi/TIG/PostNL/av/checkout/onepage/shipping.phtml +1 -0
  27. app/design/frontend/base/default/template/japi/checkout/onepage.phtml +4 -0
  28. app/design/frontend/base/default/template/japi/checkout/onepage/billing.phtml +5 -2
  29. app/design/frontend/base/default/template/japi/checkout/onepage/payment.phtml +1 -0
  30. app/design/frontend/base/default/template/japi/checkout/onepage/shipping.phtml +2 -1
  31. app/design/frontend/base/default/template/japi/checkout/onepage/shipping_method.phtml +1 -0
  32. app/design/frontend/base/default/template/japi/checkout/onepage/style.phtml +1 -1
  33. app/design/frontend/base/default/template/japi/kega_checkout/onepage/payment.phtml +1 -0
  34. app/design/frontend/base/default/template/japi/symfony/postcode/checkout/onepage/billing.phtml +1 -0
  35. app/design/frontend/base/default/template/japi/symfony/postcode/checkout/onepage/shipping.phtml +1 -0
  36. app/locale/de_DE/Jmango360_Japi.csv +1 -0
  37. app/locale/el_GR/Jmango360_Japi.csv +261 -0
  38. app/locale/en_US/Jmango360_Japi.csv +4 -4
  39. app/locale/nl_NL/Jmango360_Japi.csv +2 -0
  40. lib/Jmango360/Braintree/LICENSE +22 -0
  41. lib/Jmango360/Braintree/lib/Braintree.php +23 -0
  42. lib/Jmango360/Braintree/lib/Braintree/AccountUpdaterDailyReport.php +44 -0
  43. lib/Jmango360/Braintree/lib/Braintree/AchMandate.php +57 -0
  44. lib/Jmango360/Braintree/lib/Braintree/AddOn.php +29 -0
  45. lib/Jmango360/Braintree/lib/Braintree/AddOnGateway.php +53 -0
  46. lib/Jmango360/Braintree/lib/Braintree/Address.php +150 -0
  47. lib/Jmango360/Braintree/lib/Braintree/AddressGateway.php +314 -0
  48. lib/Jmango360/Braintree/lib/Braintree/AmexExpressCheckoutCard.php +79 -0
  49. lib/Jmango360/Braintree/lib/Braintree/AndroidPayCard.php +89 -0
  50. lib/Jmango360/Braintree/lib/Braintree/ApplePayCard.php +99 -0
  51. lib/Jmango360/Braintree/lib/Braintree/Base.php +75 -0
  52. lib/Jmango360/Braintree/lib/Braintree/ClientToken.php +49 -0
  53. lib/Jmango360/Braintree/lib/Braintree/ClientTokenGateway.php +129 -0
  54. lib/Jmango360/Braintree/lib/Braintree/CoinbaseAccount.php +110 -0
  55. lib/Jmango360/Braintree/lib/Braintree/Collection.php +161 -0
  56. lib/Jmango360/Braintree/lib/Braintree/Configuration.php +602 -0
  57. lib/Jmango360/Braintree/lib/Braintree/ConnectedMerchantPayPalStatusChanged.php +36 -0
  58. lib/Jmango360/Braintree/lib/Braintree/ConnectedMerchantStatusTransitioned.php +36 -0
  59. lib/Jmango360/Braintree/lib/Braintree/CredentialsParser.php +147 -0
  60. lib/Jmango360/Braintree/lib/Braintree/CreditCard.php +316 -0
  61. lib/Jmango360/Braintree/lib/Braintree/CreditCardGateway.php +486 -0
  62. lib/Jmango360/Braintree/lib/Braintree/CreditCardVerification.php +43 -0
  63. lib/Jmango360/Braintree/lib/Braintree/CreditCardVerificationGateway.php +74 -0
  64. lib/Jmango360/Braintree/lib/Braintree/CreditCardVerificationSearch.php +56 -0
  65. lib/Jmango360/Braintree/lib/Braintree/Customer.php +424 -0
  66. lib/Jmango360/Braintree/lib/Braintree/CustomerGateway.php +637 -0
  67. lib/Jmango360/Braintree/lib/Braintree/CustomerSearch.php +34 -0
  68. lib/Jmango360/Braintree/lib/Braintree/Descriptor.php +7 -0
  69. lib/Jmango360/Braintree/lib/Braintree/Digest.php +60 -0
  70. lib/Jmango360/Braintree/lib/Braintree/Disbursement.php +52 -0
  71. lib/Jmango360/Braintree/lib/Braintree/DisbursementDetails.php +24 -0
  72. lib/Jmango360/Braintree/lib/Braintree/Discount.php +21 -0
  73. lib/Jmango360/Braintree/lib/Braintree/DiscountGateway.php +31 -0
  74. lib/Jmango360/Braintree/lib/Braintree/Dispute.php +81 -0
  75. lib/Jmango360/Braintree/lib/Braintree/Dispute/TransactionDetails.php +25 -0
  76. lib/Jmango360/Braintree/lib/Braintree/EqualityNode.php +12 -0
  77. lib/Jmango360/Braintree/lib/Braintree/Error/Codes.php +533 -0
  78. lib/Jmango360/Braintree/lib/Braintree/Error/ErrorCollection.php +123 -0
  79. lib/Jmango360/Braintree/lib/Braintree/Error/Validation.php +60 -0
  80. lib/Jmango360/Braintree/lib/Braintree/Error/ValidationErrorCollection.php +131 -0
  81. lib/Jmango360/Braintree/lib/Braintree/EuropeBankAccount.php +67 -0
  82. lib/Jmango360/Braintree/lib/Braintree/Exception.php +13 -0
  83. lib/Jmango360/Braintree/lib/Braintree/Exception/Authentication.php +17 -0
  84. lib/Jmango360/Braintree/lib/Braintree/Exception/Authorization.php +19 -0
  85. lib/Jmango360/Braintree/lib/Braintree/Exception/Configuration.php +17 -0
  86. lib/Jmango360/Braintree/lib/Braintree/Exception/Connection.php +17 -0
  87. lib/Jmango360/Braintree/lib/Braintree/Exception/DownForMaintenance.php +16 -0
  88. lib/Jmango360/Braintree/lib/Braintree/Exception/ForgedQueryString.php +20 -0
  89. lib/Jmango360/Braintree/lib/Braintree/Exception/InvalidChallenge.php +9 -0
  90. lib/Jmango360/Braintree/lib/Braintree/Exception/InvalidSignature.php +9 -0
  91. lib/Jmango360/Braintree/lib/Braintree/Exception/NotFound.php +16 -0
  92. lib/Jmango360/Braintree/lib/Braintree/Exception/SSLCaFileNotFound.php +16 -0
  93. lib/Jmango360/Braintree/lib/Braintree/Exception/SSLCertificate.php +16 -0
  94. lib/Jmango360/Braintree/lib/Braintree/Exception/ServerError.php +16 -0
  95. lib/Jmango360/Braintree/lib/Braintree/Exception/TestOperationPerformedInProduction.php +15 -0
  96. lib/Jmango360/Braintree/lib/Braintree/Exception/Timeout.php +16 -0
  97. lib/Jmango360/Braintree/lib/Braintree/Exception/TooManyRequests.php +16 -0
  98. lib/Jmango360/Braintree/lib/Braintree/Exception/Unexpected.php +17 -0
  99. lib/Jmango360/Braintree/lib/Braintree/Exception/UpgradeRequired.php +16 -0
  100. lib/Jmango360/Braintree/lib/Braintree/Exception/ValidationsFailed.php +16 -0
  101. lib/Jmango360/Braintree/lib/Braintree/FacilitatorDetails.php +30 -0
  102. lib/Jmango360/Braintree/lib/Braintree/Gateway.php +224 -0
  103. lib/Jmango360/Braintree/lib/Braintree/Http.php +201 -0
  104. lib/Jmango360/Braintree/lib/Braintree/IbanBankAccount.php +57 -0
  105. lib/Jmango360/Braintree/lib/Braintree/IdealPayment.php +92 -0
  106. lib/Jmango360/Braintree/lib/Braintree/IdealPaymentGateway.php +104 -0
  107. lib/Jmango360/Braintree/lib/Braintree/Instance.php +74 -0
  108. lib/Jmango360/Braintree/lib/Braintree/IsNode.php +24 -0
  109. lib/Jmango360/Braintree/lib/Braintree/KeyValueNode.php +23 -0
  110. lib/Jmango360/Braintree/lib/Braintree/MasterpassCard.php +141 -0
  111. lib/Jmango360/Braintree/lib/Braintree/Merchant.php +36 -0
  112. lib/Jmango360/Braintree/lib/Braintree/MerchantAccount.php +64 -0
  113. lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/AddressDetails.php +10 -0
  114. lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/BusinessDetails.php +23 -0
  115. lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/FundingDetails.php +10 -0
  116. lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/IndividualDetails.php +23 -0
  117. lib/Jmango360/Braintree/lib/Braintree/MerchantAccountGateway.php +182 -0
  118. lib/Jmango360/Braintree/lib/Braintree/MerchantGateway.php +42 -0
  119. lib/Jmango360/Braintree/lib/Braintree/Modification.php +22 -0
  120. lib/Jmango360/Braintree/lib/Braintree/MultipleValueNode.php +41 -0
  121. lib/Jmango360/Braintree/lib/Braintree/MultipleValueOrTextNode.php +47 -0
  122. lib/Jmango360/Braintree/lib/Braintree/OAuthCredentials.php +34 -0
  123. lib/Jmango360/Braintree/lib/Braintree/OAuthGateway.php +122 -0
  124. lib/Jmango360/Braintree/lib/Braintree/OAuthResult.php +34 -0
  125. lib/Jmango360/Braintree/lib/Braintree/PaginatedCollection.php +110 -0
  126. lib/Jmango360/Braintree/lib/Braintree/PaginatedResult.php +32 -0
  127. lib/Jmango360/Braintree/lib/Braintree/PartialMatchNode.php +18 -0
  128. lib/Jmango360/Braintree/lib/Braintree/PartnerMerchant.php +41 -0
  129. lib/Jmango360/Braintree/lib/Braintree/PayPalAccount.php +109 -0
  130. lib/Jmango360/Braintree/lib/Braintree/PayPalAccountGateway.php +178 -0
  131. lib/Jmango360/Braintree/lib/Braintree/PaymentInstrumentType.php +17 -0
  132. lib/Jmango360/Braintree/lib/Braintree/PaymentMethod.php +44 -0
  133. lib/Jmango360/Braintree/lib/Braintree/PaymentMethodGateway.php +350 -0
  134. lib/Jmango360/Braintree/lib/Braintree/PaymentMethodNonce.php +52 -0
  135. lib/Jmango360/Braintree/lib/Braintree/PaymentMethodNonceGateway.php +64 -0
  136. lib/Jmango360/Braintree/lib/Braintree/Plan.php +51 -0
  137. lib/Jmango360/Braintree/lib/Braintree/PlanGateway.php +34 -0
  138. lib/Jmango360/Braintree/lib/Braintree/RangeNode.php +40 -0
  139. lib/Jmango360/Braintree/lib/Braintree/ResourceCollection.php +156 -0
  140. lib/Jmango360/Braintree/lib/Braintree/Result/CreditCardVerification.php +100 -0
  141. lib/Jmango360/Braintree/lib/Braintree/Result/Error.php +123 -0
  142. lib/Jmango360/Braintree/lib/Braintree/Result/Successful.php +92 -0
  143. lib/Jmango360/Braintree/lib/Braintree/RiskData.php +30 -0
  144. lib/Jmango360/Braintree/lib/Braintree/SettlementBatchSummary.php +45 -0
  145. lib/Jmango360/Braintree/lib/Braintree/SettlementBatchSummaryGateway.php +106 -0
  146. lib/Jmango360/Braintree/lib/Braintree/SignatureService.php +24 -0
  147. lib/Jmango360/Braintree/lib/Braintree/Subscription.php +140 -0
  148. lib/Jmango360/Braintree/lib/Braintree/Subscription/StatusDetails.php +24 -0
  149. lib/Jmango360/Braintree/lib/Braintree/SubscriptionGateway.php +214 -0
  150. lib/Jmango360/Braintree/lib/Braintree/SubscriptionSearch.php +72 -0
  151. lib/Jmango360/Braintree/lib/Braintree/Test/CreditCardNumbers.php +75 -0
  152. lib/Jmango360/Braintree/lib/Braintree/Test/MerchantAccount.php +21 -0
  153. lib/Jmango360/Braintree/lib/Braintree/Test/Nonces.php +76 -0
  154. lib/Jmango360/Braintree/lib/Braintree/Test/Transaction.php +62 -0
  155. lib/Jmango360/Braintree/lib/Braintree/Test/TransactionAmounts.php +18 -0
  156. lib/Jmango360/Braintree/lib/Braintree/Test/VenmoSdk.php +30 -0
  157. lib/Jmango360/Braintree/lib/Braintree/TestingGateway.php +52 -0
  158. lib/Jmango360/Braintree/lib/Braintree/TextNode.php +12 -0
  159. lib/Jmango360/Braintree/lib/Braintree/ThreeDSecureInfo.php +30 -0
  160. lib/Jmango360/Braintree/lib/Braintree/Transaction.php +596 -0
  161. lib/Jmango360/Braintree/lib/Braintree/Transaction/AddressDetails.php +27 -0
  162. lib/Jmango360/Braintree/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php +43 -0
  163. lib/Jmango360/Braintree/lib/Braintree/Transaction/AndroidPayCardDetails.php +47 -0
  164. lib/Jmango360/Braintree/lib/Braintree/Transaction/ApplePayCardDetails.php +39 -0
  165. lib/Jmango360/Braintree/lib/Braintree/Transaction/CoinbaseDetails.php +38 -0
  166. lib/Jmango360/Braintree/lib/Braintree/Transaction/CreditCardDetails.php +38 -0
  167. lib/Jmango360/Braintree/lib/Braintree/Transaction/CustomerDetails.php +25 -0
  168. lib/Jmango360/Braintree/lib/Braintree/Transaction/EuropeBankAccountDetails.php +24 -0
  169. lib/Jmango360/Braintree/lib/Braintree/Transaction/IdealPaymentDetails.php +23 -0
  170. lib/Jmango360/Braintree/lib/Braintree/Transaction/MasterpassCardDetails.php +51 -0
  171. lib/Jmango360/Braintree/lib/Braintree/Transaction/PayPalDetails.php +41 -0
  172. lib/Jmango360/Braintree/lib/Braintree/Transaction/StatusDetails.php +21 -0
  173. lib/Jmango360/Braintree/lib/Braintree/Transaction/SubscriptionDetails.php +19 -0
  174. lib/Jmango360/Braintree/lib/Braintree/Transaction/UsBankAccountDetails.php +40 -0
  175. lib/Jmango360/Braintree/lib/Braintree/Transaction/VenmoAccountDetails.php +38 -0
  176. lib/Jmango360/Braintree/lib/Braintree/Transaction/VisaCheckoutCardDetails.php +52 -0
  177. lib/Jmango360/Braintree/lib/Braintree/TransactionGateway.php +531 -0
  178. lib/Jmango360/Braintree/lib/Braintree/TransactionSearch.php +130 -0
  179. lib/Jmango360/Braintree/lib/Braintree/TransparentRedirect.php +100 -0
  180. lib/Jmango360/Braintree/lib/Braintree/TransparentRedirectGateway.php +289 -0
  181. lib/Jmango360/Braintree/lib/Braintree/UnknownPaymentMethod.php +69 -0
  182. lib/Jmango360/Braintree/lib/Braintree/UsBankAccount.php +95 -0
  183. lib/Jmango360/Braintree/lib/Braintree/UsBankAccountGateway.php +106 -0
  184. lib/Jmango360/Braintree/lib/Braintree/Util.php +414 -0
  185. lib/Jmango360/Braintree/lib/Braintree/VenmoAccount.php +74 -0
  186. lib/Jmango360/Braintree/lib/Braintree/Version.php +34 -0
  187. lib/Jmango360/Braintree/lib/Braintree/VisaCheckoutCard.php +154 -0
  188. lib/Jmango360/Braintree/lib/Braintree/WebhookNotification.php +98 -0
  189. lib/Jmango360/Braintree/lib/Braintree/WebhookNotificationGateway.php +69 -0
  190. lib/Jmango360/Braintree/lib/Braintree/WebhookTesting.php +417 -0
  191. lib/Jmango360/Braintree/lib/Braintree/Xml.php +39 -0
  192. lib/Jmango360/Braintree/lib/Braintree/Xml/Generator.php +149 -0
  193. lib/Jmango360/Braintree/lib/Braintree/Xml/Parser.php +140 -0
  194. lib/Jmango360/Braintree/lib/autoload.php +21 -0
  195. lib/Jmango360/Braintree/lib/ssl/api_braintreegateway_com.ca.crt +191 -0
  196. package.xml +4 -4
  197. skin/frontend/base/default/japi/css/style.css +7 -0
  198. skin/frontend/base/default/japi/css/style.less +9 -0
  199. skin/frontend/base/default/japi/js/checkout.js +51 -2
app/code/community/Jmango360/Japi/Block/Adminhtml/System/Config/Form/Button/Paypal.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2015 JMango360
5
+ */
6
+ class Jmango360_Japi_Block_Adminhtml_System_Config_Form_Button_Paypal extends Mage_Adminhtml_Block_System_Config_Form_Field
7
+ {
8
+ protected $_element;
9
+
10
+ protected function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate('japi/system/config/form/button/paypal.phtml');
14
+ }
15
+
16
+ /**
17
+ * Return element html
18
+ *
19
+ * @param Varien_Data_Form_Element_Abstract $element
20
+ * @return string
21
+ */
22
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $this->_element = $element;
25
+ return $this->_toHtml();
26
+ }
27
+
28
+ public function getButtonHtml()
29
+ {
30
+ return $this->getLayout()->createBlock('adminhtml/widget_button', '', array(
31
+ 'type' => 'button',
32
+ 'label' => $this->helper('japi')->__('Test API Credentials'),
33
+ 'onclick' => sprintf('japiPaypalTestAPICredentials()')
34
+ ))->toHtml();
35
+ }
36
+ }
app/code/community/Jmango360/Japi/Block/Adminhtml/System/Config/Form/Log.php CHANGED
@@ -44,10 +44,12 @@ class Jmango360_Japi_Block_Adminhtml_System_Config_Form_Log extends Mage_Adminht
44
  {
45
  $html = '<select id="' . $this->_element->getHtmlId() . '" onchange="japiChangeLog(this)">';
46
  $logDir = Mage::getBaseDir('var') . DS . 'log';
47
- foreach (scandir($logDir) as $fileName) {
48
- if ($fileName == '.' || $fileName == '..' || is_dir($logDir . DS . $fileName)) continue;
49
- $fileSize = $this->_getLogSize($logDir . DS . $fileName);
50
- $html .= '<option value="' . $fileName . '">' . sprintf('%s (%s)', $fileName, $fileSize) . '</option>';
 
 
51
  }
52
  $html .= '</select>';
53
  return $html;
44
  {
45
  $html = '<select id="' . $this->_element->getHtmlId() . '" onchange="japiChangeLog(this)">';
46
  $logDir = Mage::getBaseDir('var') . DS . 'log';
47
+ if (is_dir($logDir)) {
48
+ foreach (scandir($logDir) as $fileName) {
49
+ if ($fileName == '.' || $fileName == '..') continue;
50
+ $fileSize = $this->_getLogSize($logDir . DS . $fileName);
51
+ $html .= '<option value="' . $fileName . '">' . sprintf('%s (%s)', $fileName, $fileSize) . '</option>';
52
+ }
53
  }
54
  $html .= '</select>';
55
  return $html;
app/code/community/Jmango360/Japi/Block/Checkout/Onepage.php CHANGED
@@ -7,6 +7,12 @@ if (@class_exists('Kega_Checkout_Block_Onepage')) {
7
  class Jmango360_Japi_Block_Checkout_Onepage extends Kega_Checkout_Block_Onepage
8
  {
9
  }
 
 
 
 
 
 
10
  } else {
11
  class Jmango360_Japi_Block_Checkout_Onepage extends Mage_Checkout_Block_Onepage
12
  {
7
  class Jmango360_Japi_Block_Checkout_Onepage extends Kega_Checkout_Block_Onepage
8
  {
9
  }
10
+ } elseif (Mage::helper('core')->isModuleEnabled('LaPoste_SoColissimoSimplicite')
11
+ && @class_exists('LaPoste_SoColissimoSimplicite_Block_Onepage')
12
+ ) {
13
+ class Jmango360_Japi_Block_Checkout_Onepage extends LaPoste_SoColissimoSimplicite_Block_Onepage
14
+ {
15
+ }
16
  } else {
17
  class Jmango360_Japi_Block_Checkout_Onepage extends Mage_Checkout_Block_Onepage
18
  {
app/code/community/Jmango360/Japi/Block/Customer/Widget/Name.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Block_Customer_Widget_Name extends Mage_Customer_Block_Widget_Name
7
+ {
8
+ protected $_atttributeMap = array(
9
+ 'firstname' => 'First Name',
10
+ 'lastname' => 'Last Name'
11
+ );
12
+
13
+ /**
14
+ * Retrieve store attribute label
15
+ *
16
+ * @param string $attributeCode
17
+ * @return string
18
+ */
19
+ public function getStoreLabel($attributeCode)
20
+ {
21
+ try {
22
+ $attribute = $this->_getAttribute($attributeCode);
23
+ return $attribute ? $this->__($attribute->getStoreLabel()) : '';
24
+ } catch (Exception $e) {
25
+ if (isset($this->_atttributeMap[$attributeCode])) {
26
+ return $this->__($this->_atttributeMap[$attributeCode]);
27
+ }
28
+ }
29
+ }
30
+ }
app/code/community/Jmango360/Japi/Block/Payment/Form.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Block_Payment_Form extends Mage_Payment_Block_Form
7
+ {
8
+
9
+ }
app/code/community/Jmango360/Japi/Block/Payment/Info.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Block_Payment_Info extends Mage_Payment_Block_Info
7
+ {
8
+ /**
9
+ * Prepare information specific to current payment method
10
+ *
11
+ * @param Varien_Object|array $transport
12
+ * @return Varien_Object
13
+ */
14
+ protected function _prepareSpecificInformation($transport = null)
15
+ {
16
+ $transport = parent::_prepareSpecificInformation($transport);
17
+
18
+ $paymentInfo = $this->getInfo();
19
+ $data = (array)$paymentInfo->getAdditionalInformation();
20
+ foreach ($data as $key => $value) {
21
+ if ($key != Jmango360_Japi_Model_Payment::PAYMENT_ID && is_string($value)) {
22
+ $transport->setData($this->_convertLabel($key), $value);
23
+ }
24
+ }
25
+
26
+ return $transport;
27
+ }
28
+
29
+ /**
30
+ * Convert payment information label to better readable
31
+ *
32
+ * @param $label
33
+ * @return string
34
+ */
35
+ protected function _convertLabel($label)
36
+ {
37
+ return ucwords(str_replace('_', ' ', $label));
38
+ }
39
+ }
app/code/community/Jmango360/Japi/Block/Socolissimosimplicite/Iframe.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * IFrame So Colissimo
5
+ *
6
+ * @category LaPoste
7
+ * @package LaPoste_SoColissimoSimplicite
8
+ * @copyright Copyright (c) 2010 La Poste
9
+ * @author Smile (http://www.smile.fr)
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ class Jmango360_Japi_Block_Socolissimosimplicite_Iframe extends LaPoste_SoColissimoSimplicite_Block_Iframe
13
+ {
14
+ /**
15
+ * Retourne le contenu html de l'étape shipping_method
16
+ *
17
+ * @return string
18
+ */
19
+ public function getShippingMethodHtml()
20
+ {
21
+ $html = parent::getShippingMethodHtml();
22
+ return str_replace('\\"', '\\\"', $html);
23
+ }
24
+
25
+ /**
26
+ * Retourn le contenu html de l'étape payment
27
+ *
28
+ * @return string
29
+ */
30
+ public function getPaymentHtml()
31
+ {
32
+ $html = parent::getPaymentHtml();
33
+ return str_replace('\\"', '\\\"', $html);
34
+ }
35
+ }
app/code/community/Jmango360/Japi/Helper/Product.php CHANGED
@@ -2363,4 +2363,156 @@ class Jmango360_Japi_Helper_Product extends Mage_Core_Helper_Abstract
2363
 
2364
  return $data;
2365
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2366
  }
2363
 
2364
  return $data;
2365
  }
2366
+
2367
+ /**
2368
+ * Support SolrBridge_Solrsearch search engine
2369
+ *
2370
+ * @return array
2371
+ * @throws Jmango360_Japi_Exception
2372
+ */
2373
+ public function getProductCollectionFromSolrBridgeSolrsearch()
2374
+ {
2375
+ if (!$this->isModuleEnabled('SolrBridge_Solrsearch')) {
2376
+ throw new Jmango360_Japi_Exception(
2377
+ $this->__('Module(s) %s not found.', 'SolrBridge_Solrsearch'),
2378
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
2379
+ );
2380
+ }
2381
+
2382
+ $solrData = $this->_prepareSolrData();
2383
+
2384
+ $documents = array();
2385
+ if (isset($solrData['response']['docs'])) {
2386
+ $documents = $solrData['response']['docs'];
2387
+ }
2388
+
2389
+ $productIds = array();
2390
+ if (is_array($documents) && count($documents) > 0) {
2391
+ foreach ($documents as $_doc) {
2392
+ if (isset($_doc['products_id'])) {
2393
+ $productIds[] = $_doc['products_id'];
2394
+ }
2395
+ }
2396
+ }
2397
+
2398
+ /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
2399
+ $collection = Mage::getModel('catalog/product')->getCollection();
2400
+ Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
2401
+ Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
2402
+ $this->applySupportedProductTypes($collection);
2403
+ $this->applyHideOnAppFilter($collection);
2404
+ $collection->addAttributeToFilter('entity_id', array('in' => $productIds));
2405
+ $collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
2406
+ if (method_exists($collection, 'addPriceData')) {
2407
+ $collection->addPriceData();
2408
+ }
2409
+ Mage::helper('solrsearch')->applyInstockCheck($collection);
2410
+ $collection->getSelect()->order(sprintf("find_in_set(e.entity_id, '%s')", implode(',', $productIds)));
2411
+
2412
+ $data = array();
2413
+
2414
+ /**
2415
+ * Parse filters
2416
+ */
2417
+ if (isset($solrData['facet_counts']['facet_fields']) && is_array($solrData['facet_counts']['facet_fields'])) {
2418
+ /** @var SolrBridge_Solrsearch_Block_Faces $facetHelper */
2419
+ $facetHelper = Mage::app()->getLayout()->createBlock('solrsearch/faces');
2420
+
2421
+ $facetsFields = $solrData['facet_counts']['facet_fields'];
2422
+ $currentFilters = $this->_getRequest()->getParam('fq');
2423
+
2424
+ foreach ($facetsFields as $facet => $facetItems) {
2425
+ if (!is_array($facetItems) || !count($facetItems)) continue;
2426
+ if ($facetHelper->isFieldRange($facet)) continue;
2427
+ if (strpos($facet, 'price') !== false) continue;
2428
+
2429
+ list($attributeCode, $junk) = explode('_', $facet);
2430
+ if (array_key_exists($attributeCode, $currentFilters)) continue;
2431
+
2432
+ if ($facet == 'category_path' || $facet == 'category_facet') {
2433
+ $item = array(
2434
+ 'name' => $this->__('Category'),
2435
+ 'code' => sprintf('fq[%s]', 'category_id'),
2436
+ 'items' => array()
2437
+ );
2438
+ foreach ($facetItems as $itemLabel => $itemCount) {
2439
+ list($categoryName, $categoryId) = explode('/', $itemLabel);
2440
+
2441
+ if (isset($currentFilters['category_id']) && $currentFilters['category_id'] == $categoryId) {
2442
+ continue;
2443
+ }
2444
+
2445
+ $item['items'][] = array(
2446
+ 'value' => $categoryId,
2447
+ 'label' => $categoryName,
2448
+ 'count' => $itemCount
2449
+ );
2450
+ }
2451
+ } else {
2452
+ $item = array(
2453
+ 'name' => $facetHelper->getFacetLabel($facet),
2454
+ 'code' => sprintf('fq[%s]', $attributeCode),
2455
+ 'items' => array()
2456
+ );
2457
+ foreach ($facetItems as $itemLabel => $itemCount) {
2458
+ $item['items'][] = array(
2459
+ 'value' => $itemLabel,
2460
+ 'label' => $itemLabel,
2461
+ 'count' => $itemCount
2462
+ );
2463
+ }
2464
+ }
2465
+
2466
+ $data['filters'][] = $item;
2467
+ }
2468
+ } else {
2469
+ $data['filters'] = null;
2470
+ }
2471
+
2472
+ /**
2473
+ * Parse toolbar data
2474
+ */
2475
+ /* @var $toolBarBlock Mage_Catalog_Block_Product_List_Toolbar */
2476
+ $toolBarBlock = Mage::helper('japi')->getBlock('catalog/product_list_toolbar');
2477
+ $toolBarBlock->setCollection($collection);
2478
+
2479
+ $data['toolbar_info']['current_page_num'] = $toolBarBlock->getCurrentPage();
2480
+ $data['toolbar_info']['last_page_num'] = !empty($solrData['response']['numFound'])
2481
+ ? ceil($solrData['response']['numFound'] / $toolBarBlock->getLimit())
2482
+ : null;
2483
+ $data['toolbar_info']['current_limit'] = $toolBarBlock->getLimit();
2484
+ $data['toolbar_info']['available_limit'] = $toolBarBlock->getAvailableLimit();
2485
+ $data['toolbar_info']['current_order'] = $toolBarBlock->getCurrentOrder();
2486
+ $currentDirection = $this->_getCurrentDirection($collection);
2487
+ if (!$currentDirection) $currentDirection = $toolBarBlock->getCurrentDirection();
2488
+ $data['toolbar_info']['current_direction'] = $currentDirection;
2489
+ foreach ($toolBarBlock->getAvailableOrders() as $order => $label) {
2490
+ $data['toolbar_info']['available_orders'][$order] = $this->__($label);
2491
+ }
2492
+
2493
+ /**
2494
+ * Convert products
2495
+ */
2496
+ $data['products'] = $this->convertProductCollectionToApiResponseV2($collection);
2497
+
2498
+ return $data;
2499
+ }
2500
+
2501
+ /**
2502
+ * Get data from Solr server
2503
+ *
2504
+ * @return array
2505
+ */
2506
+ protected function _prepareSolrData()
2507
+ {
2508
+ $solrModel = Mage::registry('solrbridge_loaded_solr');
2509
+
2510
+ if ($solrModel) {
2511
+ return $solrModel->getSolrData();
2512
+ } else {
2513
+ $solrModel = Mage::getModel('solrsearch/solr');
2514
+ $queryText = Mage::helper('solrsearch')->getParam('q');
2515
+ return $solrModel->query($queryText);
2516
+ }
2517
+ }
2518
  }
app/code/community/Jmango360/Japi/Helper/Review/Bazaarvoice.php CHANGED
@@ -13,8 +13,8 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
13
  const API_VERSION = '5.4';
14
 
15
  const DEFAULT_LIMIT = 99;
16
- const DEFAULT_SORT = 'SubmissionTime';
17
- const DEFAULT_DIR = 'desc';
18
 
19
  const CACHE_KEY_REVIEW_FORM = 'BAZAARVOICE_REVIEW_FORM';
20
 
@@ -38,22 +38,27 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
38
  */
39
  protected $_labels = array();
40
 
 
 
 
 
 
 
 
41
  /**
42
  * Get product Id for Bazaarvoice
43
  *
44
- * @param Mage_Catalog_Model_Product $product
45
  * @return string
46
  */
47
  public function getBvProductId($product)
48
  {
49
- if (!$product && !$product->getId()) return '';
50
-
51
- if (class_exists('Bazaarvoice_Connector_Helper_Data')) {
52
- /* @var $bvHelper Bazaarvoice_Connector_Helper_Data */
53
- $bvHelper = Mage::helper('bazaarvoice');
54
- return $bvHelper->getProductId($product);
55
  }
56
 
 
 
57
  return $this->_getProductId($product);
58
  }
59
 
@@ -197,7 +202,8 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
197
  'Offset' => $this->_getReviewsOffset(),
198
  'Limit' => $this->_getReviewsLimit(),
199
  'Include' => 'Products',
200
- 'Stats' => 'Reviews'
 
201
  ));
202
 
203
  $result = $this->send('GET', $url);
@@ -232,8 +238,13 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
232
  }
233
 
234
  if (is_array($result['Results'])) {
 
 
 
 
 
235
  foreach ($result['Results'] as $item) {
236
- if ($review = $this->_parseReview($item, $fields)) {
237
  $data['reviews'][] = $review;
238
  }
239
  }
@@ -277,8 +288,7 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
277
  'ApiVersion' => '5.4',
278
  'PassKey' => $apiKey,
279
  'ProductId' => $productId,
280
- 'Locale' => Mage::app()->getLocale()->getLocaleCode(),
281
- 'UserId' => $session->isLoggedIn() ? $session->getCustomerId() : null
282
  ));
283
 
284
  $result = $this->send('GET', $url);
@@ -371,12 +381,30 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
371
  }
372
  }
373
  }
 
 
 
 
 
 
 
374
  }
375
 
376
- $cache->save(Mage::helper('core')->jsonEncode($data), $cacheKey,
377
- array(Mage_Core_Model_Config::CACHE_TAG, strtoupper(Mage_Core_Block_Abstract::CACHE_GROUP)),
378
- 60 * 60
379
- );
 
 
 
 
 
 
 
 
 
 
 
380
  }
381
 
382
  return Mage::helper('core')->jsonDecode($cache->load($cacheKey));
@@ -405,15 +433,18 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
405
 
406
  $submitData = array(
407
  'UserNickname' => @$data['usernickname'],
408
- 'UserEmail' => @$data['useremail'],
409
- 'user' => $this->_getUAS(),
410
  'Title' => @$data['title'],
411
  'ReviewText' => @$data['reviewtext'],
412
  'Rating' => @$data['ratings']['rating'],
413
- 'IsRecommended' => $this->_getBooleanValue(@$data['isrecommended']),
414
  'AgreedToTermsAndConditions' => $this->_getBooleanValue(@$data['agreedtotermsandconditions'])
415
  );
416
 
 
 
 
 
417
  if (!empty($data['ratings'])) {
418
  $reviewForm = $this->getForm($product);
419
  if (!empty($reviewForm['reviews'])) {
@@ -445,6 +476,12 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
445
  }
446
  }
447
 
 
 
 
 
 
 
448
  $apiKey = $this->_getApiKey();
449
  $url = $this->_getApiUrl('data/submitreview.json');
450
  $submitData = array_merge(array(
@@ -487,12 +524,30 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
487
  return array('success' => Mage::helper('review')->__('Your review has been accepted for moderation.'));
488
  }
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  /**
491
  * Generate UAS string
492
  *
 
493
  * @return string
494
  */
495
- protected function _getUAS()
496
  {
497
  $sharedKey = Mage::getStoreConfig('japi/jmango_rest_bazaarvoice_settings/shared_key');
498
  if ($sharedKey) {
@@ -501,7 +556,15 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
501
  /* @var $session Mage_Customer_Model_Session */
502
  $session = Mage::getSingleton('customer/session');
503
  $userId = $session->isLoggedIn() ? $session->getCustomer()->getId() : uniqid();
504
- $userStr = sprintf('date=%s&userid=%s', $dateModel->date('Y-m-d'), $userId);
 
 
 
 
 
 
 
 
505
  $encUserStr = hash_hmac('sha256', $sharedKey, $userStr) . bin2hex($userStr);
506
  return $encUserStr;
507
  }
@@ -509,6 +572,37 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
509
  return '';
510
  }
511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  /**
513
  * Convert boolean value to string
514
  *
@@ -579,13 +673,22 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
579
  return $data;
580
  }
581
 
582
- protected function _parseReview($result = array(), $fields = array())
 
 
 
 
 
 
 
 
 
583
  {
584
  if (!$result || !is_array($result)) return;
585
  if (!empty($result['ModerationStatus']) && $result['ModerationStatus'] != 'APPROVED') return;
586
 
587
  $data = array(
588
- 'nickname' => @$result['UserNickname'],
589
  'create_at' => $this->_getDatetimeValue(@$result['SubmissionTime']),
590
  'review' => array()
591
  );
@@ -621,7 +724,7 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
621
  foreach ($result['ContextDataValues'] as $key => $context) {
622
  $dataTmp = array(
623
  'code' => 'ratings',
624
- 'title' => @$context['DimensionLabel'],
625
  'type' => null,
626
  'required' => false,
627
  'id' => ++$index . "",
@@ -629,7 +732,7 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
629
  );
630
  foreach ($fields as $field) {
631
  if ($field['bv_id'] == 'contextdatavalue_' . $key) {
632
- $dataTmp['title'] = $field['title'];
633
  $dataTmp['type'] = $field['type'];
634
  $dataTmp['required'] = $field['required'];
635
  $dataTmp['values'] = $field['values'];
@@ -702,6 +805,22 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
702
  $data['review'][] = $isRecommended;
703
  }
704
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
705
  $data['review'] = array_merge($data['review'], array(
706
  array(
707
  'code' => 'nickname',
@@ -722,17 +841,39 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
722
  'title' => $this->__('Review'),
723
  'type' => 'area',
724
  'required' => true,
725
- 'selected' => @$result['ReviewText']
726
  )
727
  ));
728
 
729
  return $data;
730
  }
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  /**
733
  * Get rating label from configuration
734
  *
735
- * @param $value
736
  * @return string
737
  */
738
  protected function _getRatingLabel($value)
@@ -749,6 +890,8 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
749
  if (array_key_exists($value, $this->_labels)) {
750
  return $this->_labels[$value];
751
  }
 
 
752
  }
753
 
754
  protected function _getDatetimeValue($value)
@@ -777,6 +920,13 @@ class Jmango360_Japi_Helper_Review_Bazaarvoice extends Mage_Core_Helper_Abstract
777
  return is_numeric($limit) ? (int)$limit : self::DEFAULT_LIMIT;
778
  }
779
 
 
 
 
 
 
 
 
780
  protected function _getReviewsSort()
781
  {
782
  return sprintf('%s:%s', self::DEFAULT_SORT, self::DEFAULT_DIR);
13
  const API_VERSION = '5.4';
14
 
15
  const DEFAULT_LIMIT = 99;
16
+ const DEFAULT_SORT = 'relevancy';
17
+ const DEFAULT_DIR = 'a1';
18
 
19
  const CACHE_KEY_REVIEW_FORM = 'BAZAARVOICE_REVIEW_FORM';
20
 
38
  */
39
  protected $_labels = array();
40
 
41
+ /**
42
+ * Store client label mapping
43
+ *
44
+ * @var array
45
+ */
46
+ protected $_clientLabels = array();
47
+
48
  /**
49
  * Get product Id for Bazaarvoice
50
  *
51
+ * @param Mage_Catalog_Model_Product|int $product
52
  * @return string
53
  */
54
  public function getBvProductId($product)
55
  {
56
+ if (is_numeric($product)) {
57
+ $product = Mage::getModel('catalog/product')->load($product, 'sku');
 
 
 
 
58
  }
59
 
60
+ if (!$product && !$product->getId()) return '';
61
+
62
  return $this->_getProductId($product);
63
  }
64
 
202
  'Offset' => $this->_getReviewsOffset(),
203
  'Limit' => $this->_getReviewsLimit(),
204
  'Include' => 'Products',
205
+ 'Stats' => 'Reviews',
206
+ 'displaycode' => $this->_getDisplayCode()
207
  ));
208
 
209
  $result = $this->send('GET', $url);
238
  }
239
 
240
  if (is_array($result['Results'])) {
241
+ if (!empty($result['Includes']['Products'])) {
242
+ $products = $result['Includes']['Products'];
243
+ } else {
244
+ $products = array();
245
+ }
246
  foreach ($result['Results'] as $item) {
247
+ if ($review = $this->_parseReview($item, $productId, $products, $fields)) {
248
  $data['reviews'][] = $review;
249
  }
250
  }
288
  'ApiVersion' => '5.4',
289
  'PassKey' => $apiKey,
290
  'ProductId' => $productId,
291
+ 'Locale' => Mage::app()->getLocale()->getLocaleCode()
 
292
  ));
293
 
294
  $result = $this->send('GET', $url);
381
  }
382
  }
383
  }
384
+
385
+ $cache->save(
386
+ Mage::helper('core')->jsonEncode($data),
387
+ $cacheKey,
388
+ array(Mage_Core_Model_Config::CACHE_TAG, strtoupper(Mage_Core_Block_Abstract::CACHE_GROUP)),
389
+ 60 * 60
390
+ );
391
  }
392
 
393
+ if (!empty($result['HasErrors'])) {
394
+ if (!empty($result['Errors'])) {
395
+ foreach ($result['Errors'] as $error) {
396
+ throw new Jmango360_Japi_Exception(
397
+ sprintf('%s', $error['Message']),
398
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
399
+ );
400
+ }
401
+ } else {
402
+ throw new Jmango360_Japi_Exception(
403
+ Mage::helper('japi')->__('An error has occurred, please try again later.'),
404
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
405
+ );
406
+ }
407
+ }
408
  }
409
 
410
  return Mage::helper('core')->jsonDecode($cache->load($cacheKey));
433
 
434
  $submitData = array(
435
  'UserNickname' => @$data['usernickname'],
436
+ 'UserEmail' => $this->_getUserEmail(@$data['useremail']),
437
+ 'user' => $this->_getUAS($product->getId()),
438
  'Title' => @$data['title'],
439
  'ReviewText' => @$data['reviewtext'],
440
  'Rating' => @$data['ratings']['rating'],
 
441
  'AgreedToTermsAndConditions' => $this->_getBooleanValue(@$data['agreedtotermsandconditions'])
442
  );
443
 
444
+ if (isset($data['isrecommended'])) {
445
+ $submitData['IsRecommended'] = $this->_getBooleanValue(@$data['isrecommended']);
446
+ }
447
+
448
  if (!empty($data['ratings'])) {
449
  $reviewForm = $this->getForm($product);
450
  if (!empty($reviewForm['reviews'])) {
476
  }
477
  }
478
 
479
+ /* @var $session Mage_Customer_Model_Session */
480
+ $session = Mage::getSingleton('customer/session');
481
+ if ($session->isLoggedIn() && $this->_checkProductPurchased($product->getId())) {
482
+ $submitData['ContextDataValue_VerifiedPurchaser'] = 'true';
483
+ }
484
+
485
  $apiKey = $this->_getApiKey();
486
  $url = $this->_getApiUrl('data/submitreview.json');
487
  $submitData = array_merge(array(
524
  return array('success' => Mage::helper('review')->__('Your review has been accepted for moderation.'));
525
  }
526
 
527
+ /**
528
+ * If email is empty and customer logged in, return his email
529
+ *
530
+ * @param string|null $email
531
+ * @return string
532
+ */
533
+ protected function _getUserEmail($email)
534
+ {
535
+ if (!$email) {
536
+ /* @var $session Mage_Customer_Model_Session */
537
+ $session = Mage::getSingleton('customer/session');
538
+ $email = $session->getCustomer()->getEmail();
539
+ }
540
+
541
+ return $email;
542
+ }
543
+
544
  /**
545
  * Generate UAS string
546
  *
547
+ * @param int $productId
548
  * @return string
549
  */
550
+ protected function _getUAS($productId)
551
  {
552
  $sharedKey = Mage::getStoreConfig('japi/jmango_rest_bazaarvoice_settings/shared_key');
553
  if ($sharedKey) {
556
  /* @var $session Mage_Customer_Model_Session */
557
  $session = Mage::getSingleton('customer/session');
558
  $userId = $session->isLoggedIn() ? $session->getCustomer()->getId() : uniqid();
559
+ $userArr = array(
560
+ 'date' => $dateModel->date('Y-m-d'),
561
+ 'userid' => $userId
562
+ );
563
+ if ($session->isLoggedIn() && $this->_checkProductPurchased($productId)) {
564
+ $userArr['verifiedpurchaser'] = 'true';
565
+ $userArr['subjectids'] = $this->getBvProductId($productId);
566
+ }
567
+ $userStr = http_build_query($userArr);
568
  $encUserStr = hash_hmac('sha256', $sharedKey, $userStr) . bin2hex($userStr);
569
  return $encUserStr;
570
  }
572
  return '';
573
  }
574
 
575
+ /**
576
+ * Check if customer purchased product
577
+ *
578
+ * @param int $productId
579
+ * @return bool
580
+ */
581
+ protected function _checkProductPurchased($productId)
582
+ {
583
+ /* @var $session Mage_Customer_Model_Session */
584
+ $session = Mage::getSingleton('customer/session');
585
+ if ($session->isLoggedIn()) {
586
+ /** @var Mage_Core_Model_Resource $resource */
587
+ $resource = Mage::getSingleton('core/resource');
588
+ $readConnection = $resource->getConnection('core_read');
589
+
590
+ $select = $readConnection->select()
591
+ ->from(array('item' => $resource->getTableName('sales/order_item')), 'item_id')
592
+ ->join(
593
+ array('order' => $resource->getTableName('sales/order')),
594
+ 'item.order_id = order.entity_id',
595
+ array('customer_id')
596
+ )
597
+ ->where('item.product_id = ?', $productId)
598
+ ->where('order.customer_id = ?', $session->getCustomerId());
599
+
600
+ return (bool)$readConnection->fetchOne($select);
601
+ }
602
+
603
+ return false;
604
+ }
605
+
606
  /**
607
  * Convert boolean value to string
608
  *
673
  return $data;
674
  }
675
 
676
+ /**
677
+ * Convert review item to API response
678
+ *
679
+ * @param array $result
680
+ * @param string $productId
681
+ * @param array $products
682
+ * @param array $fields
683
+ * @return array|null
684
+ */
685
+ protected function _parseReview($result = array(), $productId, $products, $fields = array())
686
  {
687
  if (!$result || !is_array($result)) return;
688
  if (!empty($result['ModerationStatus']) && $result['ModerationStatus'] != 'APPROVED') return;
689
 
690
  $data = array(
691
+ 'nickname' => !empty($result['UserNickname']) ? $result['UserNickname'] : $this->__('Anonymous'),
692
  'create_at' => $this->_getDatetimeValue(@$result['SubmissionTime']),
693
  'review' => array()
694
  );
724
  foreach ($result['ContextDataValues'] as $key => $context) {
725
  $dataTmp = array(
726
  'code' => 'ratings',
727
+ 'title' => $this->_getRatingLabel($key),
728
  'type' => null,
729
  'required' => false,
730
  'id' => ++$index . "",
732
  );
733
  foreach ($fields as $field) {
734
  if ($field['bv_id'] == 'contextdatavalue_' . $key) {
735
+ //$dataTmp['title'] = $field['title'];
736
  $dataTmp['type'] = $field['type'];
737
  $dataTmp['required'] = $field['required'];
738
  $dataTmp['values'] = $field['values'];
805
  $data['review'][] = $isRecommended;
806
  }
807
 
808
+ $note = '';
809
+
810
+ /**
811
+ * Product family
812
+ */
813
+ if ($productId && $productId != $result['ProductId'] && array_key_exists($result['ProductId'], $products)) {
814
+ $note .= "\n" . $this->__('Originally posted on %s.', $products[$result['ProductId']]['Name']);
815
+ }
816
+
817
+ /**
818
+ * Source client
819
+ */
820
+ if ($client = $this->_getSourceClient($result['SourceClient'])) {
821
+ $note .= "\n" . $this->__('Originally posted on %s.', $client);
822
+ }
823
+
824
  $data['review'] = array_merge($data['review'], array(
825
  array(
826
  'code' => 'nickname',
841
  'title' => $this->__('Review'),
842
  'type' => 'area',
843
  'required' => true,
844
+ 'selected' => @$result['ReviewText'] . ($note ? "\n" . $note : '')
845
  )
846
  ));
847
 
848
  return $data;
849
  }
850
 
851
+ /**
852
+ * Get source client label
853
+ */
854
+ protected function _getSourceClient($client)
855
+ {
856
+ if (!$client) return null;
857
+
858
+ if (empty($this->_clientLabels)) {
859
+ $clientLabelsMap = explode("\n", Mage::getStoreConfig('japi/jmango_rest_bazaarvoice_settings/client_label'));
860
+ foreach ($clientLabelsMap as $clientLabelMap) {
861
+ list($clientId, $clientLabel) = explode('|', $clientLabelMap);
862
+ if ($clientId && $clientLabel) {
863
+ $this->_clientLabels[$clientId] = $clientLabel;
864
+ }
865
+ }
866
+ }
867
+
868
+ if (array_key_exists($client, $this->_clientLabels)) {
869
+ return $this->_clientLabels[$client];
870
+ }
871
+ }
872
+
873
  /**
874
  * Get rating label from configuration
875
  *
876
+ * @param string $value
877
  * @return string
878
  */
879
  protected function _getRatingLabel($value)
890
  if (array_key_exists($value, $this->_labels)) {
891
  return $this->_labels[$value];
892
  }
893
+
894
+ return $value;
895
  }
896
 
897
  protected function _getDatetimeValue($value)
920
  return is_numeric($limit) ? (int)$limit : self::DEFAULT_LIMIT;
921
  }
922
 
923
+ protected function _getDisplayCode()
924
+ {
925
+ if ($code = Mage::getStoreConfig('japi/jmango_rest_bazaarvoice_settings/displaycode')) {
926
+ return sprintf('%s-%s', $code, Mage::app()->getLocale()->getLocaleCode());
927
+ }
928
+ }
929
+
930
  protected function _getReviewsSort()
931
  {
932
  return sprintf('%s:%s', self::DEFAULT_SORT, self::DEFAULT_DIR);
app/code/community/Jmango360/Japi/Model/Observer.php CHANGED
@@ -720,4 +720,43 @@ class Jmango360_Japi_Model_Observer
720
 
721
  return $this;
722
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  }
720
 
721
  return $this;
722
  }
723
+
724
+ /**
725
+ * @param Varien_Event_Observer $observer
726
+ */
727
+ public function japiControllerResponseRedirect(Varien_Event_Observer $observer)
728
+ {
729
+ $transport = $observer->getEvent()->getTransport();
730
+ /* @var $server Jmango360_Japi_Model_Server */
731
+ $server = Mage::getSingleton('japi/server');
732
+ if ($server->getIsRest()) {
733
+ /**
734
+ * MPLUGIN-1969: Try spoof LaPoste_SoColissimoSimplicite not redirect to "checkout/onepage"
735
+ */
736
+ if (strpos($transport->getUrl(), 'checkout/onepage') !== false) {
737
+ /* @var $checkoutSession Mage_Checkout_Model_Session */
738
+ $checkoutSession = Mage::getSingleton('checkout/session');
739
+ if ($checkoutSession->getData('socolissimosimplicite_checkout_onepage_nextstep') == 'payment') {
740
+ $transport->setUrl(Mage::getUrl('japi/checkout/onepage', array('_secure' => true)));
741
+ }
742
+ }
743
+ }
744
+ }
745
+
746
+ /**
747
+ * Mobile Paypal SDK: Save verify comment to order
748
+ *
749
+ * @param Varien_Event_Observer $observer
750
+ */
751
+ public function japiSalesModelServiceQuoteSubmitBefore(Varien_Event_Observer $observer)
752
+ {
753
+ /* @var $session Mage_Checkout_Model_Session */
754
+ $session = Mage::getSingleton('checkout/session');
755
+ if ($session->getData('jmango_payment_paypal_verified')) {
756
+ /* @var $order Mage_Sales_Model_Order */
757
+ $order = $observer->getEvent()->getOrder();
758
+ $paymentId = $order->getPayment()->getAdditionalInformation(Jmango360_Japi_Model_Payment::PAYPAL_PAYMENT_ID);
759
+ $order->addStatusHistoryComment(sprintf('Paypal payment ID (%s) verified.', $paymentId));
760
+ }
761
+ }
762
  }
app/code/community/Jmango360/Japi/Model/Payment.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Model_Payment extends Mage_Payment_Model_Method_Abstract
7
+ {
8
+ const CODE = 'jmango_payment';
9
+ const PAYMENT_ID = 'id';
10
+ const PAYMENT_TITLE = 'title';
11
+ const PAYPAL_PAYMENT_ID = 'payment_id';
12
+
13
+ protected $_code = self::CODE;
14
+ protected $_formBlockType = 'japi/payment_form';
15
+ protected $_infoBlockType = 'japi/payment_info';
16
+
17
+ /**
18
+ * Retrieve payment method title
19
+ * Return title from additinal information if provided
20
+ *
21
+ * @return string
22
+ */
23
+ public function getTitle()
24
+ {
25
+ try {
26
+ $paymentInfo = $this->getInfoInstance();
27
+ $title = $paymentInfo->getAdditionalInformation(self::PAYMENT_TITLE);
28
+ if ($title) return $title;
29
+ } catch (Exception $e) {
30
+ }
31
+
32
+ return parent::getTitle();
33
+ }
34
+
35
+ /**
36
+ * Only enable this payment in API call
37
+ *
38
+ * @param null $quote
39
+ * @return bool
40
+ */
41
+ public function isAvailable($quote = null)
42
+ {
43
+ return Mage::app()->getRequest()->getModuleName() == 'japi' &&
44
+ Mage::app()->getRequest()->getControllerName() != 'checkout';
45
+ }
46
+
47
+ /**
48
+ * Validate payment transaction by mobile app
49
+ * Used for: Paypal
50
+ *
51
+ * @return $this
52
+ */
53
+ public function validate()
54
+ {
55
+ $paymentInfo = $this->getInfoInstance();
56
+ switch ($paymentInfo->getAdditionalInformation(self::PAYMENT_ID)) {
57
+ case 'paypal':
58
+ $this->_validatePaypal();
59
+ break;
60
+ case 'braintree':
61
+ $this->_validateBraintree();
62
+ break;
63
+ }
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Validate Braintree transation from Orchard server
69
+ */
70
+ protected function _validateBraintree()
71
+ {
72
+ return true;
73
+ }
74
+
75
+ /**
76
+ * Validate Paypal payment ID sent from mobile
77
+ *
78
+ * @throws Jmango360_Japi_Exception
79
+ */
80
+ protected function _validatePaypal()
81
+ {
82
+ $paymentInfo = $this->getInfoInstance();
83
+ $paymentId = $paymentInfo->getAdditionalInformation(self::PAYPAL_PAYMENT_ID);
84
+ if ($paymentId) {
85
+ /* @var $model Jmango360_Japi_Model_Payment_Paypal */
86
+ $model = Mage::getSingleton('japi/payment_paypal');
87
+ if ($model->verifyPayment($paymentId)) {
88
+ /* @var $session Mage_Checkout_Model_Session */
89
+ $session = Mage::getSingleton('checkout/session');
90
+ $session->setData('jmango_payment_paypal_verified', true);
91
+ $session->setData('place_order', true);
92
+ }
93
+ } else {
94
+ throw new Jmango360_Japi_Exception(
95
+ Mage::helper('japi')->__('Paypal Payment ID not found'),
96
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
97
+ );
98
+ }
99
+ }
100
+ }
app/code/community/Jmango360/Japi/Model/Payment/Braintree.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Model_Payment_Braintree
7
+ {
8
+ const BRAINTREE_TRANSACTION_ID = 'transaction_id';
9
+
10
+ public function __construct()
11
+ {
12
+ $braintreeLib = Mage::getBaseDir('lib') . '/Jmango360/Braintree/lib/Braintree.php';
13
+ if (file_exists($braintreeLib)) {
14
+ require_once $braintreeLib;
15
+ } else {
16
+ throw new Jmango360_Japi_Exception(
17
+ Mage::helper('japi')->__('The Braintree PHP SDK missing', phpversion()),
18
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
19
+ );
20
+ }
21
+
22
+ if (version_compare(phpversion(), '5.4', '<')) {
23
+ throw new Jmango360_Japi_Exception(
24
+ Mage::helper('japi')->__('The Braintree PHP SDK requires PHP version 5.4.0 or higher, currently %s', phpversion()),
25
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
26
+ );
27
+ }
28
+
29
+ if (!extension_loaded('curl')) {
30
+ throw new Jmango360_Japi_Exception(
31
+ Mage::helper('japi')->__('The Braintree PHP SDK requires cURL extension'),
32
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
33
+ );
34
+ }
35
+
36
+ $this->_setup();
37
+ }
38
+
39
+ protected function _setup()
40
+ {
41
+ try {
42
+ $environment = Mage::getStoreConfig('japi/jmango_rest_braintree_settings/sandbox') ? 'sandbox' : 'production';
43
+ Braintree_Configuration::environment($environment);
44
+ if ($environment != 'sandbox') {
45
+ Braintree_Configuration::merchantId(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/merchant_id'));
46
+ Braintree_Configuration::publicKey(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/public_key'));
47
+ Braintree_Configuration::privateKey(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/private_key'));
48
+ } else {
49
+ Braintree_Configuration::merchantId(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/sandbox_merchant_id'));
50
+ Braintree_Configuration::publicKey(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/sandbox_public_key'));
51
+ Braintree_Configuration::privateKey(Mage::getStoreConfig('japi/jmango_rest_braintree_settings/sandbox_private_key'));
52
+ }
53
+ } catch (\Exception $e) {
54
+ throw new Jmango360_Japi_Exception(
55
+ $e->getMessage(),
56
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
57
+ );
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @param string $transactionId
63
+ * @return Braintree_Transaction
64
+ * @throws Exception
65
+ */
66
+ public function getTransaction($transactionId)
67
+ {
68
+ try {
69
+ return Braintree_Transaction::find($transactionId);
70
+ } catch (\Exception $e) {
71
+ throw new Exception($e->getMessage());
72
+ }
73
+ }
74
+ }
app/code/community/Jmango360/Japi/Model/Payment/Paypal.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Model_Payment_Paypal extends Varien_Http_Adapter_Curl
7
+ {
8
+ const PAYPAL_SANDBOX_URL = 'https://api.sandbox.paypal.com/v1/';
9
+ const PAYPAL_LIVE_URL = 'https://api.paypal.com/v1/';
10
+
11
+ protected $_clientId;
12
+ protected $_clientSecret;
13
+ protected $_sandboxMode;
14
+ protected $_headers;
15
+
16
+ /**
17
+ * Verify a payment ID from mobile Paypal SDK
18
+ *
19
+ * @param string $paymentId
20
+ * @return bool
21
+ * @throws Jmango360_Japi_Exception
22
+ */
23
+ public function verifyPayment($paymentId)
24
+ {
25
+ $accessToken = $this->getAccessToken();
26
+
27
+ $this->setHeaders(array(
28
+ 'Content-Type: application/json',
29
+ 'Authorization: Bearer ' . $accessToken
30
+ ));
31
+
32
+ $rawResponse = $this->call(Zend_Http_Client::GET, sprintf('payments/payment/%s', $paymentId));
33
+ if (!$rawResponse) {
34
+ throw new Jmango360_Japi_Exception(
35
+ Mage::helper('japi')->__('Could not get response'),
36
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
37
+ );
38
+ }
39
+
40
+ $response = preg_split('/^\r?$/m', $rawResponse, 2);
41
+ $response = json_decode(trim($response[1]));
42
+ if ($response) {
43
+ if ($response->error) {
44
+ throw new Jmango360_Japi_Exception(
45
+ sprintf('[%s] %s', $response->error, $response->error_description),
46
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
47
+ );
48
+ }
49
+ if ($response->state == 'approved') {
50
+ return true;
51
+ } else {
52
+ Mage::log($response, null, 'japi_paypal.log');
53
+ throw new Jmango360_Japi_Exception(
54
+ Mage::helper('japi')->__('Paypal Payment (%s) not approved (%s)', $paymentId, $response->state),
55
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
56
+ );
57
+ }
58
+ } else {
59
+ Mage::log($rawResponse, null, 'japi_paypal.log');
60
+ throw new Jmango360_Japi_Exception(
61
+ Mage::helper('japi')->__('Could not parse response'),
62
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
63
+ );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Get access token from Paypal REST API
69
+ *
70
+ * @param null $clientId
71
+ * @param null $clientSecret
72
+ * @param null $sandboxMode
73
+ * @return mixed
74
+ * @throws Jmango360_Japi_Exception
75
+ */
76
+ public function getAccessToken($clientId = null, $clientSecret = null, $sandboxMode = null)
77
+ {
78
+ if (!$clientId && !$clientSecret && is_null($sandboxMode)) {
79
+ $clientId = Mage::getStoreConfig('japi/jmango_rest_paypal_settings/client_id');
80
+ $clientSecret = Mage::getStoreConfig('japi/jmango_rest_paypal_settings/client_secret');
81
+ $this->_sandboxMode = Mage::getStoreConfig('japi/jmango_rest_paypal_settings/sandbox');
82
+ } else {
83
+ $this->_sandboxMode = $sandboxMode;
84
+ }
85
+
86
+ $this->setHeaders(array(
87
+ 'Accept: application/json',
88
+ 'Accept-Language: en_US'
89
+ ));
90
+ $this->setConfig(array(
91
+ 'timeout' => 60,
92
+ 'userpwd' => sprintf('%s:%s', $clientId, $clientSecret)
93
+ ));
94
+ $request = array(
95
+ 'grant_type' => 'client_credentials'
96
+ );
97
+
98
+ $response = $this->call(Zend_Http_Client::POST, 'oauth2/token', $request);
99
+
100
+ if (!$response) {
101
+ throw new Jmango360_Japi_Exception(
102
+ Mage::helper('japi')->__('Could not get response'),
103
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
104
+ );
105
+ }
106
+
107
+ $response = preg_split('/^\r?$/m', $response, 2);
108
+ $response = json_decode(trim($response[1]));
109
+ if ($response) {
110
+ if ($response->error) {
111
+ throw new Jmango360_Japi_Exception(
112
+ sprintf('[%s] %s', $response->error, $response->error_description),
113
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
114
+ );
115
+ }
116
+ if ($response->access_token) {
117
+ return $response->access_token;
118
+ }
119
+ } else {
120
+ throw new Jmango360_Japi_Exception(
121
+ Mage::helper('japi')->__('Could not parse response'),
122
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
123
+ );
124
+ }
125
+ }
126
+
127
+ public function call($method = 'GET', $endpoint = '', $request = array())
128
+ {
129
+ try {
130
+ $this->write(
131
+ $method,
132
+ $this->_getApiEndpoint($endpoint),
133
+ '1.1',
134
+ $this->getHeaders(),
135
+ $this->_buildQuery($request)
136
+ );
137
+ return $this->read();
138
+ } catch (Exception $e) {
139
+ throw new Jmango360_Japi_Exception($e->getMessage(), $e->getCode());
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Set CURL request headers
145
+ *
146
+ * @param array $headers
147
+ * @return $this
148
+ */
149
+ public function setHeaders($headers = array())
150
+ {
151
+ $this->_headers = $headers;
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * Get CURL request headers
157
+ *
158
+ * @return mixed
159
+ */
160
+ public function getHeaders()
161
+ {
162
+ return $this->_headers;
163
+ }
164
+
165
+ /**
166
+ * API endpoint getter
167
+ *
168
+ * @param $endpoint
169
+ * @return string
170
+ */
171
+ protected function _getApiEndpoint($endpoint)
172
+ {
173
+ return sprintf('%s%s', $this->_sandboxMode ? self::PAYPAL_SANDBOX_URL : self::PAYPAL_LIVE_URL, $endpoint);
174
+ }
175
+
176
+ /**
177
+ * Build query string from request
178
+ *
179
+ * @param array $request
180
+ * @return string
181
+ */
182
+ protected function _buildQuery($request)
183
+ {
184
+ return http_build_query($request);
185
+ }
186
+ }
app/code/community/Jmango360/Japi/Model/Rest/Checkout.php CHANGED
@@ -45,6 +45,11 @@ class Jmango360_Japi_Model_Rest_Checkout extends Mage_Checkout_Model_Type_Onepag
45
  $this->_getResponse()->render($data);
46
  $this->_getResponse()->setHttpResponseCode(Jmango360_Japi_Model_Server::HTTP_OK);
47
  break;
 
 
 
 
 
48
 
49
  /**
50
  * After a one page checkout payment to any provider the return url goes to the:
@@ -365,6 +370,15 @@ class Jmango360_Japi_Model_Rest_Checkout extends Mage_Checkout_Model_Type_Onepag
365
  return $data;
366
  }
367
 
 
 
 
 
 
 
 
 
 
368
  protected function _getOnePage()
369
  {
370
  return Mage::getSingleton('checkout/type_onepage');
45
  $this->_getResponse()->render($data);
46
  $this->_getResponse()->setHttpResponseCode(Jmango360_Japi_Model_Server::HTTP_OK);
47
  break;
48
+ case 'updateOrder' . Jmango360_Japi_Model_Request::OPERATION_UPDATE:
49
+ $data = $this->_updateOrder();
50
+ $this->_getResponse()->render($data);
51
+ $this->_getResponse()->setHttpResponseCode(Jmango360_Japi_Model_Server::HTTP_OK);
52
+ break;
53
 
54
  /**
55
  * After a one page checkout payment to any provider the return url goes to the:
370
  return $data;
371
  }
372
 
373
+ protected function _updateOrder()
374
+ {
375
+ /* @var $model Jmango360_Japi_Model_Rest_Checkout_Onepage */
376
+ $model = Mage::getModel('japi/rest_checkout_onepage');
377
+ $data = $model->updateOrder();
378
+
379
+ return $data;
380
+ }
381
+
382
  protected function _getOnePage()
383
  {
384
  return Mage::getSingleton('checkout/type_onepage');
app/code/community/Jmango360/Japi/Model/Rest/Checkout/Onepage.php CHANGED
@@ -216,9 +216,111 @@ class Jmango360_Japi_Model_Rest_Checkout_Onepage extends Jmango360_Japi_Model_Re
216
  $this->getQuote()->collectTotals()->save();
217
 
218
  /**
219
- * Return quote data
220
  */
221
- return $this->_getCheckoutData();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
 
224
  protected function _saveAddresses()
216
  $this->getQuote()->collectTotals()->save();
217
 
218
  /**
219
+ * Return quote data or place order
220
  */
221
+ if ($this->_getSession()->getData('place_order')) {
222
+ /* @var $model Jmango360_Japi_Model_Rest_Checkout_Submit */
223
+ $model = Mage::getModel('japi/rest_checkout_submit');
224
+ return $model->submitOrder();
225
+ } else {
226
+ return $this->_getCheckoutData();
227
+ }
228
+ }
229
+
230
+ public function updateOrder()
231
+ {
232
+ $request = $this->_getRequest();
233
+ $payment = $request->getParam('payment');
234
+ switch ($payment) {
235
+ case 'braintree':
236
+ return $this->_updateOrderBraintree();
237
+ break;
238
+ }
239
+ }
240
+
241
+ protected function _updateOrderBraintree()
242
+ {
243
+ if (version_compare(phpversion(), '5.4', '<')) {
244
+ throw new Jmango360_Japi_Exception(
245
+ Mage::helper('japi')->__('The Braintree PHP SDK requires PHP version 5.4.0 or higher, currently %s', phpversion()),
246
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
247
+ );
248
+ }
249
+
250
+ if (!extension_loaded('curl')) {
251
+ throw new Jmango360_Japi_Exception(
252
+ Mage::helper('japi')->__('The Braintree PHP SDK requires cURL extension'),
253
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
254
+ );
255
+ }
256
+
257
+ $orderId = $this->_getRequest()->getParam('order_id');
258
+ /* @var $order Mage_Sales_Model_Order */
259
+ $order = Mage::getModel('sales/order');
260
+ $order->load($orderId);
261
+ if (!$order->getId()) {
262
+ $order = $order->loadByIncrementId($orderId);
263
+ if (!$order->getId()) {
264
+ throw new Jmango360_Japi_Exception(
265
+ Mage::helper('japi')->__('Order not found'),
266
+ Jmango360_Japi_Model_Request::HTTP_BAD_REQUEST
267
+ );
268
+ }
269
+ }
270
+
271
+ $payment = $order->getPayment();
272
+ if ($payment->getMethod() != Jmango360_Japi_Model_Payment::CODE) {
273
+ throw new Jmango360_Japi_Exception(
274
+ Mage::helper('japi')->__('Payment method invalid'),
275
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
276
+ );
277
+ }
278
+
279
+ $transactionId = $this->_getRequest()->getParam('transaction_id');
280
+ if (!$transactionId) {
281
+ throw new Jmango360_Japi_Exception(
282
+ Mage::helper('japi')->__('Transaction ID not found'),
283
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
284
+ );
285
+ }
286
+
287
+ /** @var Jmango360_Japi_Model_Payment_Braintree $braintree */
288
+ $braintree = Mage::getModel('japi/payment_braintree');
289
+ $transaction = $braintree->getTransaction($transactionId);
290
+ if ($transaction->id) {
291
+ if ($transaction->status == 'settled') {
292
+ $order->setStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
293
+ }
294
+ $orderStatusHistoryCollection = $order->getStatusHistoryCollection();
295
+ $isSave = false;
296
+ foreach ($transaction->statusHistory as $item) {
297
+ /** @var $item \Braintree\Transaction\StatusDetails */
298
+ $statusStr = sprintf('Status %s', $item->status);
299
+ $statusFound = false;
300
+ foreach ($orderStatusHistoryCollection as $orderItem) {
301
+ /** @var $orderItem Mage_Sales_Model_Order_Status_History */
302
+ if ($orderItem->getComment() == $statusStr) {
303
+ $statusFound = true;
304
+ }
305
+ }
306
+ if (!$statusFound) {
307
+ $time = $item->timestamp instanceof DateTime
308
+ ? $item->timestamp->format('Y-m-d H:i:s')
309
+ : null;
310
+ $history = Mage::getModel('sales/order_status_history')
311
+ ->setStatus($order->getStatus())
312
+ ->setComment($statusStr)
313
+ ->setCreatedAt($time)
314
+ ->setEntityName(Mage_Sales_Model_Order::HISTORY_ENTITY_NAME);
315
+ $order->addStatusHistory($history);
316
+ $isSave = true;
317
+ }
318
+ }
319
+ if ($isSave) {
320
+ $order->save();
321
+ }
322
+ return array('success' => true);
323
+ }
324
  }
325
 
326
  protected function _saveAddresses()
app/code/community/Jmango360/Japi/Model/Rest/Checkout/Submit.php CHANGED
@@ -60,12 +60,15 @@ class Jmango360_Japi_Model_Rest_Checkout_Submit extends Jmango360_Japi_Model_Res
60
 
61
  /**
62
  * Added (int) because in 1.7 the type differs; now it is checking the subtotal without the decimals, but that should be enough to avoid the risk having mixed up carts
 
63
  */
64
- if ($requestSubtotal === "" || $requestQuoteId === "" || ((int)$requestSubtotal != (int)$quoteSubtotal) || ($requestQuoteId != $quote->getId())) {
65
- throw new Jmango360_Japi_Exception(
66
- Mage::helper('japi')->__('Request info does not match the quote. Probably the cart is ordered or the session is expired.'),
67
- Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
68
- );
 
 
69
  }
70
 
71
  /**
60
 
61
  /**
62
  * Added (int) because in 1.7 the type differs; now it is checking the subtotal without the decimals, but that should be enough to avoid the risk having mixed up carts
63
+ * Skip if place order form updatePaymentMethod API
64
  */
65
+ if (!$this->_getSession()->getData('place_order')) {
66
+ if ($requestSubtotal === "" || $requestQuoteId === "" || ((int)$requestSubtotal != (int)$quoteSubtotal) || ($requestQuoteId != $quote->getId())) {
67
+ throw new Jmango360_Japi_Exception(
68
+ Mage::helper('japi')->__('Request info does not match the quote. Probably the cart is ordered or the session is expired.'),
69
+ Jmango360_Japi_Model_Request::HTTP_INTERNAL_ERROR
70
+ );
71
+ }
72
  }
73
 
74
  /**
app/code/community/Jmango360/Japi/Model/Rest/Product/Search.php CHANGED
@@ -33,6 +33,13 @@ class Jmango360_Japi_Model_Rest_Product_Search extends Jmango360_Japi_Model_Rest
33
  }
34
  }
35
 
 
 
 
 
 
 
 
36
  if ($searchHelper->isMinQueryLength()) {
37
  $query->setId(0)
38
  ->setIsActive(1)
33
  }
34
  }
35
 
36
+ /**
37
+ * Support SolrBridge_Solrsearch
38
+ */
39
+ if ($helper->isModuleEnabled('SolrBridge_Solrsearch')) {
40
+ return $helper->getProductCollectionFromSolrBridgeSolrsearch();
41
+ }
42
+
43
  if ($searchHelper->isMinQueryLength()) {
44
  $query->setId(0)
45
  ->setIsActive(1)
app/code/community/Jmango360/Japi/controllers/Adminhtml/Japi/PaymentController.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Copyright 2017 JMango360
5
+ */
6
+ class Jmango360_Japi_Adminhtml_Japi_PaymentController extends Mage_Adminhtml_Controller_Action
7
+ {
8
+ const PAYPAL_SANDBOX_URL = 'https://api.sandbox.paypal.com/v1/oauth2/token';
9
+ const PAYPAL_LIVE_URL = 'https://api.paypal.com/v1/oauth2/token';
10
+
11
+ /**
12
+ * Test Paypal API Credentials
13
+ * Ref: https://developer.paypal.com/docs/integration/direct/make-your-first-call/
14
+ */
15
+ public function testPaypalAction()
16
+ {
17
+ $clientId = $this->getRequest()->getParam('client_id');
18
+ $clientSecret = $this->getRequest()->getParam('client_secret');
19
+ $sandbox = $this->getRequest()->getParam('sandbox', 1);
20
+
21
+ if (!$clientId || !$clientSecret) {
22
+ $data = array(
23
+ 'error' => 1,
24
+ 'message' => $this->__('Authentication credentials not valid')
25
+ );
26
+ } else {
27
+ try {
28
+ /* @var $model Jmango360_Japi_Model_Payment_Paypal */
29
+ $model = Mage::getSingleton('japi/payment_paypal');
30
+ $accessToken = $model->getAccessToken($clientId, $clientSecret, $sandbox);
31
+ if ($accessToken) {
32
+ $data = array(
33
+ 'success' => 1,
34
+ 'message' => 'OK'
35
+ );
36
+ } else {
37
+ $data = array(
38
+ 'error' => 1,
39
+ 'message' => $this->__('Some errors occurred, please try again')
40
+ );
41
+ }
42
+ } catch (Exception $e) {
43
+ $data = array(
44
+ 'error' => 1,
45
+ 'message' => sprintf('[%s] %s', $e->getCode(), $e->getMessage())
46
+ );
47
+ Mage::logException($e);
48
+ }
49
+ }
50
+
51
+ $this->getResponse()->setHeader('Content-Type', 'application/json');
52
+ return $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($data));
53
+ }
54
+
55
+ protected function _getPaypalApiEndpoint($sandbox)
56
+ {
57
+ return $sandbox ? self::PAYPAL_SANDBOX_URL : self::PAYPAL_LIVE_URL;
58
+ }
59
+ }
app/code/community/Jmango360/Japi/controllers/CheckoutController.php CHANGED
@@ -152,6 +152,7 @@ class Jmango360_Japi_CheckoutController extends Mage_Checkout_OnepageController
152
  Mage::app()->getStore()->setConfig('gtspeed/cssjs/min_js', 0);
153
  Mage::app()->getStore()->setConfig('gtspeed/cssjs/merge_js', 0);
154
  Mage::app()->getStore()->setConfig('hsmedia/mediasetting/hsmedia_enabled', 0);
 
155
 
156
  // Freeze cart object
157
  Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
@@ -169,16 +170,25 @@ class Jmango360_Japi_CheckoutController extends Mage_Checkout_OnepageController
169
  */
170
  protected function _updateLayout()
171
  {
172
- /* @var $helper Mage_Core_Helper_Data */
173
- $helper = Mage::helper('core');
174
  $xml = '';
175
 
176
  if ($helper->isModuleEnabled('PostcodeNl_Api')) {
177
- $xml .= "
 
 
 
 
 
 
 
178
  <reference name=\"head\">
179
  <action method=\"addCss\" ifconfig=\"postcodenl_api/config/enabled\"><script>postcodenl/api/css/lookup.css</script></action>
180
  <action method=\"addJs\" ifconfig=\"postcodenl_api/config/enabled\"><script>postcodenl/api/lookup.js</script></action>
181
- </reference>
 
 
182
  <reference name=\"content\">
183
  <block type=\"postcodenl_api/jsinit\" name=\"postcodenl.jsinit\" template=\"postcodenl/api/jsinit.phtml\" />
184
  </reference>";
@@ -468,6 +478,17 @@ class Jmango360_Japi_CheckoutController extends Mage_Checkout_OnepageController
468
  </reference>";
469
  }
470
 
 
 
 
 
 
 
 
 
 
 
 
471
  try {
472
  $this->getLayout()->getUpdate()->addUpdate($xml);
473
  $this->generateLayoutXml()->generateLayoutBlocks();
@@ -486,6 +507,24 @@ class Jmango360_Japi_CheckoutController extends Mage_Checkout_OnepageController
486
  }
487
  }
488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  /**
490
  * Shipping method save action
491
  */
152
  Mage::app()->getStore()->setConfig('gtspeed/cssjs/min_js', 0);
153
  Mage::app()->getStore()->setConfig('gtspeed/cssjs/merge_js', 0);
154
  Mage::app()->getStore()->setConfig('hsmedia/mediasetting/hsmedia_enabled', 0);
155
+ Mage::app()->getStore()->setConfig('aw_mobile2/general/is_enabled', 0);
156
 
157
  // Freeze cart object
158
  Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
170
  */
171
  protected function _updateLayout()
172
  {
173
+ /* @var $helper Jmango360_Japi_Helper_Data */
174
+ $helper = Mage::helper('japi');
175
  $xml = '';
176
 
177
  if ($helper->isModuleEnabled('PostcodeNl_Api')) {
178
+ if (version_compare($helper->getExtensionVersion('PostcodeNl_Api'), '1.1.0', '<')) {
179
+ $xml .= "
180
+ <reference name=\"head\">
181
+ <action method=\"addCss\" ifconfig=\"postcodenl/config/enabled\"><script>postcodenl/api/css/lookup.css</script></action>
182
+ <action method=\"addJs\" ifconfig=\"postcodenl/config/enabled\"><script>postcodenl/api/lookup.js</script></action>
183
+ </reference>";
184
+ } else {
185
+ $xml .= "
186
  <reference name=\"head\">
187
  <action method=\"addCss\" ifconfig=\"postcodenl_api/config/enabled\"><script>postcodenl/api/css/lookup.css</script></action>
188
  <action method=\"addJs\" ifconfig=\"postcodenl_api/config/enabled\"><script>postcodenl/api/lookup.js</script></action>
189
+ </reference>";
190
+ }
191
+ $xml .= "
192
  <reference name=\"content\">
193
  <block type=\"postcodenl_api/jsinit\" name=\"postcodenl.jsinit\" template=\"postcodenl/api/jsinit.phtml\" />
194
  </reference>";
478
  </reference>";
479
  }
480
 
481
+ if ($helper->isModuleEnabled('LaPoste_SoColissimoSimplicite')) {
482
+ $xml .= "
483
+ <reference name=\"head\">
484
+ <action method=\"addItem\"><type>skin_js</type><name>js/socolissimosimplicite/shipping_method.js</name></action>
485
+ </reference>
486
+ <reference name=\"content\">
487
+ <block type=\"japi/socolissimosimplicite_iframe\" name=\"iframe.socolissimosimplicite\" template=\"socolissimosimplicite/iframe.phtml\" after=\"checkout.onepage\" />
488
+ <block type=\"core/template\" name=\"shippingmethod.socolissimosimplicite\" template=\"socolissimosimplicite/onepage/shipping_method/socolissimosimplicite.phtml\" after=\"iframe.socolissimosimplicite\" />
489
+ </reference>";
490
+ }
491
+
492
  try {
493
  $this->getLayout()->getUpdate()->addUpdate($xml);
494
  $this->generateLayoutXml()->generateLayoutBlocks();
507
  }
508
  }
509
 
510
+ /**
511
+ * Save checkout billing address
512
+ */
513
+ public function saveBillingAction()
514
+ {
515
+ Mage::app()->getStore()->setConfig('aw_mobile2/general/is_enabled', 0);
516
+ return parent::saveBillingAction();
517
+ }
518
+
519
+ /**
520
+ * Shipping address save action
521
+ */
522
+ public function saveShippingAction()
523
+ {
524
+ Mage::app()->getStore()->setConfig('aw_mobile2/general/is_enabled', 0);
525
+ return parent::saveShippingAction();
526
+ }
527
+
528
  /**
529
  * Shipping method save action
530
  */
app/code/community/Jmango360/Japi/controllers/Rest/CheckoutController.php CHANGED
@@ -50,4 +50,11 @@ class Jmango360_Japi_Rest_CheckoutController extends Jmango360_Japi_Controller_A
50
  $server->setRestDispatchModel(Mage::getModel('japi/rest_checkout'));
51
  $server->run();
52
  }
 
 
 
 
 
 
 
53
  }
50
  $server->setRestDispatchModel(Mage::getModel('japi/rest_checkout'));
51
  $server->run();
52
  }
53
+
54
+ public function updateOrderAction()
55
+ {
56
+ $server = $this->getServer();
57
+ $server->setRestDispatchModel(Mage::getModel('japi/rest_checkout'));
58
+ $server->run();
59
+ }
60
  }
app/code/community/Jmango360/Japi/etc/config.xml CHANGED
@@ -7,7 +7,7 @@
7
  <config>
8
  <modules>
9
  <Jmango360_Japi>
10
- <version>3.4.1</version>
11
  </Jmango360_Japi>
12
  </modules>
13
 
@@ -93,6 +93,15 @@
93
  </japi_controller_action_predispatch>
94
  </observers>
95
  </controller_action_predispatch>
 
 
 
 
 
 
 
 
 
96
  <controller_action_predispatch_checkout_klarna_success>
97
  <observers>
98
  <vaimo_klarna>
@@ -218,6 +227,15 @@
218
  </klevu_search_landing_page>
219
  </observers>
220
  </controller_action_predispatch_japi_rest_product_search>
 
 
 
 
 
 
 
 
 
221
  </events>
222
  <routers>
223
  <japi>
@@ -332,6 +350,16 @@
332
  </crontab>
333
 
334
  <default>
 
 
 
 
 
 
 
 
 
 
335
  <japi>
336
  <jmango_rest_api>
337
  <apiuser>jmango360</apiuser>
@@ -367,6 +395,20 @@
367
  <ios_scheme></ios_scheme>
368
  <android_scheme></android_scheme>
369
  </jmango_rest_mobile_settings>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  <jmango_rest_gallery_settings>
371
  <image_width>1200</image_width>
372
  <image_height>1200</image_height>
@@ -417,8 +459,10 @@
417
  <api_key_stg></api_key_stg>
418
  <api_key_prod></api_key_prod>
419
  <shared_key></shared_key>
 
420
  <tc></tc>
421
  <rating_label></rating_label>
 
422
  </jmango_rest_bazaarvoice_settings>
423
  <jmango_rest_developer_settings>
424
  <enable>0</enable>
7
  <config>
8
  <modules>
9
  <Jmango360_Japi>
10
+ <version>3.5.0</version>
11
  </Jmango360_Japi>
12
  </modules>
13
 
93
  </japi_controller_action_predispatch>
94
  </observers>
95
  </controller_action_predispatch>
96
+ <controller_response_redirect>
97
+ <observers>
98
+ <japi_controller_response_redirect>
99
+ <type>singleton</type>
100
+ <class>japi/observer</class>
101
+ <method>japiControllerResponseRedirect</method>
102
+ </japi_controller_response_redirect>
103
+ </observers>
104
+ </controller_response_redirect>
105
  <controller_action_predispatch_checkout_klarna_success>
106
  <observers>
107
  <vaimo_klarna>
227
  </klevu_search_landing_page>
228
  </observers>
229
  </controller_action_predispatch_japi_rest_product_search>
230
+ <sales_model_service_quote_submit_before>
231
+ <observers>
232
+ <japi_sales_model_service_quote_submit_before>
233
+ <type>singleton</type>
234
+ <class>japi/observer</class>
235
+ <method>japiSalesModelServiceQuoteSubmitBefore</method>
236
+ </japi_sales_model_service_quote_submit_before>
237
+ </observers>
238
+ </sales_model_service_quote_submit_before>
239
  </events>
240
  <routers>
241
  <japi>
350
  </crontab>
351
 
352
  <default>
353
+ <payment>
354
+ <jmango_payment>
355
+ <active>1</active>
356
+ <model>japi/payment</model>
357
+ <order_status>pending</order_status>
358
+ <title>JMango360 Native Payment</title>
359
+ <allowspecific>0</allowspecific>
360
+ <payment_action>sale</payment_action>
361
+ </jmango_payment>
362
+ </payment>
363
  <japi>
364
  <jmango_rest_api>
365
  <apiuser>jmango360</apiuser>
395
  <ios_scheme></ios_scheme>
396
  <android_scheme></android_scheme>
397
  </jmango_rest_mobile_settings>
398
+ <jmango_rest_braintree_settings>
399
+ <enable>0</enable>
400
+ <label></label>
401
+ <sandbox_label></sandbox_label>
402
+ <sandbox>1</sandbox>
403
+ <merchant_account_id></merchant_account_id>
404
+ <merchant_id></merchant_id>
405
+ <public_key></public_key>
406
+ <private_key></private_key>
407
+ <sandbox_merchant_account_id></sandbox_merchant_account_id>
408
+ <sandbox_merchant_id></sandbox_merchant_id>
409
+ <sandbox_public_key></sandbox_public_key>
410
+ <sandbox_private_key></sandbox_private_key>
411
+ </jmango_rest_braintree_settings>
412
  <jmango_rest_gallery_settings>
413
  <image_width>1200</image_width>
414
  <image_height>1200</image_height>
459
  <api_key_stg></api_key_stg>
460
  <api_key_prod></api_key_prod>
461
  <shared_key></shared_key>
462
+ <client_label></client_label>
463
  <tc></tc>
464
  <rating_label></rating_label>
465
+ <displaycode></displaycode>
466
  </jmango_rest_bazaarvoice_settings>
467
  <jmango_rest_developer_settings>
468
  <enable>0</enable>
app/code/community/Jmango360/Japi/etc/system.xml CHANGED
@@ -285,7 +285,7 @@
285
  <can_be_empty>1</can_be_empty>
286
  <comment></comment>
287
  </enable_coupon-->
288
- <coupon_code translate="label comment" module="japi">
289
  <label>Pre-fill coupon code</label>
290
  <frontend_type>text</frontend_type>
291
  <sort_order>60</sort_order>
@@ -294,7 +294,7 @@
294
  <show_in_store>1</show_in_store>
295
  <can_be_empty>1</can_be_empty>
296
  <comment>This code will automatically fill the coupon field on JMango360 Checkout page</comment>
297
- </coupon_code>
298
  </fields>
299
  </jmango_rest_checkout_settings>
300
  <!--jmango_rest_mobile_settings translate="label" module="japi">
@@ -324,6 +324,225 @@
324
  </android_scheme>
325
  </fields>
326
  </jmango_rest_mobile_settings-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  <!--jmango_rest_gallery_settings translate="label" module="japi">
328
  <label>Product image gallery settings</label>
329
  <show_in_default>1</show_in_default>
@@ -797,6 +1016,18 @@
797
  <enable>1</enable>
798
  </depends>
799
  </shared_key>
 
 
 
 
 
 
 
 
 
 
 
 
800
  <tc translate="label comment" module="japi">
801
  <label><![CDATA[Terms & Conditions]]></label>
802
  <frontend_type>textarea</frontend_type>
@@ -821,6 +1052,18 @@
821
  <enable>1</enable>
822
  </depends>
823
  </rating_label>
 
 
 
 
 
 
 
 
 
 
 
 
824
  </fields>
825
  </jmango_rest_bazaarvoice_settings>
826
  <jmango_rest_developer_settings translate="label" module="japi">
285
  <can_be_empty>1</can_be_empty>
286
  <comment></comment>
287
  </enable_coupon-->
288
+ <!--coupon_code translate="label comment" module="japi">
289
  <label>Pre-fill coupon code</label>
290
  <frontend_type>text</frontend_type>
291
  <sort_order>60</sort_order>
294
  <show_in_store>1</show_in_store>
295
  <can_be_empty>1</can_be_empty>
296
  <comment>This code will automatically fill the coupon field on JMango360 Checkout page</comment>
297
+ </coupon_code-->
298
  </fields>
299
  </jmango_rest_checkout_settings>
300
  <!--jmango_rest_mobile_settings translate="label" module="japi">
324
  </android_scheme>
325
  </fields>
326
  </jmango_rest_mobile_settings-->
327
+ <!--jmango_rest_paypal_settings translate="label" module="japi">
328
+ <label>JMango360 Paypal Settings</label>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ <show_in_store>1</show_in_store>
332
+ <sort_order>45</sort_order>
333
+ <fields>
334
+ <enable translate="label comment" module="japi">
335
+ <label>Enable this Solution</label>
336
+ <frontend_type>select</frontend_type>
337
+ <source_model>adminhtml/system_config_source_yesno</source_model>
338
+ <sort_order>10</sort_order>
339
+ <show_in_default>1</show_in_default>
340
+ <show_in_website>1</show_in_website>
341
+ <show_in_store>1</show_in_store>
342
+ <comment></comment>
343
+ </enable>
344
+ <client_id translate="label comment" module="japi">
345
+ <label>Client ID</label>
346
+ <frontend_type>password</frontend_type>
347
+ <sort_order>20</sort_order>
348
+ <show_in_default>1</show_in_default>
349
+ <show_in_website>1</show_in_website>
350
+ <show_in_store>1</show_in_store>
351
+ <comment></comment>
352
+ </client_id>
353
+ <client_secret translate="label comment" module="japi">
354
+ <label>Client Secret</label>
355
+ <frontend_type>password</frontend_type>
356
+ <sort_order>30</sort_order>
357
+ <show_in_default>1</show_in_default>
358
+ <show_in_website>1</show_in_website>
359
+ <show_in_store>1</show_in_store>
360
+ <comment></comment>
361
+ </client_secret>
362
+ <test_api_btn translate="label comment" module="japi">
363
+ <label></label>
364
+ <frontend_type>button</frontend_type>
365
+ <frontend_model>japi/adminhtml_system_config_form_button_paypal</frontend_model>
366
+ <sort_order>50</sort_order>
367
+ <show_in_default>1</show_in_default>
368
+ <show_in_website>1</show_in_website>
369
+ <show_in_store>1</show_in_store>
370
+ <comment></comment>
371
+ </test_api_btn>
372
+ <sandbox translate="label comment" module="japi">
373
+ <label>Sandbox Mode</label>
374
+ <frontend_type>select</frontend_type>
375
+ <source_model>adminhtml/system_config_source_yesno</source_model>
376
+ <sort_order>60</sort_order>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>1</show_in_store>
380
+ <comment></comment>
381
+ </sandbox>
382
+ </fields>
383
+ </jmango_rest_paypal_settings-->
384
+ <!--jmango_rest_braintree_settings translate="label" module="japi">
385
+ <label>JMango360 Braintree Settings</label>
386
+ <show_in_default>1</show_in_default>
387
+ <show_in_website>1</show_in_website>
388
+ <show_in_store>1</show_in_store>
389
+ <sort_order>46</sort_order>
390
+ <fields>
391
+ <enable translate="label comment" module="japi">
392
+ <label>Enable this solution</label>
393
+ <frontend_type>select</frontend_type>
394
+ <source_model>adminhtml/system_config_source_yesno</source_model>
395
+ <sort_order>10</sort_order>
396
+ <show_in_default>1</show_in_default>
397
+ <show_in_website>1</show_in_website>
398
+ <show_in_store>1</show_in_store>
399
+ <comment></comment>
400
+ </enable>
401
+ <sandbox translate="label comment" module="japi">
402
+ <label>Sandbox Mode</label>
403
+ <frontend_type>select</frontend_type>
404
+ <source_model>adminhtml/system_config_source_yesno</source_model>
405
+ <sort_order>20</sort_order>
406
+ <show_in_default>1</show_in_default>
407
+ <show_in_website>1</show_in_website>
408
+ <show_in_store>1</show_in_store>
409
+ <comment></comment>
410
+ <depends>
411
+ <enable>1</enable>
412
+ </depends>
413
+ </sandbox>
414
+ <sandbox_label translate="label comment" module="japi">
415
+ <label>Sandbox Label</label>
416
+ <frontend_type>text</frontend_type>
417
+ <sort_order>30</sort_order>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>1</show_in_store>
421
+ <comment></comment>
422
+ <depends>
423
+ <enable>1</enable>
424
+ <sandbox>1</sandbox>
425
+ </depends>
426
+ </sandbox_label>
427
+ <sandbox_merchant_account_id translate="label comment" module="japi">
428
+ <label>Sandbox Merchant Account ID</label>
429
+ <frontend_type>text</frontend_type>
430
+ <sort_order>40</sort_order>
431
+ <show_in_default>1</show_in_default>
432
+ <show_in_website>1</show_in_website>
433
+ <show_in_store>1</show_in_store>
434
+ <comment></comment>
435
+ <depends>
436
+ <enable>1</enable>
437
+ <sandbox>1</sandbox>
438
+ </depends>
439
+ </sandbox_merchant_account_id>
440
+ <sandbox_merchant_id translate="label comment" module="japi">
441
+ <label>Sandbox Merchant ID</label>
442
+ <frontend_type>text</frontend_type>
443
+ <sort_order>50</sort_order>
444
+ <show_in_default>1</show_in_default>
445
+ <show_in_website>1</show_in_website>
446
+ <show_in_store>1</show_in_store>
447
+ <comment></comment>
448
+ <depends>
449
+ <enable>1</enable>
450
+ <sandbox>1</sandbox>
451
+ </depends>
452
+ </sandbox_merchant_id>
453
+ <sandbox_public_key translate="label comment" module="japi">
454
+ <label>Sandbox Public Key</label>
455
+ <frontend_type>password</frontend_type>
456
+ <sort_order>60</sort_order>
457
+ <show_in_default>1</show_in_default>
458
+ <show_in_website>1</show_in_website>
459
+ <show_in_store>1</show_in_store>
460
+ <comment></comment>
461
+ <depends>
462
+ <enable>1</enable>
463
+ <sandbox>1</sandbox>
464
+ </depends>
465
+ </sandbox_public_key>
466
+ <sandbox_private_key translate="label comment" module="japi">
467
+ <label>Sandbox Private Key</label>
468
+ <frontend_type>password</frontend_type>
469
+ <sort_order>70</sort_order>
470
+ <show_in_default>1</show_in_default>
471
+ <show_in_website>1</show_in_website>
472
+ <show_in_store>1</show_in_store>
473
+ <comment></comment>
474
+ <depends>
475
+ <enable>1</enable>
476
+ <sandbox>1</sandbox>
477
+ </depends>
478
+ </sandbox_private_key>
479
+ <label translate="label comment" module="japi">
480
+ <label>Label</label>
481
+ <frontend_type>text</frontend_type>
482
+ <sort_order>80</sort_order>
483
+ <show_in_default>1</show_in_default>
484
+ <show_in_website>1</show_in_website>
485
+ <show_in_store>1</show_in_store>
486
+ <comment></comment>
487
+ <depends>
488
+ <enable>1</enable>
489
+ <sandbox>0</sandbox>
490
+ </depends>
491
+ </label>
492
+ <merchant_account_id translate="label comment" module="japi">
493
+ <label>Merchant Account ID</label>
494
+ <frontend_type>text</frontend_type>
495
+ <sort_order>90</sort_order>
496
+ <show_in_default>1</show_in_default>
497
+ <show_in_website>1</show_in_website>
498
+ <show_in_store>1</show_in_store>
499
+ <comment></comment>
500
+ <depends>
501
+ <enable>1</enable>
502
+ <sandbox>0</sandbox>
503
+ </depends>
504
+ </merchant_account_id>
505
+ <merchant_id translate="label comment" module="japi">
506
+ <label>Merchant ID</label>
507
+ <frontend_type>text</frontend_type>
508
+ <sort_order>100</sort_order>
509
+ <show_in_default>1</show_in_default>
510
+ <show_in_website>1</show_in_website>
511
+ <show_in_store>1</show_in_store>
512
+ <comment></comment>
513
+ <depends>
514
+ <enable>1</enable>
515
+ <sandbox>0</sandbox>
516
+ </depends>
517
+ </merchant_id>
518
+ <public_key translate="label comment" module="japi">
519
+ <label>Public Key</label>
520
+ <frontend_type>password</frontend_type>
521
+ <sort_order>110</sort_order>
522
+ <show_in_default>1</show_in_default>
523
+ <show_in_website>1</show_in_website>
524
+ <show_in_store>1</show_in_store>
525
+ <comment></comment>
526
+ <depends>
527
+ <enable>1</enable>
528
+ <sandbox>0</sandbox>
529
+ </depends>
530
+ </public_key>
531
+ <private_key translate="label comment" module="japi">
532
+ <label>Private Key</label>
533
+ <frontend_type>password</frontend_type>
534
+ <sort_order>120</sort_order>
535
+ <show_in_default>1</show_in_default>
536
+ <show_in_website>1</show_in_website>
537
+ <show_in_store>1</show_in_store>
538
+ <comment></comment>
539
+ <depends>
540
+ <enable>1</enable>
541
+ <sandbox>0</sandbox>
542
+ </depends>
543
+ </private_key>
544
+ </fields>
545
+ </jmango_rest_braintree_settings-->
546
  <!--jmango_rest_gallery_settings translate="label" module="japi">
547
  <label>Product image gallery settings</label>
548
  <show_in_default>1</show_in_default>
1016
  <enable>1</enable>
1017
  </depends>
1018
  </shared_key>
1019
+ <displaycode translate="label comment" module="japi">
1020
+ <label><![CDATA[Deployment zone]]></label>
1021
+ <frontend_type>text</frontend_type>
1022
+ <sort_order>32</sort_order>
1023
+ <show_in_default>1</show_in_default>
1024
+ <show_in_website>1</show_in_website>
1025
+ <show_in_store>1</show_in_store>
1026
+ <comment></comment>
1027
+ <depends>
1028
+ <enable>1</enable>
1029
+ </depends>
1030
+ </displaycode>
1031
  <tc translate="label comment" module="japi">
1032
  <label><![CDATA[Terms & Conditions]]></label>
1033
  <frontend_type>textarea</frontend_type>
1052
  <enable>1</enable>
1053
  </depends>
1054
  </rating_label>
1055
+ <client_label translate="label comment" module="japi">
1056
+ <label><![CDATA[Client Lables]]></label>
1057
+ <frontend_type>textarea</frontend_type>
1058
+ <sort_order>60</sort_order>
1059
+ <show_in_default>1</show_in_default>
1060
+ <show_in_website>1</show_in_website>
1061
+ <show_in_store>1</show_in_store>
1062
+ <comment>Example: blokker|blokker.nl</comment>
1063
+ <depends>
1064
+ <enable>1</enable>
1065
+ </depends>
1066
+ </client_label>
1067
  </fields>
1068
  </jmango_rest_bazaarvoice_settings>
1069
  <jmango_rest_developer_settings translate="label" module="japi">
app/design/adminhtml/default/default/template/japi/system/config/form/button/paypal.phtml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright 2017 JMango360
4
+ */
5
+ ?>
6
+ <?php /* @var $this Jmango360_Japi_Block_Adminhtml_System_Config_Form_Button_Paypal */ ?>
7
+ <?php echo $this->getButtonHtml() ?>
8
+ <div id="japi-paypal-test-result-failed"></div>
9
+ <div id="japi-paypal-test-result-ok"></div>
10
+ <style type="text/css">
11
+ #japi-paypal-test-result-failed {
12
+ color: red;
13
+ padding: 5px 0 0;
14
+ }
15
+
16
+ #japi-paypal-test-result-ok {
17
+ color: green;
18
+ padding: 5px 0 0;
19
+ }
20
+ </style>
21
+ <script type="text/javascript">
22
+ function japiPaypalTestAPICredentials() {
23
+ var textFailed = $('japi-paypal-test-result-failed');
24
+ var textOk = $('japi-paypal-test-result-ok');
25
+ new Ajax.Request('<?php echo $this->getUrl('adminhtml/japi_payment/testPaypal') ?>', {
26
+ parameters: {
27
+ client_id: $('japi_jmango_rest_paypal_settings_client_id').getValue(),
28
+ client_secret: $('japi_jmango_rest_paypal_settings_client_secret').getValue(),
29
+ sandbox: $('japi_jmango_rest_paypal_settings_sandbox').getValue()
30
+ },
31
+ onSuccess: function (transport) {
32
+ textFailed.innerHTML = '';
33
+ textOk.innerHTML = '';
34
+ if (transport.responseText.isJSON()) {
35
+ var response = transport.responseText.evalJSON();
36
+ if (response.error) {
37
+ if (response.message) textFailed.innerHTML = response.message;
38
+ }
39
+ if (response.success) {
40
+ if (response.message) textOk.innerHTML = response.message;
41
+ }
42
+ }
43
+ }
44
+ })
45
+ }
46
+ </script>
app/design/frontend/base/default/layout/jmango360_japi.xml CHANGED
@@ -44,7 +44,7 @@
44
  <action method="addItem"><type>skin_js</type><file>japi/lib/bootstrap/js/modal.js</file></action>
45
  <action method="addItem"><type>skin_js</type><file>japi/lib/scrollto/scrollTo.js</file></action>
46
  <action method="addItem"><type>skin_js</type><file>js/opcheckout.js</file></action>
47
- <action method="addItem"><type>skin_js</type><file>japi/js/checkout.js?v=3.2.0</file></action>
48
  </block>
49
  <block type="core/text_list" name="after_body_start" as="after_body_start" translate="label">
50
  <label>Page Top</label>
44
  <action method="addItem"><type>skin_js</type><file>japi/lib/bootstrap/js/modal.js</file></action>
45
  <action method="addItem"><type>skin_js</type><file>japi/lib/scrollto/scrollTo.js</file></action>
46
  <action method="addItem"><type>skin_js</type><file>js/opcheckout.js</file></action>
47
+ <action method="addItem"><type>skin_js</type><file>japi/js/checkout.js?v=3.5.0</file></action>
48
  </block>
49
  <block type="core/text_list" name="after_body_start" as="after_body_start" translate="label">
50
  <label>Page Top</label>
app/design/frontend/base/default/template/japi/TIG/PostNL/av/checkout/onepage/billing.phtml CHANGED
@@ -181,6 +181,7 @@
181
  <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
182
  </span>
183
  </div>
 
184
  </fieldset>
185
  </form>
186
  <script type="text/javascript">
181
  <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
182
  </span>
183
  </div>
184
+ <?php echo $this->getBlockHtml('formkey') ?>
185
  </fieldset>
186
  </form>
187
  <script type="text/javascript">
app/design/frontend/base/default/template/japi/TIG/PostNL/av/checkout/onepage/shipping.phtml CHANGED
@@ -163,6 +163,7 @@
163
  <span><span><?php echo $this->__('Continue') ?></span></span>
164
  </button>
165
  </div>
 
166
  </form>
167
  <script type="text/javascript">
168
  //<![CDATA[
163
  <span><span><?php echo $this->__('Continue') ?></span></span>
164
  </button>
165
  </div>
166
+ <?php echo $this->getBlockHtml('formkey') ?>
167
  </form>
168
  <script type="text/javascript">
169
  //<![CDATA[
app/design/frontend/base/default/template/japi/checkout/onepage.phtml CHANGED
@@ -81,6 +81,10 @@
81
  document.observe("dom:loaded", function () {
82
  checkout.gotoSection('shipping');
83
  });
 
 
 
 
84
  <?php endif ?>
85
  <?php endif ?>
86
  //]]>
81
  document.observe("dom:loaded", function () {
82
  checkout.gotoSection('shipping');
83
  });
84
+ <?php elseif ($this->getActiveStep()): ?>
85
+ document.observe("dom:loaded", function () {
86
+ checkout.gotoSection('<?php echo $this->getActiveStep() ?>');
87
+ });
88
  <?php endif ?>
89
  <?php endif ?>
90
  //]]>
app/design/frontend/base/default/template/japi/checkout/onepage/billing.phtml CHANGED
@@ -41,7 +41,7 @@
41
  <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>"
42
  id="billing:address_id"/>
43
  <ul>
44
- <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
45
  <li class="fields">
46
  <div class="field">
47
  <label for="billing:company"><?php echo $this->__('Company') ?></label>
@@ -269,7 +269,7 @@
269
  </div>
270
  </div>
271
  </li>
272
- <?php if (!$this->isCustomerLoggedIn()): ?>
273
 
274
  <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
275
  <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
@@ -321,6 +321,7 @@
321
  </div>
322
  </li>
323
  <?php endif; ?>
 
324
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
325
  <li class="control">
326
  <input type="checkbox" name="billing[save_in_address_book]" value="1"
@@ -335,6 +336,7 @@
335
  <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1"/>
336
  </li>
337
  <?php endif; ?>
 
338
  <?php echo $this->getChildHtml('form.additional.info'); ?>
339
  </ul>
340
  </fieldset>
@@ -370,6 +372,7 @@
370
  <span class="ladda-label"><?php echo $this->__('Continue') ?></span>
371
  </button>
372
  </div>
 
373
  </fieldset>
374
  </form>
375
  <script type="text/javascript">
41
  <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>"
42
  id="billing:address_id"/>
43
  <ul>
44
+ <li class="fields"><?php echo $this->getLayout()->createBlock('japi/customer_widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
45
  <li class="fields">
46
  <div class="field">
47
  <label for="billing:company"><?php echo $this->__('Company') ?></label>
269
  </div>
270
  </div>
271
  </li>
272
+ <?php if (!$this->isCustomerLoggedIn() || strpos(Mage::getUrl(), 'bloomfashion.nl') !== false): ?>
273
 
274
  <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
275
  <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
321
  </div>
322
  </li>
323
  <?php endif; ?>
324
+
325
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
326
  <li class="control">
327
  <input type="checkbox" name="billing[save_in_address_book]" value="1"
336
  <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1"/>
337
  </li>
338
  <?php endif; ?>
339
+
340
  <?php echo $this->getChildHtml('form.additional.info'); ?>
341
  </ul>
342
  </fieldset>
372
  <span class="ladda-label"><?php echo $this->__('Continue') ?></span>
373
  </button>
374
  </div>
375
+ <?php echo $this->getBlockHtml('formkey') ?>
376
  </fieldset>
377
  </form>
378
  <script type="text/javascript">
app/design/frontend/base/default/template/japi/checkout/onepage/payment.phtml CHANGED
@@ -45,6 +45,7 @@ $helper = Mage::helper('japi');
45
  <?php if ($helper->wrapPaymentBlockMethods()): ?>
46
  </dl>
47
  <?php endif; ?>
 
48
  </fieldset>
49
  </form>
50
  <div class="buttons-set" id="payment-buttons-container">
45
  <?php if ($helper->wrapPaymentBlockMethods()): ?>
46
  </dl>
47
  <?php endif; ?>
48
+ <?php echo $this->getBlockHtml('formkey') ?>
49
  </fieldset>
50
  </form>
51
  <div class="buttons-set" id="payment-buttons-container">
app/design/frontend/base/default/template/japi/checkout/onepage/shipping.phtml CHANGED
@@ -40,7 +40,7 @@
40
  <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>"
41
  id="shipping:address_id"/>
42
  <ul>
43
- <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
44
  <li class="fields">
45
  <div class="fields">
46
  <label for="shipping:company"><?php echo $this->__('Company') ?></label>
@@ -243,6 +243,7 @@
243
  class="v-middle"/> <?php echo $this->__('Loading next step...') ?>
244
  </span>
245
  </div>
 
246
  </form>
247
  <script type="text/javascript">
248
  //<![CDATA[
40
  <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>"
41
  id="shipping:address_id"/>
42
  <ul>
43
+ <li class="fields"><?php echo $this->getLayout()->createBlock('japi/customer_widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
44
  <li class="fields">
45
  <div class="fields">
46
  <label for="shipping:company"><?php echo $this->__('Company') ?></label>
243
  class="v-middle"/> <?php echo $this->__('Loading next step...') ?>
244
  </span>
245
  </div>
246
+ <?php echo $this->getBlockHtml('formkey') ?>
247
  </form>
248
  <script type="text/javascript">
249
  //<![CDATA[
app/design/frontend/base/default/template/japi/checkout/onepage/shipping_method.phtml CHANGED
@@ -75,4 +75,5 @@
75
  <span class="ladda-label"><?php echo $this->__('Continue') ?></span>
76
  </button>
77
  </div>
 
78
  </form>
75
  <span class="ladda-label"><?php echo $this->__('Continue') ?></span>
76
  </button>
77
  </div>
78
+ <?php echo $this->getBlockHtml('formkey') ?>
79
  </form>
app/design/frontend/base/default/template/japi/checkout/onepage/style.phtml CHANGED
@@ -19,7 +19,7 @@ $customCss = Mage::getStoreConfig('japi/jmango_rest_checkout_settings/custom_css
19
  $TIGPostNLVersion = Mage::helper('japi')->getExtensionVersion('TIG_PostNL');
20
  ?>
21
  <link type="text/css" rel="stylesheet" media="all"
22
- href="<?php echo $this->getSkinUrl('japi/css/style.css?v=3.3.2') ?>"/>
23
 
24
  <?php if (Mage::helper('japi')->isModuleEnabled('GoMage_Checkout')): ?>
25
  <link type="text/css" rel="stylesheet" media="all"
19
  $TIGPostNLVersion = Mage::helper('japi')->getExtensionVersion('TIG_PostNL');
20
  ?>
21
  <link type="text/css" rel="stylesheet" media="all"
22
+ href="<?php echo $this->getSkinUrl('japi/css/style.css?v=3.5.0') ?>"/>
23
 
24
  <?php if (Mage::helper('japi')->isModuleEnabled('GoMage_Checkout')): ?>
25
  <link type="text/css" rel="stylesheet" media="all"
app/design/frontend/base/default/template/japi/kega_checkout/onepage/payment.phtml CHANGED
@@ -27,6 +27,7 @@
27
  <div class="fieldset" id="checkout-payment-method-load">
28
  <?php echo $this->getChildChildHtml('methods_additional', '', true, true) ?>
29
  <?php echo $this->getChildHtml('methods') ?>
 
30
  </div>
31
  </form>
32
  <div class="tool-tip" id="payment-tool-tip" style="display:none;">
27
  <div class="fieldset" id="checkout-payment-method-load">
28
  <?php echo $this->getChildChildHtml('methods_additional', '', true, true) ?>
29
  <?php echo $this->getChildHtml('methods') ?>
30
+ <?php echo $this->getBlockHtml('formkey') ?>
31
  </div>
32
  </form>
33
  <div class="tool-tip" id="payment-tool-tip" style="display:none;">
app/design/frontend/base/default/template/japi/symfony/postcode/checkout/onepage/billing.phtml CHANGED
@@ -214,6 +214,7 @@
214
  <div class="buttons-set" id="billing-buttons-container">
215
  <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
216
  </div>
 
217
  </fieldset>
218
  </form>
219
  <script type="text/javascript">
214
  <div class="buttons-set" id="billing-buttons-container">
215
  <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
216
  </div>
217
+ <?php echo $this->getBlockHtml('formkey') ?>
218
  </fieldset>
219
  </form>
220
  <script type="text/javascript">
app/design/frontend/base/default/template/japi/symfony/postcode/checkout/onepage/shipping.phtml CHANGED
@@ -152,6 +152,7 @@
152
  <div class="buttons-set" id="shipping-buttons-container">
153
  <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
154
  </div>
 
155
  </form>
156
  <script type="text/javascript">
157
  //<![CDATA[
152
  <div class="buttons-set" id="shipping-buttons-container">
153
  <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
154
  </div>
155
+ <?php echo $this->getBlockHtml('formkey') ?>
156
  </form>
157
  <script type="text/javascript">
158
  //<![CDATA[
app/locale/de_DE/Jmango360_Japi.csv CHANGED
@@ -249,3 +249,4 @@
249
  "Choose to use direction here instead of mobile default sort direction.","Choose to use direction here instead of mobile default sort direction."
250
  "Re-run SQL upgrade","Neu-start SQL Upgrade"
251
  "Re-run successfully.","Neu-start erfolgreich."
 
249
  "Choose to use direction here instead of mobile default sort direction.","Choose to use direction here instead of mobile default sort direction."
250
  "Re-run SQL upgrade","Neu-start SQL Upgrade"
251
  "Re-run successfully.","Neu-start erfolgreich."
252
+ "Back to app","Terug naar de app"
app/locale/el_GR/Jmango360_Japi.csv ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ "Connection credentials","Διαπιστευτήρια σύνδεσης"
3
+ "This account is not confirmed. <a href='%s'>Click here</a> to resend confirmation email.","Αυτός ο λογαριασμός δεν έχει επαληθευτεί. <a href='%s'>Κλικ εδώ</a> για αποστολή νέου email επιβεβαίωσης."
4
+ "Customer is already logged in.","Ο πελάτης είναι ήδη συνδεδεμένος."
5
+ "Could not login","Could not login"
6
+ "Login and password are required.","Απαιτείται σύνδεση και κωδικός πρόσβασης."
7
+ "Account is created. Please check email to confirm.","Δημιουργήθηκε λογαριασμός. Παρακαλούμε ελέγξτε τα email σας για επαλήθευση."
8
+ "Invalid Exception code '%d'", "Κωδικός Μη Έγκυρης Εξαίρεσης '%d'"
9
+ "Order List", "Λίστα Παραγγελιών"
10
+ "Order #", "Παραγγελία #"
11
+ "Order Date", "Ημερομηνία Παραγγελίας"
12
+ "Billing Country", "Billing Country"
13
+ "Shipping Country", "Shipping Country"
14
+ "Qty. Ordered", "Ποσότητα σε παραγγελία"
15
+ "Subtotal", "Μερικό σύνολο"
16
+ "Total", "Σύνολο"
17
+ "Invoiced", "Τιμολογημένο"
18
+ "Status", "Κατάσταση"
19
+ "Action", "Ενέργεια"
20
+ "View", "Προβολή"
21
+ "Show Report", "Προβολή Αναφοράς"
22
+ "Total Customers from JMango360 Report", "Αναφορά JMango360 – Συνολικός αριθμός εγγεγραμμένων πελατών"
23
+ "JMango360 Report - Total number of registered customers","Αναφορά JMango360 – Συνολικός αριθμός εγγεγραμμένων πελατών"
24
+ "Total Ordered from JMango360 Report", "Αναφορά JMango360 – συνολικός αριθμός παραγγελιών"
25
+ "JMango360 Report - Total number of orders","Αναφορά JMango360 – συνολικός αριθμός παραγγελιών"
26
+ "Total Sales from JMango360 Report", "Αναφορά JMango360 – συνολικός αριθμός πωλήσεων"
27
+ "JMango360 Report - Total number of sales","Αναφορά JMango360 – συνολικός αριθμός πωλήσεων"
28
+ "Chart", "Διάγραμμα"
29
+ "Period", "Περίοδος"
30
+ "Customers", "Πελάτες"
31
+ "Orders", "Παραγγελίες"
32
+ "Order From", "Παραγγελία Από"
33
+ "JMango360 User", "Χρήστης JMango360"
34
+ "Download", "Λήψη"
35
+ "Clear", "Καθαρισμός"
36
+ "No", "Όχι"
37
+ "Yes", "Ναι"
38
+ "Invalid token", "Μη έγκυρο πιστοποιητικό διασύνδεσης"
39
+ "Session expired.", "Έληξε η περίοδος διασύνδεσης."
40
+ "No rest model found.", "Δεν βρέθηκε το μοντέλο REST."
41
+ "Resource method not implemented", "Δεν εφαρμόστηκε η μέθοδος πόρων"
42
+ "Minimum order amount is %s", "Το ελάχιστο ποσό παραγγελίας είναι %s"
43
+ "Guest checkout is not enabled", "Δεν είναι ενεργοποιημένη η ολοκλήρωση παραγγελίας από επισκέπτη"
44
+ "Product ID invalid", "Μη έγκυρος Κωδικός Προϊόντος"
45
+ "Something is wrong with the order.", "Κάτι πήγε στραβά με την παραγγελία."
46
+ "Something is wrong with the quote or order.", "Κάτι πήγε στραβά με την προσφορά ή με την παραγγελία."
47
+ "Cart is empty.", "Το καλάθι είναι άδειο."
48
+ "Multishipping not implemented yet.", "Δεν έχει ακόμη γίνει εφαρμογή δυνατότητας πολλαπλών αποστολών."
49
+ "Checkout method not implemented yet: ", "Δεν έχει ακόμη γίνει εφαρμογή της μεθόδου ολοκλήρωσης παραγγελίας: "
50
+ "Could not log-out customer", "Δεν είναι δυνατή η αποσύνδεση πελάτη"
51
+ "Please login.", "Παρακαλούμε συνδεθείτε."
52
+ "Country code cannot be empty", "Ο κωδικός χώρας δεν μπορεί να είναι κενός"
53
+ "Country does not exist: ", "Δεν υπάρχει αυτή η χώρα: "
54
+ "Country does not exist", "Δεν υπάρχει αυτή η χώρα"
55
+ "Store not found", "Δεν βρέθηκε το κατάστημα"
56
+ "Not allowed.", "Δεν επιτρέπεται."
57
+ "Product not found", "Δεν βρέθηκε το προϊόν"
58
+ "Please login first!", "Παρακαλούμε συνδεθείτε πρώτα!"
59
+ "Cannot specify product.", "Δεν μπορεί να προσδιοριστεί το προϊόν."
60
+ "Item not found", "Δεν βρέθηκε το προϊόν"
61
+ "%1$s has been updated in your wishlist.", "%1$s έχει ενημερωθεί στη λίστα επιθυμητών."
62
+ "An error occurred while updating your wishlist.", "Παρουσιάστηκε κάποιο σφάλμα κατά την ενημέρωση των επιθυμητών."
63
+ "Cannot specify your wishlist item.", "Δεν μπορεί να προσδιοριστεί το επιθυμητό προϊόν."
64
+ "The product does not exist.", "Το προϊόν δεν υπάρχει."
65
+ "Wishlist item removed", "Το επιθυμητό προϊόν έχει αφαιρεθεί"
66
+ "An error occurred while deleting the item from wishlist: %s", "Παρουσιάστηκε κάποιο σφάλμα κατά τη διαγραφή του προϊόντος από τη λίστα επιθυμητών: %s"
67
+ "An error occurred while deleting the item from wishlist.", "Παρουσιάστηκε κάποιο σφάλμα κατά τη διαγραφή του προϊόντος από τη λίστα επιθυμητών."
68
+ "Can't save description %s", "Δεν είναι δυνατή η αποθήκευση της περιγραφής %s"
69
+ "Can't delete item from wishlist", "Δεν είναι δυνατή η διαγραφή από τη λίστα επιθυμητών"
70
+ "Can't save qty %s", "Δεν είναι δυνατή η αποθήκευση ποσότητας %s"
71
+ "Wishlist updated successfully", "Η λίστα επιθυμητών ενημερώθηκε επιτυχώς"
72
+ "Can't update wishlist", "Δεν είναι δυνατή η ενημέρωση της λίστας επιθυμητών"
73
+ "No item updated", "Δεν ενημερώθηκε κανέναν προϊόν"
74
+ "Cannot specify product", "Δεν είναι δυνατός ο προσδιορισμός του προϊόντος"
75
+ "%s has been added to your wishlist.", "%s προστέθηκε στη λίστα επιθυμητών."
76
+ "An error occurred while adding item to your wishlist: %s", "Παρουσιάστηκε κάποιο σφάλμα κατά την προσθήκη του προϊόντος στη λίστα επιθυμητών: %s"
77
+ "An error occurred while adding item to your wishlist", "Παρουσιάστηκε κάποιο σφάλμα κατά την προσθήκη του προϊόντος στη λίστα επιθυμητών"
78
+ "Wishlist not allowed", "Δεν επιτρέπεται η λίστα επιθυμητών"
79
+ "Wishlist doesn't exist", "Η λίστα επιθυμητών δεν υπάρχει"
80
+ "Customer not logged in", "Ο πελάτης δεν έχει συνδεθεί"
81
+ "Coupon is not valid: ", "Το κουπόνι δεν είναι έγκυρο: "
82
+ "Coupon could not be applied.", "Το κουπόνι δεν μπορεί να εφαρμοστεί."
83
+ "%s: Minimum quantity allowed for purchase is %s.", "%s: Η ελάχιστη δυνατή ποσότητα αγοράς είναι %s."
84
+ "%s: Maximum quantity allowed for purchase is %s.", "%s: Η μέγιστη δυνατή ποσότητα αγοράς είναι %s."
85
+ "%s was added to your shopping cart.", "%s προστέθηκε στο καλάθι αγορών σας."
86
+ "No cart data found.", "Δεν βρέθηκαν δεδομένα στο καλάθι."
87
+ "Your shopping cart has been updated.", "Το καλάθι αγορών σας έχει ενημερωθεί."
88
+ "No bundle-product cart item ID found.", "Δεν βρέθηκε Κωδικός προϊόντος στο καλάθι να αντιστοιχεί σε συνδυασμό προϊόντων."
89
+ "The product you are trying to delete could not be found in the cart (item id is %s not found in cart).", "Το προϊόν που προσπαθείτε να διαγράψετε δεν μπορεί να βρεθεί στο καλάθι (ο κωδικός προϊόντος %s δεν βρέθηκε στο καλάθι)."
90
+ "The product has been deleted from your shopping cart.", "Το προϊόν έχει αφαιρεθεί από το καλάθι αγορών σας."
91
+ "Category not found.", "Δεν βρέθηκε η κατηγορία."
92
+ "Category not available.", "Η κατηγορία δεν είναι διαθέσιμη."
93
+ "No category found.", "Δεν βρέθηκε καμία κατηγορία."
94
+ "Your search returns no results.", "Η αναζήτησή σας δεν επιστρέφει κανένα αποτέλεσμα."
95
+ "Query cannot be empty.", "Το ερώτημα αναζήτησης δεν μπορεί να είναι κενό."
96
+ "Methods are not complete yet. Cart shipping address is not yet completed and saved.", "Οι μέθοδοι δεν είναι ακόμη πλήρεις. Η διεύθυνση αποστολής του καλαθιού δεν έχει ακόμη ολοκληρωθεί και αποθηκευτεί."
97
+ "Methods are not complete yet. Cart is empty.", "Οι μέθοδοι δεν είναι ακόμη πλήρεις. Το καλάθι είναι άδειο."
98
+ "Shipping method has no shipping carrier object: %s", "Η μέθοδος αποστολής δεν διαθέτει κανένα αντικείμενο μεταφορέα: %s"
99
+ "Carrier object has no collectRates method: %s", "Το αντικείμενο μεταφορέα δεν διαθέτει καμία μέθοδο collectRates: %s"
100
+ "Shipping method has no rates object: %s", "Η μέθοδος αποστολής δεν διαθέτει κανένα αντικείμενο τιμών: %s"
101
+ "Shipping method has no getAllRates function: %s", "Η μέθοδος αποστολής δεν διαθέτει καμία λειτουργία getAllRates: %s"
102
+ "Shipping method has no rates: %s", "Η μέθοδος αποστολής δεν διαθέτει καμία τιμή: %s"
103
+ "Shipping method can not be empty.", "Η μέθοδος αποστολής δεν μπορεί να είναι κενή."
104
+ "This shipping method is currently not available.", "Η μέθοδος αποστολής είναι προς το παρόν μη διαθέσιμη."
105
+ "Customer shipping address not found.", "Δεν βρέθηκε η διεύθυνση αποστολής πελάτη."
106
+ "Customer shipping address email not found.", "Δεν βρέθηκε η διεύθυνση ηλεκτρονικού ταχυδρομείου πελάτη."
107
+ "Customer billing address not found.", "Δεν βρέθηκε η διεύθυνση τιμολόγησης πελάτη."
108
+ "Payment method cannot be empty.", "Η μέθοδος πληρωμής δεν μπορεί να είναι κενή."
109
+ "Email cannot be empty.", "Το email δεν μπορεί να είναι κενό."
110
+ "This payment method is currently not available.", "Αυτή η μέθοδος πληρωμής δεν είναι προς το παρόν διαθέσιμη."
111
+ "Please add ", "Παρακαλούμε προσθέστε "
112
+ "Request info not matches the order.", "Οι αιτούμενες πληροφορίες δεν ταιριάζουν με την παραγγελία."
113
+ "No payment provider to redirect found.", "Δεν βρέθηκε πάροχος πληρωμών για ανακατεύθυνση."
114
+ "Request info does not match the quote. Probably the cart is ordered or the session is expired.", "Οι αιτούμενες πληροφορίες δεν ταιριάζουν με την προσφορά. Το καλάθι μπορεί να έχει ήδη παραγγελθεί ή η περίοδος σύνδεσης έχει λήξει."
115
+ "Cart is no longer active.", "Το καλάθι δεν είναι πλέον ενεργό."
116
+ "Replaced by new order.", "Αντικαταστάθηκε από νέα παραγγελία."
117
+ "Cannot save the address: ", "Δεν είναι δυνατή η αποθήκευση της διεύθυνσης: "
118
+ "The address does not belong to this customer.", "Η διεύθυνση δεν ανήκει σε αυτόν τον πελάτη."
119
+ "Default billing address can not be removed.", "Δεν μπορεί να αφαιρεθεί η προεπιλεγμένη διεύθυνση τιμολόγησης."
120
+ "Default shipping address can not be removed.", "Δεν μπορεί να αφαιρεθεί η προεπιλεγμένη διεύθυνση αποστολής."
121
+ "An error occurred while deleting the address.", "Παρουσιάστηκε κάποιο σφάλμα κατά τη διαγραφή της διεύθυνσης."
122
+ "Address ID can not be empty.", "Ο Κωδικός Διεύθυνσης δεν μπορεί να είναι κενός."
123
+ "New password field cannot be empty.", "New password field cannot be empty."
124
+ "Invalid current password", "Μη έγκυρος τρέχων κωδικός πρόσβασης"
125
+ "The account information has been saved.", "Οι πληροφορίες λογαριασμού έχουν αποθηκευτεί."
126
+ "Could not retrieve list: ", "Δεν είναι δυνατή η ανάκτηση της λίστας: "
127
+ "Order not found (no ID).", "Δεν βρέθηκε η παραγγελία (Κανένας Κωδικός)."
128
+ "Invalid email address.", "Μη έγκυρη διεύθυνση ηλεκτρονικού ταχυδρομείου."
129
+ "Please enter your email.", "Παρακαλούμε εισάγετε το email σας."
130
+ "This account needs confirmation. See in confirmation email.", "Αυτός ο λογαριασμός χρειάζεται επαλήθευση, Δείτε το email επιβεβαίωσης."
131
+ "No products found.", "Δεν βρέθηκαν προϊόντα."
132
+ "Category not found.", "Δεν βρέθηκε κατηγορία."
133
+ "Cannot find customer ID, please try again!", "Δεν είναι δυνατή η ανεύρεση Κωδικού Πελάτη, παρακαλούμε δοκιμάστε πάλι!"
134
+ "You must leave at least one payment method available.", "Πρέπει να αφήσετε διαθέσιμη τουλάχιστον μία μέθοδο αποστολής."
135
+ "You must leave at least one shipping method available.", "Πρέπει να αφήσετε διαθέσιμη τουλάχιστον μία μέθοδο αποστολής."
136
+ "None", "None"
137
+ "Base Image", "Base Image"
138
+ "Small Image", "Small Image"
139
+ "Thumbnail", "Thumbnail"
140
+ "Shipping Excl. Tax (%s)", "Αποστολή μη συμπεριλαμβανομένου του Φόρου (%s)"
141
+ "Shipping Incl. Tax (%s)", "Αποστολή συμπεριλαμβανομένου του Φόρου (%s)"
142
+ "Subtotal (Excl. Tax)", "Μερικό Σύνολο (μη συμπεριλαμβανομένου του Φόρου)"
143
+ "Subtotal (Incl. Tax)", "Μερικό Σύνολο (συμπεριλαμβανομένου του Φόρου)"
144
+ "Grand Total Excl. Tax", "Τελικό Σύνολο μη συμπεριλαμβανομένου του Φόρου"
145
+ "Grand Total Incl. Tax", "Τελικό Σύνολο συμπεριλαμβανομένου του Φόρου"
146
+ "Unable to set Payment Method.", "Δεν είναι δυνατός ο καθορισμός Μεθόδου Πληρωμής."
147
+ "Reports", "Αναφορές"
148
+ "Order Details", "Στοιχεία Παραγγελίας"
149
+ "Sales Reports", "Αναφορές Πωλήσεων"
150
+ "Orders Reports", "Αναφορές Παραγγελιών"
151
+ "Customers Reports", "Αναφορές Πελατών"
152
+ "Version", "Έκδοση"
153
+ "The plugin version", "Έκδοση plugin"
154
+ "User Name", "Όνομα Χρήστη"
155
+ "This username will be checked from every App while a session is set up between the App and the Magento store.", "Αυτό το όνομα χρήστη θα ελέγχεται από κάθε εφαρμογή ενώ υπάρχει ενεργή σύνδεση μεταξύ της Εφαρμογής και του καταστήματος Magento."
156
+ "Api Key", "Κλειδί Api"
157
+ "This key will be checked from every App while a session is set up between the App and the Magento store.", "Αυτό το κλειδί θα ελέγχεται από κάθε εφαρμογή ενώ υπάρχει ενεργή σύνδεση μεταξύ της Εφαρμογής και του καταστήματος Magento."
158
+ "Use token for Api communications", "Χρήση πιστοποιητικού διασύνδεσης για επικοινωνίες Api"
159
+ "Use token will add check and refresh the token with every request.", "Η χρήση πιστοποιητικού διασύνδεσης θα προσθέσει έλεγχο και ανανέωση του πιστοποιητικού με κάθε αίτημα."
160
+ "Catalogue Settings", "Ρυθμίσεις Καταλόγου"
161
+ "Include all active categories", "Include all active categories"
162
+ "Include all ""Active"" categories regardless of whether or not they are included in navigation", "Include all ""Active"" categories regardless of whether or not they are included in navigation"
163
+ "Display attribute on Product Listing", "Display attribute on Product Listing"
164
+ "This attribute will be displayed in product listing", "This attribute will be displayed in product listing"
165
+ "Display attribute on Product Details", "Display attribute on Product Details"
166
+ "This attribute will be displayed in product details", "This attribute will be displayed in product details"
167
+ "Mobile App Checkout Settings", "Mobile App Checkout Settings"
168
+ "Excluded shipping methods", "Excluded shipping methods"
169
+ "Select one or more, but not all shipping methods that are not suitable/compatible to be used in mobile app environment. This can be set anytime during or after creation of JMango360 application.", "Select one or more, but not all shipping methods that are not suitable/compatible to be used in mobile app environment. This can be set anytime during or after creation of JMango360 application."
170
+ "Excluded payment methods", "Excluded payment methods"
171
+ "Select one or more, but not all payment methods that are not suitable/compatible to be used in mobile app environment. This can be set anytime during or after creation of JMango360 application.", "Select one or more, but not all payment methods that are not suitable/compatible to be used in mobile app environment. This can be set anytime during or after creation of JMango360 application."
172
+ "Web checkout URL", "Web checkout URL"
173
+ "Enter custom checkout url of website if Jmango360 plugin could not detect. Ex: checkout/onepage.", "Enter custom checkout url of website if Jmango360 plugin could not detect. Ex: checkout/onepage."
174
+ "Product image gallery settings", "Product image gallery settings"
175
+ "Detail page image cache-width", "Detail page image cache-width"
176
+ "Set the default ""cached"" size for ""big"" images on the detail pages.", "Set the default """cached"" size for ""big"" images on the detail pages."
177
+ "Detail page image cache-height", "Detail page image cache-height"
178
+ "Set the default ""cached"" size for ""big"" images on the detail pages.", "Set the default ""cached"" size for ""big"" images on the detail pages."
179
+ "Catalogue image cache-width", "Catalogue image cache-width"
180
+ "Set the default ""cached"" size for images on the catalogue pages.", "Set the default ""cached"" size for images on the catalogue pages."
181
+ "Catalogue image cache-height", "Catalogue image cache-height"
182
+ "Set the default ""cached"" size for images on the catalog pages.", "Set the default ""cached"" size for images on the catalog pages."
183
+ "Thumbnail image cache-width", "Thumbnail image cache-width"
184
+ "Set the default ""cached"" size for thumbnails on the detail pages.", "Set the default ""cached"" size for thumbnails on the detail pages."
185
+ "Thumbnail image cache-height", "Thumbnail image cache-height"
186
+ "Set the default """cached"" size for thumbnails on the detail pages.", "Set the default """cached"" size for thumbnails on the detail pages."
187
+ "Choose image type to be displayed if catalogue thumbnail is not available", "Choose image type to be displayed if catalogue thumbnail is not available"
188
+ "Choose what kind of image of product that I would like to show in catalogue listing in mobile app.", "Choose what kind of image of product that I would like to show in catalogue listing in mobile app."
189
+ "Choose image type to be displayed on catalogue page", "Choose image type to be displayed on catalogue page"
190
+ "Choose what kind of image of product that I would like to show in product listing in mobile app.", "Choose what kind of image of product that I would like to show in product listing in mobile app."
191
+ "Stock Settings", "Stock Settings"
192
+ "Display products availability in stock in mobile app", "Display products availability in stock in mobile app"
193
+ "Developer", "Προγραμματιστής"
194
+ "Enable debug logging", "Ενεργοποίηση καταγραφής αρχείου συμβάντων"
195
+ "Log requests to japi.log. Disable in production.", "Καταγραφή αιτημάτων σε japi.log. Απενεργοποιήστε σε παραγωγική λειτουργία."
196
+ "Sales", "Sales"
197
+ "Order Details", "Order Details"
198
+ "Settings", "Settings"
199
+ "Use Onepage checkout for mobile app","Use Onepage checkout for mobile app"
200
+ "Select to use JMango360 Onepage responsive web checkout for mobile app instead of default Magento checkout","Select to use JMango360 Onepage responsive web checkout for mobile app instead of default Magento checkout"
201
+ "Custom Layout Update","Custom Layout Update"
202
+ "Enter xml layout update code here, it will only affect JMango360 Onepage checkout page","Enter xml layout update code here, it will only affect JMango360 Onepage checkout page"
203
+ "Custom CSS","Custom CSS"
204
+ "Enter css code here, it will only append to JMango360 Onepage checkout page","Enter css code here, it will only append to JMango360 Onepage checkout page"
205
+ "Hide non value additional attributes","Hide non value additional attributes"
206
+ "Attribute whose value is N/A or blank will not be displayed on Additional Information on product detail page","Atrribute whose value is N/A or blank will not be displayed on Additional Infomation on product detail page"
207
+ "Mobile App Login Settings","Mobile App Login Settings"
208
+ "App users must login to see product prices","App users must login to see product prices"
209
+ "This will prevent mobile app user using app without an account.","This will prevent mobile app user using app without an account."
210
+ "Discount Codes","Discount Codes"
211
+ "Enter your coupon code if you have one.","Enter your coupon code if you have one."
212
+ "Apply Coupon","Apply Coupon"
213
+ "Cancel Coupon","Cancel Coupon"
214
+ "Enable Order From in orders list","Ενεργοποίηση Παραγγελία Από στη λίστα παραγγελιών"
215
+ "Select to view which orders are from JMango360","Επιλογή για προβολή των παραγγελιών που είναι από το JMango360"
216
+ "Enable JMango360 User in Customers list","Ενεργοποίηση Χρήστη JMango360 στη λίστα Πελατών"
217
+ "Select to view which customers are from JMango360","Επιλογή για προβολή των πελατών που είναι από το JMango360"
218
+ "Adding extra attributes to registration form","Adding extra attributes to registration form"
219
+ "Adding these attributes to customer registration form in mobile app","Adding these attributes to customer registration form in mobile app"
220
+ "Show image of child product in Grouped Product Detail on mobile","Show image of child product in Grouped Product Detail on mobile"
221
+ "Please wait","Παρακαλούμε περιμένετε"
222
+ "A new version of the JMango360 Mobile plugin %s is available. Please update.","A new version of the JMango360 Mobile plugin %s is available. Please update."
223
+ "Group ID not found.","Group ID not found."
224
+ "Group not found.","Group not found."
225
+ "Sales Settings","Ρυθμίσεις Πωλήσεων"
226
+ "Customer Settings","Ρυθμίσεις Πελατών"
227
+ "Street Address #2 Label", "Street Address #2 Label"
228
+ "Set the label for 2nd street address.", "Set the label for 2nd street address."
229
+ "Street Address #2 as Required", "Street Address #2 as Required"
230
+ "Set if the street address field is required input.", "Set if the street address field is required input."
231
+ "Street Address #2 Validation", "Street Address #2 Validation"
232
+ "Set type of input for the street address field.", "Set type of input for the street address field."
233
+ "Street Address #3 Label", "Street Address #3 Label"
234
+ "Set the label for 3rd street address.", "Set the label for 3rd street address."
235
+ "Street Address #3 as Required", "Street Address #3 as Required"
236
+ "Street Address #4 Label", "Street Address #4 Label"
237
+ "Set the label for 4th street address.", "Set the label for 4th street address."
238
+ "Set if the street address field is required input.", "Set if the street address field is required input."
239
+ "Please close this form and login with your new account.", "Παρακαλούμε κλείστε αυτή τη φόρμα και συνδεθείτε με τον νέο σας λογαριασμό."
240
+ "Enable Hide on App on Manage Products","Ενεργοποίηση απόκρυψης προϊόντος στην Εφαρμογή"
241
+ "On Manage Products enable Hide on App","Ενεργοποίηση απόκρυψης προϊόντος στην Εφαρμογή"
242
+ "Enable this option to choose if a product is hidden on app or not","Ενεργοποιήστε αυτή τη δυνατότητα για επιλογή προβολής ή όχι αυτού του προϊόντος στην εφαρμογή"
243
+ "Enable this option to choose whether or not this product is visible in the app","Enable this option to choose whether or not this product is visible in the app"
244
+ "Hide on JMango360","Απόκρυψη στο JMango360"
245
+ "Hide on JMango360 App","Απόκρυψη στην Εφαρμογή JMango360"
246
+ "Override Default Sort Direction","Override Default Sort Direction"
247
+ "Choose to use direction here instead of mobile default sort direction.","Choose to use direction here instead of mobile default sort direction."
248
+ "Re-run SQL upgrade","Επανεκτέλεση αναβάθμισης SQL"
249
+ "Re-run successfully.","Επιτυχής επανεκτέλεση."
250
+ "Back to app","Πίσω στην εφαρμογή"
251
+ "Overall Rating","Συνολική βαθμολόγηση"
252
+ "Review Title","Τίτλος αξιολόγησης"
253
+ "Review","Αξιολόγηση"
254
+ "Nickname","Παρατσούκλι"
255
+ "I agree to the terms & conditions","Συμφωνώ με τους όρους και προϋποθέσεις"
256
+ "Would you recommend this product to your friends?","Would you recommend this product to your friends?"
257
+ "I recommend this product","Έχω προτείνει αυτό το προϊόν"
258
+ "I do not recommend this product","Δεν προτείνω αυτό το προϊόν"
259
+ "JMango360 Native Payment", "JMango360 Native Payment"
260
+ "Anonymous","Anonymous"
261
+ "Originally posted on %s.","Originally posted on %s."
app/locale/en_US/Jmango360_Japi.csv CHANGED
@@ -41,7 +41,6 @@
41
  "Resource method not implemented", "Resource method not implemented"
42
  "Minimum order amount is %s", "Minimum order amount is %s"
43
  "Guest checkout is not enabled", "Guest checkout is not enabled"
44
- "Product ID invalid", "Product ID invalid"
45
  "Something is wrong with the order.", "Something is wrong with the order."
46
  "Something is wrong with the quote or order.", "Something is wrong with the quote or order."
47
  "Cart is empty.", "Cart is empty."
@@ -54,12 +53,11 @@
54
  "Country does not exist", "Country does not exist"
55
  "Store not found", "Store not found"
56
  "Not allowed.", "Not allowed."
57
- "Set store option %s not found", "Set store option %s not found"
58
- "Set store option cannot be empty.", "Set store option cannot be empty."
59
  "Product ID invalid", "Product ID invalid"
60
  "Product not found", "Product not found"
61
  "Please login first!", "Please login first!"
62
  "Cannot specify product.", "Cannot specify product."
 
63
  "Item not found", "Item not found"
64
  "%1$s has been updated in your wishlist.", "%1$s has been updated in your wishlist."
65
  "An error occurred while updating your wishlist.", "An error occurred while updating your wishlist."
@@ -74,7 +72,6 @@
74
  "Wishlist updated successfully", "Wishlist updated successfully"
75
  "Can't update wishlist", "Can't update wishlist"
76
  "No item updated", "No item updated"
77
- "Cannot specify product", "Cannot specify product"
78
  "%s has been added to your wishlist.", "%s has been added to your wishlist."
79
  "An error occurred while adding item to your wishlist: %s", "An error occurred while adding item to your wishlist: %s"
80
  "An error occurred while adding item to your wishlist", "An error occurred while adding item to your wishlist"
@@ -259,3 +256,6 @@
259
  "Would you recommend this product to your friends?","Would you recommend this product to your friends?"
260
  "I recommend this product","I recommend this product"
261
  "I do not recommend this product","I do not recommend this product"
 
 
 
41
  "Resource method not implemented", "Resource method not implemented"
42
  "Minimum order amount is %s", "Minimum order amount is %s"
43
  "Guest checkout is not enabled", "Guest checkout is not enabled"
 
44
  "Something is wrong with the order.", "Something is wrong with the order."
45
  "Something is wrong with the quote or order.", "Something is wrong with the quote or order."
46
  "Cart is empty.", "Cart is empty."
53
  "Country does not exist", "Country does not exist"
54
  "Store not found", "Store not found"
55
  "Not allowed.", "Not allowed."
 
 
56
  "Product ID invalid", "Product ID invalid"
57
  "Product not found", "Product not found"
58
  "Please login first!", "Please login first!"
59
  "Cannot specify product.", "Cannot specify product."
60
+ "Cannot specify product", "Cannot specify product"
61
  "Item not found", "Item not found"
62
  "%1$s has been updated in your wishlist.", "%1$s has been updated in your wishlist."
63
  "An error occurred while updating your wishlist.", "An error occurred while updating your wishlist."
72
  "Wishlist updated successfully", "Wishlist updated successfully"
73
  "Can't update wishlist", "Can't update wishlist"
74
  "No item updated", "No item updated"
 
75
  "%s has been added to your wishlist.", "%s has been added to your wishlist."
76
  "An error occurred while adding item to your wishlist: %s", "An error occurred while adding item to your wishlist: %s"
77
  "An error occurred while adding item to your wishlist", "An error occurred while adding item to your wishlist"
256
  "Would you recommend this product to your friends?","Would you recommend this product to your friends?"
257
  "I recommend this product","I recommend this product"
258
  "I do not recommend this product","I do not recommend this product"
259
+ "JMango360 Native Payment", "JMango360 Native Payment"
260
+ "Anonymous","Anonymous"
261
+ "Originally posted on %s.","Originally posted on %s."
app/locale/nl_NL/Jmango360_Japi.csv CHANGED
@@ -180,3 +180,5 @@
180
  "Would you recommend this product to your friends?","Zou jij dit product aan je vrienden aanbevelen?"
181
  "I recommend this product","Ik beveel dit product aan"
182
  "I do not recommend this product","Ik beveel dit product niet aan"
 
 
180
  "Would you recommend this product to your friends?","Zou jij dit product aan je vrienden aanbevelen?"
181
  "I recommend this product","Ik beveel dit product aan"
182
  "I do not recommend this product","Ik beveel dit product niet aan"
183
+ "Anonymous","Anoniem"
184
+ "Originally posted on %s.","Oorspronkelijk gepost op %s."
lib/Jmango360/Braintree/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2017 Braintree, a division of PayPal, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
lib/Jmango360/Braintree/lib/Braintree.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Braintree PHP Library
4
+ * Creates class_aliases for old class names replaced by PSR-4 Namespaces
5
+ */
6
+
7
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
8
+
9
+ if (version_compare(PHP_VERSION, '5.4.0', '<')) {
10
+ throw new Braintree_Exception('PHP version >= 5.4.0 required');
11
+ }
12
+
13
+
14
+ function requireDependencies() {
15
+ $requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
16
+ foreach ($requiredExtensions AS $ext) {
17
+ if (!extension_loaded($ext)) {
18
+ throw new Braintree_Exception('The Braintree library requires the ' . $ext . ' extension.');
19
+ }
20
+ }
21
+ }
22
+
23
+ requireDependencies();
lib/Jmango360/Braintree/lib/Braintree/AccountUpdaterDailyReport.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Creates an instance of AccountUpdaterDailyReport
6
+ *
7
+ *
8
+ * @package Braintree
9
+ *
10
+ * @property-read string $reportUrl
11
+ * @property-read date $reportDate
12
+ * @property-read date $receivedDate
13
+ */
14
+ class AccountUpdaterDailyReport extends Base
15
+ {
16
+ protected $_attributes = [];
17
+
18
+ protected function _initialize($disputeAttribs)
19
+ {
20
+ $this->_attributes = $disputeAttribs;
21
+ }
22
+
23
+ public static function factory($attributes)
24
+ {
25
+ $instance = new self();
26
+ $instance->_initialize($attributes);
27
+ return $instance;
28
+ }
29
+
30
+ public function __toString()
31
+ {
32
+ $display = [
33
+ 'reportDate', 'reportUrl'
34
+ ];
35
+
36
+ $displayAttributes = [];
37
+ foreach ($display AS $attrib) {
38
+ $displayAttributes[$attrib] = $this->$attrib;
39
+ }
40
+ return __CLASS__ . '[' .
41
+ Util::attributesToString($displayAttributes) .']';
42
+ }
43
+ }
44
+ class_alias('Braintree\AccountUpdaterDailyReport', 'Braintree_AccountUpdaterDailyReport');
lib/Jmango360/Braintree/lib/Braintree/AchMandate.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree AchMandate module
6
+ * PHP Version 5
7
+ *
8
+ * @package Braintree
9
+ *
10
+ * @property-read string $text
11
+ * @property-read string $acceptedAt
12
+ */
13
+ class AchMandate extends Base
14
+ {
15
+ /**
16
+ * create a printable representation of the object as:
17
+ * ClassName[property=value, property=value]
18
+ * @ignore
19
+ * @return string
20
+ */
21
+ public function __toString()
22
+ {
23
+ return __CLASS__ . '[' .
24
+ Util::attributesToString($this->_attributes) . ']';
25
+ }
26
+
27
+ /**
28
+ * sets instance properties from an array of values
29
+ *
30
+ * @ignore
31
+ * @access protected
32
+ * @param array $achAttribs array of achMandate data
33
+ * @return void
34
+ */
35
+ protected function _initialize($achAttribs)
36
+ {
37
+ // set the attributes
38
+ $this->_attributes = $achAttribs;
39
+ $date = new \DateTime($this->acceptedAt);
40
+ $this->_set('acceptedAt', $date);
41
+ }
42
+
43
+ /**
44
+ * factory method: returns an instance of AchMandate
45
+ * to the requesting method, with populated properties
46
+ * @ignore
47
+ * @return AchMandate
48
+ */
49
+ public static function factory($attributes)
50
+ {
51
+ $instance = new self();
52
+ $instance->_initialize($attributes);
53
+ return $instance;
54
+
55
+ }
56
+ }
57
+ class_alias('Braintree\AchMandate', 'Braintree_Mandate');
lib/Jmango360/Braintree/lib/Braintree/AddOn.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class AddOn extends Modification
5
+ {
6
+ /**
7
+ *
8
+ * @param array $attributes
9
+ * @return AddOn
10
+ */
11
+ public static function factory($attributes)
12
+ {
13
+ $instance = new self();
14
+ $instance->_initialize($attributes);
15
+ return $instance;
16
+ }
17
+
18
+
19
+ /**
20
+ * static methods redirecting to gateway
21
+ *
22
+ * @return AddOn[]
23
+ */
24
+ public static function all()
25
+ {
26
+ return Configuration::gateway()->addOn()->all();
27
+ }
28
+ }
29
+ class_alias('Braintree\AddOn', 'Braintree_AddOn');
lib/Jmango360/Braintree/lib/Braintree/AddOnGateway.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class AddOnGateway
5
+ {
6
+ /**
7
+ *
8
+ * @var Gateway
9
+ */
10
+ private $_gateway;
11
+
12
+ /**
13
+ *
14
+ * @var Configuration
15
+ */
16
+ private $_config;
17
+
18
+ /**
19
+ *
20
+ * @var Http
21
+ */
22
+ private $_http;
23
+
24
+ /**
25
+ *
26
+ * @param Gateway $gateway
27
+ */
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @return AddOn[]
39
+ */
40
+ public function all()
41
+ {
42
+ $path = $this->_config->merchantPath() . '/add_ons';
43
+ $response = $this->_http->get($path);
44
+
45
+ $addOns = ["addOn" => $response['addOns']];
46
+
47
+ return Util::extractAttributeAsArray(
48
+ $addOns,
49
+ 'addOn'
50
+ );
51
+ }
52
+ }
53
+ class_alias('Braintree\AddOnGateway', 'Braintree_AddOnGateway');
lib/Jmango360/Braintree/lib/Braintree/Address.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Address module
6
+ * PHP Version 5
7
+ * Creates and manages Braintree Addresses
8
+ *
9
+ * An Address belongs to a Customer. It can be associated to a
10
+ * CreditCard as the billing address. It can also be used
11
+ * as the shipping address when creating a Transaction.
12
+ *
13
+ * @package Braintree
14
+ *
15
+ * @property-read string $company
16
+ * @property-read string $countryName
17
+ * @property-read string $createdAt
18
+ * @property-read string $customerId
19
+ * @property-read string $extendedAddress
20
+ * @property-read string $firstName
21
+ * @property-read string $id
22
+ * @property-read string $lastName
23
+ * @property-read string $locality
24
+ * @property-read string $postalCode
25
+ * @property-read string $region
26
+ * @property-read string $streetAddress
27
+ * @property-read string $updatedAt
28
+ */
29
+ class Address extends Base
30
+ {
31
+ /**
32
+ * returns false if comparing object is not a Address,
33
+ * or is a Address with a different id
34
+ *
35
+ * @param object $other address to compare against
36
+ * @return boolean
37
+ */
38
+ public function isEqual($other)
39
+ {
40
+ return !($other instanceof self) ?
41
+ false :
42
+ ($this->id === $other->id && $this->customerId === $other->customerId);
43
+ }
44
+
45
+ /**
46
+ * create a printable representation of the object as:
47
+ * ClassName[property=value, property=value]
48
+ * @ignore
49
+ * @return string
50
+ */
51
+ public function __toString()
52
+ {
53
+ return __CLASS__ . '[' .
54
+ Util::attributesToString($this->_attributes) . ']';
55
+ }
56
+
57
+ /**
58
+ * sets instance properties from an array of values
59
+ *
60
+ * @ignore
61
+ * @access protected
62
+ * @param array $addressAttribs array of address data
63
+ * @return void
64
+ */
65
+ protected function _initialize($addressAttribs)
66
+ {
67
+ // set the attributes
68
+ $this->_attributes = $addressAttribs;
69
+ }
70
+
71
+ /**
72
+ * factory method: returns an instance of Address
73
+ * to the requesting method, with populated properties
74
+ * @ignore
75
+ * @return Address
76
+ */
77
+ public static function factory($attributes)
78
+ {
79
+ $instance = new self();
80
+ $instance->_initialize($attributes);
81
+ return $instance;
82
+
83
+ }
84
+
85
+
86
+ // static methods redirecting to gateway
87
+
88
+ /**
89
+ *
90
+ * @param array $attribs
91
+ * @return Address
92
+ */
93
+ public static function create($attribs)
94
+ {
95
+ return Configuration::gateway()->address()->create($attribs);
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @param array $attribs
101
+ * @return Address
102
+ */
103
+ public static function createNoValidate($attribs)
104
+ {
105
+ return Configuration::gateway()->address()->createNoValidate($attribs);
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @param Customer|int $customerOrId
111
+ * @param int $addressId
112
+ * @throws InvalidArgumentException
113
+ * @return Result\Successful
114
+ */
115
+ public static function delete($customerOrId = null, $addressId = null)
116
+ {
117
+ return Configuration::gateway()->address()->delete($customerOrId, $addressId);
118
+ }
119
+
120
+ /**
121
+ *
122
+ * @param Customer|int $customerOrId
123
+ * @param int $addressId
124
+ * @throws Exception\NotFound
125
+ * @return Address
126
+ */
127
+ public static function find($customerOrId, $addressId)
128
+ {
129
+ return Configuration::gateway()->address()->find($customerOrId, $addressId);
130
+ }
131
+
132
+ /**
133
+ *
134
+ * @param Customer|int $customerOrId
135
+ * @param int $addressId
136
+ * @param array $attributes
137
+ * @throws Exception\Unexpected
138
+ * @return Result\Successful|Result\Error
139
+ */
140
+ public static function update($customerOrId, $addressId, $attributes)
141
+ {
142
+ return Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes);
143
+ }
144
+
145
+ public static function updateNoValidate($customerOrId, $addressId, $attributes)
146
+ {
147
+ return Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);
148
+ }
149
+ }
150
+ class_alias('Braintree\Address', 'Braintree_Address');
lib/Jmango360/Braintree/lib/Braintree/AddressGateway.php ADDED
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree AddressGateway module
8
+ * PHP Version 5
9
+ * Creates and manages Braintree Addresses
10
+ *
11
+ * An Address belongs to a Customer. It can be associated to a
12
+ * CreditCard as the billing address. It can also be used
13
+ * as the shipping address when creating a Transaction.
14
+ *
15
+ * @package Braintree
16
+ */
17
+ class AddressGateway
18
+ {
19
+ /**
20
+ *
21
+ * @var Gateway
22
+ */
23
+ private $_gateway;
24
+
25
+ /**
26
+ *
27
+ * @var Configuration
28
+ */
29
+ private $_config;
30
+
31
+ /**
32
+ *
33
+ * @var Http
34
+ */
35
+ private $_http;
36
+
37
+ /**
38
+ *
39
+ * @param Gateway $gateway
40
+ */
41
+ public function __construct($gateway)
42
+ {
43
+ $this->_gateway = $gateway;
44
+ $this->_config = $gateway->config;
45
+ $this->_config->assertHasAccessTokenOrKeys();
46
+ $this->_http = new Http($gateway->config);
47
+ }
48
+
49
+
50
+ /* public class methods */
51
+ /**
52
+ *
53
+ * @access public
54
+ * @param array $attribs
55
+ * @return Result\Successful|Result\Error
56
+ */
57
+ public function create($attribs)
58
+ {
59
+ Util::verifyKeys(self::createSignature(), $attribs);
60
+ $customerId = isset($attribs['customerId']) ?
61
+ $attribs['customerId'] :
62
+ null;
63
+
64
+ $this->_validateCustomerId($customerId);
65
+ unset($attribs['customerId']);
66
+ try {
67
+ return $this->_doCreate(
68
+ '/customers/' . $customerId . '/addresses',
69
+ ['address' => $attribs]
70
+ );
71
+ } catch (Exception\NotFound $e) {
72
+ throw new Exception\NotFound(
73
+ 'Customer ' . $customerId . ' not found.'
74
+ );
75
+ }
76
+ }
77
+
78
+ /**
79
+ * attempts the create operation assuming all data will validate
80
+ * returns a Address object instead of a Result
81
+ *
82
+ * @access public
83
+ * @param array $attribs
84
+ * @return self
85
+ * @throws Exception\ValidationError
86
+ */
87
+ public function createNoValidate($attribs)
88
+ {
89
+ $result = $this->create($attribs);
90
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
91
+
92
+ }
93
+
94
+ /**
95
+ * delete an address by id
96
+ *
97
+ * @param mixed $customerOrId
98
+ * @param string $addressId
99
+ */
100
+ public function delete($customerOrId = null, $addressId = null)
101
+ {
102
+ $this->_validateId($addressId);
103
+ $customerId = $this->_determineCustomerId($customerOrId);
104
+ $path = $this->_config->merchantPath() . '/customers/' . $customerId . '/addresses/' . $addressId;
105
+ $this->_http->delete($path);
106
+ return new Result\Successful();
107
+ }
108
+
109
+ /**
110
+ * find an address by id
111
+ *
112
+ * Finds the address with the given <b>addressId</b> that is associated
113
+ * to the given <b>customerOrId</b>.
114
+ * If the address cannot be found, a NotFound exception will be thrown.
115
+ *
116
+ *
117
+ * @access public
118
+ * @param mixed $customerOrId
119
+ * @param string $addressId
120
+ * @return Address
121
+ * @throws Exception\NotFound
122
+ */
123
+ public function find($customerOrId, $addressId)
124
+ {
125
+
126
+ $customerId = $this->_determineCustomerId($customerOrId);
127
+ $this->_validateId($addressId);
128
+
129
+ try {
130
+ $path = $this->_config->merchantPath() . '/customers/' . $customerId . '/addresses/' . $addressId;
131
+ $response = $this->_http->get($path);
132
+ return Address::factory($response['address']);
133
+ } catch (Exception\NotFound $e) {
134
+ throw new Exception\NotFound(
135
+ 'address for customer ' . $customerId .
136
+ ' with id ' . $addressId . ' not found.'
137
+ );
138
+ }
139
+
140
+ }
141
+
142
+ /**
143
+ * updates the address record
144
+ *
145
+ * if calling this method in context,
146
+ * customerOrId is the 2nd attribute, addressId 3rd.
147
+ * customerOrId & addressId are not sent in object context.
148
+ *
149
+ *
150
+ * @access public
151
+ * @param array $attributes
152
+ * @param mixed $customerOrId (only used in call)
153
+ * @param string $addressId (only used in call)
154
+ * @return Result\Successful|Result\Error
155
+ */
156
+ public function update($customerOrId, $addressId, $attributes)
157
+ {
158
+ $this->_validateId($addressId);
159
+ $customerId = $this->_determineCustomerId($customerOrId);
160
+ Util::verifyKeys(self::updateSignature(), $attributes);
161
+
162
+ $path = $this->_config->merchantPath() . '/customers/' . $customerId . '/addresses/' . $addressId;
163
+ $response = $this->_http->put($path, ['address' => $attributes]);
164
+
165
+ return $this->_verifyGatewayResponse($response);
166
+
167
+ }
168
+
169
+ /**
170
+ * update an address record, assuming validations will pass
171
+ *
172
+ * if calling this method in context,
173
+ * customerOrId is the 2nd attribute, addressId 3rd.
174
+ * customerOrId & addressId are not sent in object context.
175
+ *
176
+ * @access public
177
+ * @param array $transactionAttribs
178
+ * @param string $customerId
179
+ * @return Transaction
180
+ * @throws Exception\ValidationsFailed
181
+ * @see Address::update()
182
+ */
183
+ public function updateNoValidate($customerOrId, $addressId, $attributes)
184
+ {
185
+ $result = $this->update($customerOrId, $addressId, $attributes);
186
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
187
+ }
188
+
189
+ /**
190
+ * creates a full array signature of a valid create request
191
+ * @return array gateway create request format
192
+ */
193
+ public static function createSignature()
194
+ {
195
+ return [
196
+ 'company', 'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
197
+ 'countryName', 'customerId', 'extendedAddress', 'firstName',
198
+ 'lastName', 'locality', 'postalCode', 'region', 'streetAddress'
199
+ ];
200
+ }
201
+
202
+ /**
203
+ * creates a full array signature of a valid update request
204
+ * @return array gateway update request format
205
+ */
206
+ public static function updateSignature()
207
+ {
208
+ // TODO: remove customerId from update signature
209
+ return self::createSignature();
210
+
211
+ }
212
+
213
+ /**
214
+ * verifies that a valid address id is being used
215
+ * @ignore
216
+ * @param string $id address id
217
+ * @throws InvalidArgumentException
218
+ */
219
+ private function _validateId($id = null)
220
+ {
221
+ if (empty($id) || trim($id) == "") {
222
+ throw new InvalidArgumentException(
223
+ 'expected address id to be set'
224
+ );
225
+ }
226
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
227
+ throw new InvalidArgumentException(
228
+ $id . ' is an invalid address id.'
229
+ );
230
+ }
231
+ }
232
+
233
+ /**
234
+ * verifies that a valid customer id is being used
235
+ * @ignore
236
+ * @param string $id customer id
237
+ * @throws InvalidArgumentException
238
+ */
239
+ private function _validateCustomerId($id = null)
240
+ {
241
+ if (empty($id) || trim($id) == "") {
242
+ throw new InvalidArgumentException(
243
+ 'expected customer id to be set'
244
+ );
245
+ }
246
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
247
+ throw new InvalidArgumentException(
248
+ $id . ' is an invalid customer id.'
249
+ );
250
+ }
251
+
252
+ }
253
+
254
+ /**
255
+ * determines if a string id or Customer object was passed
256
+ * @ignore
257
+ * @param mixed $customerOrId
258
+ * @return string customerId
259
+ */
260
+ private function _determineCustomerId($customerOrId)
261
+ {
262
+ $customerId = ($customerOrId instanceof Customer) ? $customerOrId->id : $customerOrId;
263
+ $this->_validateCustomerId($customerId);
264
+ return $customerId;
265
+
266
+ }
267
+
268
+ /* private class methods */
269
+ /**
270
+ * sends the create request to the gateway
271
+ * @ignore
272
+ * @param string $subPath
273
+ * @param array $params
274
+ * @return Result\Successful|Result\Error
275
+ */
276
+ private function _doCreate($subPath, $params)
277
+ {
278
+ $fullPath = $this->_config->merchantPath() . $subPath;
279
+ $response = $this->_http->post($fullPath, $params);
280
+
281
+ return $this->_verifyGatewayResponse($response);
282
+ }
283
+
284
+ /**
285
+ * generic method for validating incoming gateway responses
286
+ *
287
+ * creates a new Address object and encapsulates
288
+ * it inside a Result\Successful object, or
289
+ * encapsulates an Errors object inside a Result\Error
290
+ * alternatively, throws an Unexpected exception if the response is invalid
291
+ *
292
+ * @ignore
293
+ * @param array $response gateway response values
294
+ * @return Result\Successful|Result\Error
295
+ * @throws Exception\Unexpected
296
+ */
297
+ private function _verifyGatewayResponse($response)
298
+ {
299
+ if (isset($response['address'])) {
300
+ // return a populated instance of Address
301
+ return new Result\Successful(
302
+ Address::factory($response['address'])
303
+ );
304
+ } else if (isset($response['apiErrorResponse'])) {
305
+ return new Result\Error($response['apiErrorResponse']);
306
+ } else {
307
+ throw new Exception\Unexpected(
308
+ "Expected address or apiErrorResponse"
309
+ );
310
+ }
311
+
312
+ }
313
+ }
314
+ class_alias('Braintree\AddressGateway', 'Braintree_AddressGateway');
lib/Jmango360/Braintree/lib/Braintree/AmexExpressCheckoutCard.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree AmexExpressCheckoutCard module
6
+ * Creates and manages Braintree Amex Express Checkout cards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * See {@link https://developers.braintreepayments.com/javascript+php}<br />
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $createdAt
16
+ * @property-read string $default
17
+ * @property-read string $updatedAt
18
+ * @property-read string $customerId
19
+ * @property-read string $cardType
20
+ * @property-read string $bin
21
+ * @property-read string $cardMemberExpiryDate
22
+ * @property-read string $cardMemberNumber
23
+ * @property-read string $sourceDescription
24
+ * @property-read string $token
25
+ * @property-read string $imageUrl
26
+ * @property-read string $expirationMonth
27
+ * @property-read string $expirationYear
28
+ */
29
+ class AmexExpressCheckoutCard extends Base
30
+ {
31
+ /* instance methods */
32
+ /**
33
+ * returns false if default is null or false
34
+ *
35
+ * @return boolean
36
+ */
37
+ public function isDefault()
38
+ {
39
+ return $this->default;
40
+ }
41
+
42
+ /**
43
+ * factory method: returns an instance of AmexExpressCheckoutCard
44
+ * to the requesting method, with populated properties
45
+ *
46
+ * @ignore
47
+ * @return AmexExpressCheckoutCard
48
+ */
49
+ public static function factory($attributes)
50
+ {
51
+
52
+ $instance = new self();
53
+ $instance->_initialize($attributes);
54
+ return $instance;
55
+ }
56
+
57
+ /**
58
+ * sets instance properties from an array of values
59
+ *
60
+ * @access protected
61
+ * @param array $amexExpressCheckoutCardAttribs array of Amex Express Checkout card properties
62
+ * @return void
63
+ */
64
+ protected function _initialize($amexExpressCheckoutCardAttribs)
65
+ {
66
+ // set the attributes
67
+ $this->_attributes = $amexExpressCheckoutCardAttribs;
68
+
69
+ $subscriptionArray = [];
70
+ if (isset($amexExpressCheckoutCardAttribs['subscriptions'])) {
71
+ foreach ($amexExpressCheckoutCardAttribs['subscriptions'] AS $subscription) {
72
+ $subscriptionArray[] = Subscription::factory($subscription);
73
+ }
74
+ }
75
+
76
+ $this->_set('subscriptions', $subscriptionArray);
77
+ }
78
+ }
79
+ class_alias('Braintree\AmexExpressCheckoutCard', 'Braintree_AmexExpressCheckoutCard');
lib/Jmango360/Braintree/lib/Braintree/AndroidPayCard.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree AndroidPayCard module
6
+ * Creates and manages Braintree Android Pay cards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * See {@link https://developers.braintreepayments.com/javascript+php}<br />
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $bin
16
+ * @property-read string $cardType
17
+ * @property-read string $createdAt
18
+ * @property-read string $customerId
19
+ * @property-read string $default
20
+ * @property-read string $expirationMonth
21
+ * @property-read string $expirationYear
22
+ * @property-read string $googleTransactionId
23
+ * @property-read string $imageUrl
24
+ * @property-read string $last4
25
+ * @property-read string $sourceCardLast4
26
+ * @property-read string $sourceCardType
27
+ * @property-read string $sourceDescription
28
+ * @property-read string $token
29
+ * @property-read string $updatedAt
30
+ * @property-read string $virtualCardLast4
31
+ * @property-read string $virtualCardType
32
+ */
33
+ class AndroidPayCard extends Base
34
+ {
35
+ /* instance methods */
36
+ /**
37
+ * returns false if default is null or false
38
+ *
39
+ * @return boolean
40
+ */
41
+ public function isDefault()
42
+ {
43
+ return $this->default;
44
+ }
45
+
46
+ /**
47
+ * factory method: returns an instance of AndroidPayCard
48
+ * to the requesting method, with populated properties
49
+ *
50
+ * @ignore
51
+ * @return AndroidPayCard
52
+ */
53
+ public static function factory($attributes)
54
+ {
55
+ $defaultAttributes = [
56
+ 'expirationMonth' => '',
57
+ 'expirationYear' => '',
58
+ 'last4' => $attributes['virtualCardLast4'],
59
+ 'cardType' => $attributes['virtualCardType'],
60
+ ];
61
+
62
+ $instance = new self();
63
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
64
+ return $instance;
65
+ }
66
+
67
+ /**
68
+ * sets instance properties from an array of values
69
+ *
70
+ * @access protected
71
+ * @param array $androidPayCardAttribs array of Android Pay card properties
72
+ * @return void
73
+ */
74
+ protected function _initialize($androidPayCardAttribs)
75
+ {
76
+ // set the attributes
77
+ $this->_attributes = $androidPayCardAttribs;
78
+
79
+ $subscriptionArray = [];
80
+ if (isset($androidPayCardAttribs['subscriptions'])) {
81
+ foreach ($androidPayCardAttribs['subscriptions'] AS $subscription) {
82
+ $subscriptionArray[] = Subscription::factory($subscription);
83
+ }
84
+ }
85
+
86
+ $this->_set('subscriptions', $subscriptionArray);
87
+ }
88
+ }
89
+ class_alias('Braintree\AndroidPayCard', 'Braintree_AndroidPayCard');
lib/Jmango360/Braintree/lib/Braintree/ApplePayCard.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree ApplePayCard module
6
+ * Creates and manages Braintree Apple Pay cards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * See {@link https://developers.braintreepayments.com/javascript+php}<br />
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $cardType
16
+ * @property-read string $createdAt
17
+ * @property-read string $customerId
18
+ * @property-read string $expirationDate
19
+ * @property-read string $expirationMonth
20
+ * @property-read string $expirationYear
21
+ * @property-read string $imageUrl
22
+ * @property-read string $last4
23
+ * @property-read string $token
24
+ * @property-read string $paymentInstrumentName
25
+ * @property-read string $sourceDescription
26
+ * @property-read string $updatedAt
27
+ */
28
+ class ApplePayCard extends Base
29
+ {
30
+ // Card Type
31
+ const AMEX = 'Apple Pay - American Express';
32
+ const MASTER_CARD = 'Apple Pay - MasterCard';
33
+ const VISA = 'Apple Pay - Visa';
34
+
35
+ /* instance methods */
36
+ /**
37
+ * returns false if default is null or false
38
+ *
39
+ * @return boolean
40
+ */
41
+ public function isDefault()
42
+ {
43
+ return $this->default;
44
+ }
45
+
46
+ /**
47
+ * checks whether the card is expired based on the current date
48
+ *
49
+ * @return boolean
50
+ */
51
+ public function isExpired()
52
+ {
53
+ return $this->expired;
54
+ }
55
+
56
+ /**
57
+ * factory method: returns an instance of ApplePayCard
58
+ * to the requesting method, with populated properties
59
+ *
60
+ * @ignore
61
+ * @return ApplePayCard
62
+ */
63
+ public static function factory($attributes)
64
+ {
65
+ $defaultAttributes = [
66
+ 'expirationMonth' => '',
67
+ 'expirationYear' => '',
68
+ 'last4' => '',
69
+ ];
70
+
71
+ $instance = new self();
72
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
73
+ return $instance;
74
+ }
75
+
76
+ /**
77
+ * sets instance properties from an array of values
78
+ *
79
+ * @access protected
80
+ * @param array $applePayCardAttribs array of Apple Pay card properties
81
+ * @return void
82
+ */
83
+ protected function _initialize($applePayCardAttribs)
84
+ {
85
+ // set the attributes
86
+ $this->_attributes = $applePayCardAttribs;
87
+
88
+ $subscriptionArray = [];
89
+ if (isset($applePayCardAttribs['subscriptions'])) {
90
+ foreach ($applePayCardAttribs['subscriptions'] AS $subscription) {
91
+ $subscriptionArray[] = Subscription::factory($subscription);
92
+ }
93
+ }
94
+
95
+ $this->_set('subscriptions', $subscriptionArray);
96
+ $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
97
+ }
98
+ }
99
+ class_alias('Braintree\ApplePayCard', 'Braintree_ApplePayCard');
lib/Jmango360/Braintree/lib/Braintree/Base.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree PHP Library.
6
+ *
7
+ * Braintree base class and initialization
8
+ * Provides methods to child classes. This class cannot be instantiated.
9
+ *
10
+ * PHP version 5
11
+ */
12
+ abstract class Base
13
+ {
14
+ protected $_attributes = [];
15
+
16
+ /**
17
+ * @ignore
18
+ * don't permit an explicit call of the constructor!
19
+ * (like $t = new Transaction())
20
+ */
21
+ protected function __construct()
22
+ {
23
+ }
24
+
25
+ /**
26
+ * Disable cloning of objects
27
+ *
28
+ * @ignore
29
+ */
30
+ protected function __clone()
31
+ {
32
+ }
33
+
34
+ /**
35
+ * Accessor for instance properties stored in the private $_attributes property
36
+ *
37
+ * @ignore
38
+ * @param string $name
39
+ * @return mixed
40
+ */
41
+ public function __get($name)
42
+ {
43
+ if (array_key_exists($name, $this->_attributes)) {
44
+ return $this->_attributes[$name];
45
+ }
46
+ else {
47
+ trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
48
+ return null;
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Checks for the existance of a property stored in the private $_attributes property
54
+ *
55
+ * @ignore
56
+ * @param string $name
57
+ * @return boolean
58
+ */
59
+ public function __isset($name)
60
+ {
61
+ return array_key_exists($name, $this->_attributes);
62
+ }
63
+
64
+ /**
65
+ * Mutator for instance properties stored in the private $_attributes property
66
+ *
67
+ * @ignore
68
+ * @param string $key
69
+ * @param mixed $value
70
+ */
71
+ public function _set($key, $value)
72
+ {
73
+ $this->_attributes[$key] = $value;
74
+ }
75
+ }
lib/Jmango360/Braintree/lib/Braintree/ClientToken.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class ClientToken
5
+ {
6
+ const DEFAULT_VERSION = 2;
7
+
8
+
9
+ // static methods redirecting to gateway
10
+
11
+ /**
12
+ *
13
+ * @param array $params
14
+ * @return array
15
+ */
16
+ public static function generate($params=[])
17
+ {
18
+ return Configuration::gateway()->clientToken()->generate($params);
19
+ }
20
+
21
+ /**
22
+ *
23
+ * @param type $params
24
+ * @throws InvalidArgumentException
25
+ */
26
+ public static function conditionallyVerifyKeys($params)
27
+ {
28
+ return Configuration::gateway()->clientToken()->conditionallyVerifyKeys($params);
29
+ }
30
+
31
+ /**
32
+ *
33
+ * @return string client token retrieved from server
34
+ */
35
+ public static function generateWithCustomerIdSignature()
36
+ {
37
+ return Configuration::gateway()->clientToken()->generateWithCustomerIdSignature();
38
+ }
39
+
40
+ /**
41
+ *
42
+ * @return string client token retrieved from server
43
+ */
44
+ public static function generateWithoutCustomerIdSignature()
45
+ {
46
+ return Configuration::gateway()->clientToken()->generateWithoutCustomerIdSignature();
47
+ }
48
+ }
49
+ class_alias('Braintree\ClientToken', 'Braintree_ClientToken');
lib/Jmango360/Braintree/lib/Braintree/ClientTokenGateway.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ class ClientTokenGateway
7
+ {
8
+ /**
9
+ *
10
+ * @var Gateway
11
+ */
12
+ private $_gateway;
13
+
14
+ /**
15
+ *
16
+ * @var Configuration
17
+ */
18
+ private $_config;
19
+
20
+ /**
21
+ *
22
+ * @var Http
23
+ */
24
+ private $_http;
25
+
26
+ /**
27
+ *
28
+ * @param Gateway $gateway
29
+ */
30
+ public function __construct($gateway)
31
+ {
32
+ $this->_gateway = $gateway;
33
+ $this->_config = $gateway->config;
34
+ $this->_config->assertHasAccessTokenOrKeys();
35
+ $this->_http = new Http($gateway->config);
36
+ }
37
+
38
+ public function generate($params=[])
39
+ {
40
+ if (!array_key_exists("version", $params)) {
41
+ $params["version"] = ClientToken::DEFAULT_VERSION;
42
+ }
43
+
44
+ $this->conditionallyVerifyKeys($params);
45
+ $generateParams = ["client_token" => $params];
46
+
47
+ return $this->_doGenerate('/client_token', $generateParams);
48
+ }
49
+
50
+ /**
51
+ * sends the generate request to the gateway
52
+ *
53
+ * @ignore
54
+ * @param var $url
55
+ * @param array $params
56
+ * @return string
57
+ */
58
+ public function _doGenerate($subPath, $params)
59
+ {
60
+ $fullPath = $this->_config->merchantPath() . $subPath;
61
+ $response = $this->_http->post($fullPath, $params);
62
+
63
+ return $this->_verifyGatewayResponse($response);
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @param array $params
69
+ * @throws InvalidArgumentException
70
+ */
71
+ public function conditionallyVerifyKeys($params)
72
+ {
73
+ if (array_key_exists("customerId", $params)) {
74
+ Util::verifyKeys($this->generateWithCustomerIdSignature(), $params);
75
+ } else {
76
+ Util::verifyKeys($this->generateWithoutCustomerIdSignature(), $params);
77
+ }
78
+ }
79
+
80
+ /**
81
+ *
82
+ * @return mixed[]
83
+ */
84
+ public function generateWithCustomerIdSignature()
85
+ {
86
+ return [
87
+ "version", "customerId", "proxyMerchantId",
88
+ ["options" => ["makeDefault", "verifyCard", "failOnDuplicatePaymentMethod"]],
89
+ "merchantAccountId", "sepaMandateType", "sepaMandateAcceptanceLocation"];
90
+ }
91
+
92
+ /**
93
+ *
94
+ * @return string[]
95
+ */
96
+ public function generateWithoutCustomerIdSignature()
97
+ {
98
+ return ["version", "proxyMerchantId", "merchantAccountId"];
99
+ }
100
+
101
+ /**
102
+ * generic method for validating incoming gateway responses
103
+ *
104
+ * If the request is successful, returns a client token string.
105
+ * Otherwise, throws an InvalidArgumentException with the error
106
+ * response from the Gateway or an HTTP status code exception.
107
+ *
108
+ * @ignore
109
+ * @param array $response gateway response values
110
+ * @return string client token
111
+ * @throws InvalidArgumentException | HTTP status code exception
112
+ */
113
+ private function _verifyGatewayResponse($response)
114
+ {
115
+ if (isset($response['clientToken'])) {
116
+ return $response['clientToken']['value'];
117
+ } elseif (isset($response['apiErrorResponse'])) {
118
+ throw new InvalidArgumentException(
119
+ $response['apiErrorResponse']['message']
120
+ );
121
+ } else {
122
+ throw new Exception\Unexpected(
123
+ "Expected clientToken or apiErrorResponse"
124
+ );
125
+ }
126
+ }
127
+
128
+ }
129
+ class_alias('Braintree\ClientTokenGateway', 'Braintree_ClientTokenGateway');
lib/Jmango360/Braintree/lib/Braintree/CoinbaseAccount.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree CoinbaseAccount module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Manages Braintree CoinbaseAccounts
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ *
20
+ * @property-read string $customerId
21
+ * @property-read string $token
22
+ * @property-read string $userId
23
+ * @property-read string $userName
24
+ * @property-read string $userEmail
25
+ */
26
+ class CoinbaseAccount extends Base
27
+ {
28
+ /**
29
+ * factory method: returns an instance of CoinbaseAccount
30
+ * to the requesting method, with populated properties
31
+ *
32
+ * @ignore
33
+ * @return CoinbaseAccount
34
+ */
35
+ public static function factory($attributes)
36
+ {
37
+ $instance = new self();
38
+ $instance->_initialize($attributes);
39
+ return $instance;
40
+ }
41
+
42
+ /* instance methods */
43
+
44
+ /**
45
+ * returns false if default is null or false
46
+ *
47
+ * @return boolean
48
+ */
49
+ public function isDefault()
50
+ {
51
+ return $this->default;
52
+ }
53
+
54
+ /**
55
+ * sets instance properties from an array of values
56
+ *
57
+ * @access protected
58
+ * @param array $coinbaseAccountAttribs array of coinbaseAccount data
59
+ * @return void
60
+ */
61
+ protected function _initialize($coinbaseAccountAttribs)
62
+ {
63
+ // set the attributes
64
+ $this->_attributes = $coinbaseAccountAttribs;
65
+
66
+ $subscriptionArray = [];
67
+ if (isset($coinbaseAccountAttribs['subscriptions'])) {
68
+ foreach ($coinbaseAccountAttribs['subscriptions'] AS $subscription) {
69
+ $subscriptionArray[] = Subscription::factory($subscription);
70
+ }
71
+ }
72
+
73
+ $this->_set('subscriptions', $subscriptionArray);
74
+ }
75
+
76
+ /**
77
+ * create a printable representation of the object as:
78
+ * ClassName[property=value, property=value]
79
+ * @return string
80
+ */
81
+ public function __toString()
82
+ {
83
+ return __CLASS__ . '[' .
84
+ Util::attributesToString($this->_attributes) .']';
85
+ }
86
+
87
+
88
+ // static methods redirecting to gateway
89
+
90
+ public static function find($token)
91
+ {
92
+ return Configuration::gateway()->coinbaseAccount()->find($token);
93
+ }
94
+
95
+ public static function update($token, $attributes)
96
+ {
97
+ return Configuration::gateway()->coinbaseAccount()->update($token, $attributes);
98
+ }
99
+
100
+ public static function delete($token)
101
+ {
102
+ return Configuration::gateway()->coinbaseAccount()->delete($token);
103
+ }
104
+
105
+ public static function sale($token, $transactionAttribs)
106
+ {
107
+ return Configuration::gateway()->coinbaseAccount()->sale($token, $transactionAttribs);
108
+ }
109
+ }
110
+ class_alias('Braintree\CoinbaseAccount', 'Braintree_CoinbaseAccount');
lib/Jmango360/Braintree/lib/Braintree/Collection.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use Countable;
5
+ use IteratorAggregate;
6
+ use ArrayAccess;
7
+ use OutOfRangeException;
8
+ use ArrayIterator;
9
+
10
+ /**
11
+ * Braintree Generic collection
12
+ *
13
+ * PHP Version 5
14
+ *
15
+ * Based on Generic Collection class from:
16
+ * {@link http://codeutopia.net/code/library/CU/Collection.php}
17
+ *
18
+ * @package Braintree
19
+ * @subpackage Utility
20
+ */
21
+
22
+ class Collection implements Countable, IteratorAggregate, ArrayAccess
23
+ {
24
+ /**
25
+ *
26
+ * @var array collection storage
27
+ */
28
+ protected $_collection = [];
29
+
30
+ /**
31
+ * Add a value into the collection
32
+ * @param string $value
33
+ */
34
+ public function add($value)
35
+ {
36
+ $this->_collection[] = $value;
37
+ }
38
+
39
+ /**
40
+ * Set index's value
41
+ * @param integer $index
42
+ * @param mixed $value
43
+ * @throws OutOfRangeException
44
+ */
45
+ public function set($index, $value)
46
+ {
47
+ if($index >= $this->count())
48
+ throw new OutOfRangeException('Index out of range');
49
+
50
+ $this->_collection[$index] = $value;
51
+ }
52
+
53
+ /**
54
+ * Remove a value from the collection
55
+ * @param integer $index index to remove
56
+ * @throws OutOfRangeException if index is out of range
57
+ */
58
+ public function remove($index)
59
+ {
60
+ if($index >= $this->count())
61
+ throw new OutOfRangeException('Index out of range');
62
+
63
+ array_splice($this->_collection, $index, 1);
64
+ }
65
+
66
+ /**
67
+ * Return value at index
68
+ * @param integer $index
69
+ * @return mixed
70
+ * @throws OutOfRangeException
71
+ */
72
+ public function get($index)
73
+ {
74
+ if($index >= $this->count())
75
+ throw new OutOfRangeException('Index out of range');
76
+
77
+ return $this->_collection[$index];
78
+ }
79
+
80
+ /**
81
+ * Determine if index exists
82
+ * @param integer $index
83
+ * @return boolean
84
+ */
85
+ public function exists($index)
86
+ {
87
+ if($index >= $this->count())
88
+ return false;
89
+
90
+ return true;
91
+ }
92
+ /**
93
+ * Return count of items in collection
94
+ * Implements countable
95
+ * @return integer
96
+ */
97
+ public function count()
98
+ {
99
+ return count($this->_collection);
100
+ }
101
+
102
+
103
+ /**
104
+ * Return an iterator
105
+ * Implements IteratorAggregate
106
+ * @return ArrayIterator
107
+ */
108
+ public function getIterator()
109
+ {
110
+ return new ArrayIterator($this->_collection);
111
+ }
112
+
113
+ /**
114
+ * Set offset to value
115
+ * Implements ArrayAccess
116
+ * @see set
117
+ * @param integer $offset
118
+ * @param mixed $value
119
+ */
120
+ public function offsetSet($offset, $value)
121
+ {
122
+ $this->set($offset, $value);
123
+ }
124
+
125
+ /**
126
+ * Unset offset
127
+ * Implements ArrayAccess
128
+ * @see remove
129
+ * @param integer $offset
130
+ */
131
+ public function offsetUnset($offset)
132
+ {
133
+ $this->remove($offset);
134
+ }
135
+
136
+ /**
137
+ * get an offset's value
138
+ * Implements ArrayAccess
139
+ * @see get
140
+ * @param integer $offset
141
+ * @return mixed
142
+ */
143
+ public function offsetGet($offset)
144
+ {
145
+ return $this->get($offset);
146
+ }
147
+
148
+ /**
149
+ * Determine if offset exists
150
+ * Implements ArrayAccess
151
+ * @see exists
152
+ * @param integer $offset
153
+ * @return boolean
154
+ */
155
+ public function offsetExists($offset)
156
+ {
157
+ return $this->exists($offset);
158
+ }
159
+
160
+ }
161
+ class_alias('Braintree\Collection', 'Braintree_Collection');
lib/Jmango360/Braintree/lib/Braintree/Configuration.php ADDED
@@ -0,0 +1,602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ *
6
+ * Configuration registry
7
+ *
8
+ * @package Braintree
9
+ * @subpackage Utility
10
+ */
11
+
12
+ class Configuration
13
+ {
14
+ public static $global;
15
+
16
+ private $_environment = null;
17
+ private $_merchantId = null;
18
+ private $_publicKey = null;
19
+ private $_privateKey = null;
20
+ private $_clientId = null;
21
+ private $_clientSecret = null;
22
+ private $_accessToken = null;
23
+ private $_proxyHost = null;
24
+ private $_proxyPort = null;
25
+ private $_proxyType = null;
26
+ private $_proxyUser = null;
27
+ private $_proxyPassword = null;
28
+ private $_timeout = 60;
29
+ private $_sslVersion = null;
30
+ private $_acceptGzipEncoding = true;
31
+
32
+ /**
33
+ * Braintree API version to use
34
+ * @access public
35
+ */
36
+ const API_VERSION = 4;
37
+
38
+ public function __construct($attribs = [])
39
+ {
40
+ foreach ($attribs as $kind => $value) {
41
+ if ($kind == 'environment') {
42
+ CredentialsParser::assertValidEnvironment($value);
43
+ $this->_environment = $value;
44
+ }
45
+ if ($kind == 'merchantId') {
46
+ $this->_merchantId = $value;
47
+ }
48
+ if ($kind == 'publicKey') {
49
+ $this->_publicKey = $value;
50
+ }
51
+ if ($kind == 'privateKey') {
52
+ $this->_privateKey = $value;
53
+ }
54
+ }
55
+
56
+ if (isset($attribs['clientId']) || isset($attribs['accessToken'])) {
57
+ if (isset($attribs['environment']) || isset($attribs['merchantId']) || isset($attribs['publicKey']) || isset($attribs['privateKey'])) {
58
+ throw new Exception\Configuration('Cannot mix OAuth credentials (clientId, clientSecret, accessToken) with key credentials (publicKey, privateKey, environment, merchantId).');
59
+ }
60
+ $parsedCredentials = new CredentialsParser($attribs);
61
+
62
+ $this->_environment = $parsedCredentials->getEnvironment();
63
+ $this->_merchantId = $parsedCredentials->getMerchantId();
64
+ $this->_clientId = $parsedCredentials->getClientId();
65
+ $this->_clientSecret = $parsedCredentials->getClientSecret();
66
+ $this->_accessToken = $parsedCredentials->getAccessToken();
67
+ }
68
+ }
69
+
70
+ /**
71
+ * resets configuration to default
72
+ * @access public
73
+ */
74
+ public static function reset()
75
+ {
76
+ self::$global = new Configuration();
77
+ }
78
+
79
+ public static function gateway()
80
+ {
81
+ return new Gateway(self::$global);
82
+ }
83
+
84
+ public static function environment($value=null)
85
+ {
86
+ if (empty($value)) {
87
+ return self::$global->getEnvironment();
88
+ }
89
+ CredentialsParser::assertValidEnvironment($value);
90
+ self::$global->setEnvironment($value);
91
+ }
92
+
93
+ public static function merchantId($value=null)
94
+ {
95
+ if (empty($value)) {
96
+ return self::$global->getMerchantId();
97
+ }
98
+ self::$global->setMerchantId($value);
99
+ }
100
+
101
+ public static function publicKey($value=null)
102
+ {
103
+ if (empty($value)) {
104
+ return self::$global->getPublicKey();
105
+ }
106
+ self::$global->setPublicKey($value);
107
+ }
108
+
109
+ public static function privateKey($value=null)
110
+ {
111
+ if (empty($value)) {
112
+ return self::$global->getPrivateKey();
113
+ }
114
+ self::$global->setPrivateKey($value);
115
+ }
116
+
117
+ /**
118
+ * Sets or gets the read timeout to use for making requests.
119
+ *
120
+ * @param integer $value If provided, sets the read timeout
121
+ * @return integer The read timeout used for connecting to Braintree
122
+ */
123
+ public static function timeout($value=null)
124
+ {
125
+ if (empty($value)) {
126
+ return self::$global->getTimeout();
127
+ }
128
+ self::$global->setTimeout($value);
129
+ }
130
+
131
+ /**
132
+ * Sets or gets the SSL version to use for making requests. See
133
+ * http://php.net/manual/en/function.curl-setopt.php for possible
134
+ * CURLOPT_SSLVERSION values.
135
+ *
136
+ * @param integer $value If provided, sets the SSL version
137
+ * @return integer The SSL version used for connecting to Braintree
138
+ */
139
+ public static function sslVersion($value=null)
140
+ {
141
+ if (empty($value)) {
142
+ return self::$global->getSslVersion();
143
+ }
144
+ self::$global->setSslVersion($value);
145
+ }
146
+
147
+ /**
148
+ * Sets or gets the proxy host to use for connecting to Braintree
149
+ *
150
+ * @param string $value If provided, sets the proxy host
151
+ * @return string The proxy host used for connecting to Braintree
152
+ */
153
+ public static function proxyHost($value = null)
154
+ {
155
+ if (empty($value)) {
156
+ return self::$global->getProxyHost();
157
+ }
158
+ self::$global->setProxyHost($value);
159
+ }
160
+
161
+ /**
162
+ * Sets or gets the port of the proxy to use for connecting to Braintree
163
+ *
164
+ * @param string $value If provided, sets the port of the proxy
165
+ * @return string The port of the proxy used for connecting to Braintree
166
+ */
167
+ public static function proxyPort($value = null)
168
+ {
169
+ if (empty($value)) {
170
+ return self::$global->getProxyPort();
171
+ }
172
+ self::$global->setProxyPort($value);
173
+ }
174
+
175
+ /**
176
+ * Sets or gets the proxy type to use for connecting to Braintree. This value
177
+ * can be any of the CURLOPT_PROXYTYPE options in PHP cURL.
178
+ *
179
+ * @param string $value If provided, sets the proxy type
180
+ * @return string The proxy type used for connecting to Braintree
181
+ */
182
+ public static function proxyType($value = null)
183
+ {
184
+ if (empty($value)) {
185
+ return self::$global->getProxyType();
186
+ }
187
+ self::$global->setProxyType($value);
188
+ }
189
+
190
+ /**
191
+ * Specifies whether or not a proxy is properly configured
192
+ *
193
+ * @return bool true if a proxy is configured properly, false if not
194
+ */
195
+ public static function isUsingProxy()
196
+ {
197
+ $proxyHost = self::$global->getProxyHost();
198
+ $proxyPort = self::$global->getProxyPort();
199
+ return !empty($proxyHost) && !empty($proxyPort);
200
+ }
201
+
202
+ public static function proxyUser($value = null)
203
+ {
204
+ if (empty($value)) {
205
+ return self::$global->getProxyUser();
206
+ }
207
+ self::$global->setProxyUser($value);
208
+ }
209
+
210
+ public static function proxyPassword($value = null)
211
+ {
212
+ if (empty($value)) {
213
+ return self::$global->getProxyPassword();
214
+ }
215
+ self::$global->setProxyPassword($value);
216
+ }
217
+
218
+ /**
219
+ * Specified whether or not a username and password have been provided for
220
+ * use with an authenticated proxy
221
+ *
222
+ * @return bool true if both proxyUser and proxyPassword are present
223
+ */
224
+ public static function isAuthenticatedProxy()
225
+ {
226
+ $proxyUser = self::$global->getProxyUser();
227
+ $proxyPwd = self::$global->getProxyPassword();
228
+ return !empty($proxyUser) && !empty($proxyPwd);
229
+ }
230
+
231
+ /**
232
+ * Specify if the HTTP client is able to decode gzipped responses.
233
+ *
234
+ * @param bool $value If true, will send an Accept-Encoding header with a gzip value. If false, will not send an Accept-Encoding header with a gzip value.
235
+ * @return bool true if an Accept-Encoding header with a gzip value will be sent, false if not
236
+ */
237
+ public static function acceptGzipEncoding($value = null)
238
+ {
239
+ if (is_null($value)) {
240
+ return self::$global->getAcceptGzipEncoding();
241
+ }
242
+ self::$global->setAcceptGzipEncoding($value);
243
+ }
244
+
245
+ public static function assertGlobalHasAccessTokenOrKeys()
246
+ {
247
+ self::$global->assertHasAccessTokenOrKeys();
248
+ }
249
+
250
+ public function assertHasAccessTokenOrKeys()
251
+ {
252
+ if (empty($this->_accessToken)) {
253
+ if (empty($this->_merchantId)) {
254
+ throw new Exception\Configuration('Braintree\\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\\Gateway).');
255
+ } else if (empty($this->_environment)) {
256
+ throw new Exception\Configuration('Braintree\\Configuration::environment needs to be set.');
257
+ } else if (empty($this->_publicKey)) {
258
+ throw new Exception\Configuration('Braintree\\Configuration::publicKey needs to be set.');
259
+ } else if (empty($this->_privateKey)) {
260
+ throw new Exception\Configuration('Braintree\\Configuration::privateKey needs to be set.');
261
+ }
262
+ }
263
+ }
264
+
265
+ public function assertHasClientCredentials()
266
+ {
267
+ $this->assertHasClientId();
268
+ $this->assertHasClientSecret();
269
+ }
270
+
271
+ public function assertHasClientId()
272
+ {
273
+ if (empty($this->_clientId)) {
274
+ throw new Exception\Configuration('clientId needs to be passed to Braintree\\Gateway.');
275
+ }
276
+ }
277
+
278
+ public function assertHasClientSecret()
279
+ {
280
+ if (empty($this->_clientSecret)) {
281
+ throw new Exception\Configuration('clientSecret needs to be passed to Braintree\\Gateway.');
282
+ }
283
+ }
284
+
285
+ public function getEnvironment()
286
+ {
287
+ return $this->_environment;
288
+ }
289
+
290
+ /**
291
+ * Do not use this method directly. Pass in the environment to the constructor.
292
+ */
293
+ public function setEnvironment($value)
294
+ {
295
+ $this->_environment = $value;
296
+ }
297
+
298
+ public function getMerchantId()
299
+ {
300
+ return $this->_merchantId;
301
+ }
302
+
303
+ /**
304
+ * Do not use this method directly. Pass in the merchantId to the constructor.
305
+ */
306
+ public function setMerchantId($value)
307
+ {
308
+ $this->_merchantId = $value;
309
+ }
310
+
311
+ public function getPublicKey()
312
+ {
313
+ return $this->_publicKey;
314
+ }
315
+
316
+ public function getClientId()
317
+ {
318
+ return $this->_clientId;
319
+ }
320
+
321
+ /**
322
+ * Do not use this method directly. Pass in the publicKey to the constructor.
323
+ */
324
+ public function setPublicKey($value)
325
+ {
326
+ $this->_publicKey = $value;
327
+ }
328
+
329
+ public function getPrivateKey()
330
+ {
331
+ return $this->_privateKey;
332
+ }
333
+
334
+ public function getClientSecret()
335
+ {
336
+ return $this->_clientSecret;
337
+ }
338
+
339
+ /**
340
+ * Do not use this method directly. Pass in the privateKey to the constructor.
341
+ */
342
+ public function setPrivateKey($value)
343
+ {
344
+ $this->_privateKey = $value;
345
+ }
346
+
347
+ private function setProxyHost($value)
348
+ {
349
+ $this->_proxyHost = $value;
350
+ }
351
+
352
+ public function getProxyHost()
353
+ {
354
+ return $this->_proxyHost;
355
+ }
356
+
357
+ private function setProxyPort($value)
358
+ {
359
+ $this->_proxyPort = $value;
360
+ }
361
+
362
+ public function getProxyPort()
363
+ {
364
+ return $this->_proxyPort;
365
+ }
366
+
367
+ private function setProxyType($value)
368
+ {
369
+ $this->_proxyType = $value;
370
+ }
371
+
372
+ public function getProxyType()
373
+ {
374
+ return $this->_proxyType;
375
+ }
376
+
377
+ private function setProxyUser($value)
378
+ {
379
+ $this->_proxyUser = $value;
380
+ }
381
+
382
+ public function getProxyUser()
383
+ {
384
+ return $this->_proxyUser;
385
+ }
386
+
387
+ private function setProxyPassword($value)
388
+ {
389
+ $this->_proxyPassword = $value;
390
+ }
391
+
392
+ public function getProxyPassword()
393
+ {
394
+ return $this->_proxyPassword;
395
+ }
396
+
397
+ private function setTimeout($value)
398
+ {
399
+ $this->_timeout = $value;
400
+ }
401
+
402
+ public function getTimeout()
403
+ {
404
+ return $this->_timeout;
405
+ }
406
+
407
+ private function setSslVersion($value)
408
+ {
409
+ $this->_sslVersion = $value;
410
+ }
411
+
412
+ private function getSslVersion()
413
+ {
414
+ return $this->_sslVersion;
415
+ }
416
+
417
+ private function getAcceptGzipEncoding()
418
+ {
419
+ return $this->_acceptGzipEncoding;
420
+ }
421
+
422
+ private function setAcceptGzipEncoding($value)
423
+ {
424
+ $this->_acceptGzipEncoding = $value;
425
+ }
426
+
427
+ public function getAccessToken()
428
+ {
429
+ return $this->_accessToken;
430
+ }
431
+
432
+ public function isAccessToken()
433
+ {
434
+ return !empty($this->_accessToken);
435
+ }
436
+
437
+ public function isClientCredentials()
438
+ {
439
+ return !empty($this->_clientId);
440
+ }
441
+ /**
442
+ * returns the base braintree gateway URL based on config values
443
+ *
444
+ * @access public
445
+ * @param none
446
+ * @return string braintree gateway URL
447
+ */
448
+ public function baseUrl()
449
+ {
450
+ return sprintf('%s://%s:%d', $this->protocol(), $this->serverName(), $this->portNumber());
451
+ }
452
+
453
+ /**
454
+ * sets the merchant path based on merchant ID
455
+ *
456
+ * @access protected
457
+ * @param none
458
+ * @return string merchant path uri
459
+ */
460
+ public function merchantPath()
461
+ {
462
+ return '/merchants/' . $this->_merchantId;
463
+ }
464
+
465
+ /**
466
+ * sets the physical path for the location of the CA certs
467
+ *
468
+ * @access public
469
+ * @param none
470
+ * @return string filepath
471
+ */
472
+ public function caFile($sslPath = NULL)
473
+ {
474
+ $sslPath = $sslPath ? $sslPath : DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR .
475
+ 'ssl' . DIRECTORY_SEPARATOR;
476
+ $caPath = __DIR__ . $sslPath . 'api_braintreegateway_com.ca.crt';
477
+
478
+ if (!file_exists($caPath))
479
+ {
480
+ throw new Exception\SSLCaFileNotFound();
481
+ }
482
+
483
+ return $caPath;
484
+ }
485
+
486
+ /**
487
+ * returns the port number depending on environment
488
+ *
489
+ * @access public
490
+ * @param none
491
+ * @return int portnumber
492
+ */
493
+ public function portNumber()
494
+ {
495
+ if ($this->sslOn()) {
496
+ return 443;
497
+ }
498
+ return getenv("GATEWAY_PORT") ? getenv("GATEWAY_PORT") : 3000;
499
+ }
500
+
501
+ /**
502
+ * returns http protocol depending on environment
503
+ *
504
+ * @access public
505
+ * @param none
506
+ * @return string http || https
507
+ */
508
+ public function protocol()
509
+ {
510
+ return $this->sslOn() ? 'https' : 'http';
511
+ }
512
+
513
+ /**
514
+ * returns gateway server name depending on environment
515
+ *
516
+ * @access public
517
+ * @param none
518
+ * @return string server domain name
519
+ */
520
+ public function serverName()
521
+ {
522
+ switch($this->_environment) {
523
+ case 'production':
524
+ $serverName = 'api.braintreegateway.com';
525
+ break;
526
+ case 'qa':
527
+ $serverName = 'gateway.qa.braintreepayments.com';
528
+ break;
529
+ case 'sandbox':
530
+ $serverName = 'api.sandbox.braintreegateway.com';
531
+ break;
532
+ case 'development':
533
+ case 'integration':
534
+ default:
535
+ $serverName = 'localhost';
536
+ break;
537
+ }
538
+
539
+ return $serverName;
540
+ }
541
+
542
+ public function authUrl()
543
+ {
544
+ switch($this->_environment) {
545
+ case 'production':
546
+ $serverName = 'https://auth.venmo.com';
547
+ break;
548
+ case 'qa':
549
+ $serverName = 'https://auth.qa.venmo.com';
550
+ break;
551
+ case 'sandbox':
552
+ $serverName = 'https://auth.sandbox.venmo.com';
553
+ break;
554
+ case 'development':
555
+ case 'integration':
556
+ default:
557
+ $serverName = 'http://auth.venmo.dev:9292';
558
+ break;
559
+ }
560
+
561
+ return $serverName;
562
+ }
563
+
564
+ /**
565
+ * returns boolean indicating SSL is on or off for this session,
566
+ * depending on environment
567
+ *
568
+ * @access public
569
+ * @param none
570
+ * @return boolean
571
+ */
572
+ public function sslOn()
573
+ {
574
+ switch($this->_environment) {
575
+ case 'integration':
576
+ case 'development':
577
+ $ssl = false;
578
+ break;
579
+ case 'production':
580
+ case 'qa':
581
+ case 'sandbox':
582
+ default:
583
+ $ssl = true;
584
+ break;
585
+ }
586
+
587
+ return $ssl;
588
+ }
589
+
590
+ /**
591
+ * log message to default logger
592
+ *
593
+ * @param string $message
594
+ *
595
+ */
596
+ public function logMessage($message)
597
+ {
598
+ error_log('[Braintree] ' . $message);
599
+ }
600
+ }
601
+ Configuration::reset();
602
+ class_alias('Braintree\Configuration', 'Braintree_Configuration');
lib/Jmango360/Braintree/lib/Braintree/ConnectedMerchantPayPalStatusChanged.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Connected Merchant PayPal Status Changed Payload
6
+ *
7
+ * @package Braintree
8
+ *
9
+ * @property-read string $merchantPublicId
10
+ * @property-read string $action
11
+ * @property-read string $oauthApplicationClientId
12
+ */
13
+ class ConnectedMerchantPayPalStatusChanged extends Base
14
+ {
15
+ protected $_attributes = [];
16
+
17
+ /**
18
+ * @ignore
19
+ */
20
+ public static function factory($attributes)
21
+ {
22
+ $instance = new self();
23
+ $instance->_initialize($attributes);
24
+
25
+ return $instance;
26
+ }
27
+
28
+ /**
29
+ * @ignore
30
+ */
31
+ protected function _initialize($attributes)
32
+ {
33
+ $this->_attributes = $attributes;
34
+ }
35
+ }
36
+ class_alias('Braintree\ConnectedMerchantPayPalStatusChanged', 'Braintree_ConnectedMerchantPayPalStatusChanged');
lib/Jmango360/Braintree/lib/Braintree/ConnectedMerchantStatusTransitioned.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Connected Merchant Status Transitioned Payload
6
+ *
7
+ * @package Braintree
8
+ *
9
+ * @property-read string $merchantPublicId
10
+ * @property-read string $status
11
+ * @property-read string $oauthApplicationClientId
12
+ */
13
+ class ConnectedMerchantStatusTransitioned extends Base
14
+ {
15
+ protected $_attributes = [];
16
+
17
+ /**
18
+ * @ignore
19
+ */
20
+ public static function factory($attributes)
21
+ {
22
+ $instance = new self();
23
+ $instance->_initialize($attributes);
24
+
25
+ return $instance;
26
+ }
27
+
28
+ /**
29
+ * @ignore
30
+ */
31
+ protected function _initialize($attributes)
32
+ {
33
+ $this->_attributes = $attributes;
34
+ }
35
+ }
36
+ class_alias('Braintree\ConnectedMerchantStatusTransitioned', 'Braintree_ConnectedMerchantStatusTransitioned');
lib/Jmango360/Braintree/lib/Braintree/CredentialsParser.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ *
6
+ * CredentialsParser registry
7
+ *
8
+ * @package Braintree
9
+ * @subpackage Utility
10
+ */
11
+
12
+ class CredentialsParser
13
+ {
14
+ private $_clientId;
15
+ private $_clientSecret;
16
+ private $_accessToken;
17
+ private $_environment;
18
+ private $_merchantId;
19
+
20
+ public function __construct($attribs)
21
+ {
22
+ foreach ($attribs as $kind => $value) {
23
+ if ($kind == 'clientId') {
24
+ $this->_clientId = $value;
25
+ }
26
+ if ($kind == 'clientSecret') {
27
+ $this->_clientSecret = $value;
28
+ }
29
+ if ($kind == 'accessToken') {
30
+ $this->_accessToken = $value;
31
+ }
32
+ }
33
+ $this->parse();
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @access protected
39
+ * @static
40
+ * @var array valid environments, used for validation
41
+ */
42
+ private static $_validEnvironments = [
43
+ 'development',
44
+ 'integration',
45
+ 'sandbox',
46
+ 'production',
47
+ 'qa',
48
+ ];
49
+
50
+
51
+ public function parse()
52
+ {
53
+ $environments = [];
54
+ if (!empty($this->_clientId)) {
55
+ $environments[] = ['clientId', $this->_parseClientCredential('clientId', $this->_clientId, 'client_id')];
56
+ }
57
+ if (!empty($this->_clientSecret)) {
58
+ $environments[] = ['clientSecret', $this->_parseClientCredential('clientSecret', $this->_clientSecret, 'client_secret')];
59
+ }
60
+ if (!empty($this->_accessToken)) {
61
+ $environments[] = ['accessToken', $this->_parseAccessToken()];
62
+ }
63
+
64
+ $checkEnv = $environments[0];
65
+ foreach ($environments as $env) {
66
+ if ($env[1] !== $checkEnv[1]) {
67
+ throw new Exception\Configuration(
68
+ 'Mismatched credential environments: ' . $checkEnv[0] . ' environment is ' . $checkEnv[1] .
69
+ ' and ' . $env[0] . ' environment is ' . $env[1]);
70
+ }
71
+ }
72
+
73
+ self::assertValidEnvironment($checkEnv[1]);
74
+ $this->_environment = $checkEnv[1];
75
+ }
76
+
77
+ public static function assertValidEnvironment($environment) {
78
+ if (!in_array($environment, self::$_validEnvironments)) {
79
+ throw new Exception\Configuration('"' .
80
+ $environment . '" is not a valid environment.');
81
+ }
82
+ }
83
+
84
+ private function _parseClientCredential($credentialType, $value, $expectedValuePrefix)
85
+ {
86
+ $explodedCredential = explode('$', $value);
87
+ if (sizeof($explodedCredential) != 3) {
88
+ throw new Exception\Configuration('Incorrect ' . $credentialType . ' format. Expected: type$environment$token');
89
+ }
90
+
91
+ $gotValuePrefix = $explodedCredential[0];
92
+ $environment = $explodedCredential[1];
93
+ $token = $explodedCredential[2];
94
+
95
+ if ($gotValuePrefix != $expectedValuePrefix) {
96
+ throw new Exception\Configuration('Value passed for ' . $credentialType . ' is not a ' . $credentialType);
97
+ }
98
+
99
+ return $environment;
100
+ }
101
+
102
+ private function _parseAccessToken()
103
+ {
104
+ $accessTokenExploded = explode('$', $this->_accessToken);
105
+ if (sizeof($accessTokenExploded) != 4) {
106
+ throw new Exception\Configuration('Incorrect accessToken syntax. Expected: type$environment$merchant_id$token');
107
+ }
108
+
109
+ $gotValuePrefix = $accessTokenExploded[0];
110
+ $environment = $accessTokenExploded[1];
111
+ $merchantId = $accessTokenExploded[2];
112
+ $token = $accessTokenExploded[3];
113
+
114
+ if ($gotValuePrefix != 'access_token') {
115
+ throw new Exception\Configuration('Value passed for accessToken is not an accessToken');
116
+ }
117
+
118
+ $this->_merchantId = $merchantId;
119
+ return $environment;
120
+ }
121
+
122
+ public function getClientId()
123
+ {
124
+ return $this->_clientId;
125
+ }
126
+
127
+ public function getClientSecret()
128
+ {
129
+ return $this->_clientSecret;
130
+ }
131
+
132
+ public function getAccessToken()
133
+ {
134
+ return $this->_accessToken;
135
+ }
136
+
137
+ public function getEnvironment()
138
+ {
139
+ return $this->_environment;
140
+ }
141
+
142
+ public function getMerchantId()
143
+ {
144
+ return $this->_merchantId;
145
+ }
146
+ }
147
+ class_alias('Braintree\CredentialsParser', 'Braintree_CredentialsParser');
lib/Jmango360/Braintree/lib/Braintree/CreditCard.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree CreditCard module
6
+ * Creates and manages Braintree CreditCards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * For more detailed information on CreditCards, see {@link http://www.braintreepayments.com/gateway/credit-card-api http://www.braintreepaymentsolutions.com/gateway/credit-card-api}<br />
11
+ * For more detailed information on CreditCard verifications, see {@link http://www.braintreepayments.com/gateway/credit-card-verification-api http://www.braintreepaymentsolutions.com/gateway/credit-card-verification-api}
12
+ *
13
+ * @package Braintree
14
+ * @category Resources
15
+ *
16
+ * @property-read string $billingAddress
17
+ * @property-read string $bin
18
+ * @property-read string $cardType
19
+ * @property-read string $cardholderName
20
+ * @property-read string $createdAt
21
+ * @property-read string $customerId
22
+ * @property-read string $expirationDate
23
+ * @property-read string $expirationMonth
24
+ * @property-read string $expirationYear
25
+ * @property-read string $imageUrl
26
+ * @property-read string $last4
27
+ * @property-read string $maskedNumber
28
+ * @property-read string $token
29
+ * @property-read string $updatedAt
30
+ */
31
+ class CreditCard extends Base
32
+ {
33
+ // Card Type
34
+ const AMEX = 'American Express';
35
+ const CARTE_BLANCHE = 'Carte Blanche';
36
+ const CHINA_UNION_PAY = 'China UnionPay';
37
+ const DINERS_CLUB_INTERNATIONAL = 'Diners Club';
38
+ const DISCOVER = 'Discover';
39
+ const JCB = 'JCB';
40
+ const LASER = 'Laser';
41
+ const MAESTRO = 'Maestro';
42
+ const UK_MAESTRO = 'UK Maestro';
43
+ const MASTER_CARD = 'MasterCard';
44
+ const SOLO = 'Solo';
45
+ const SWITCH_TYPE = 'Switch';
46
+ const VISA = 'Visa';
47
+ const UNKNOWN = 'Unknown';
48
+
49
+ // Credit card origination location
50
+ const INTERNATIONAL = "international";
51
+ const US = "us";
52
+
53
+ const PREPAID_YES = 'Yes';
54
+ const PREPAID_NO = 'No';
55
+ const PREPAID_UNKNOWN = 'Unknown';
56
+
57
+ const PAYROLL_YES = 'Yes';
58
+ const PAYROLL_NO = 'No';
59
+ const PAYROLL_UNKNOWN = 'Unknown';
60
+
61
+ const HEALTHCARE_YES = 'Yes';
62
+ const HEALTHCARE_NO = 'No';
63
+ const HEALTHCARE_UNKNOWN = 'Unknown';
64
+
65
+ const DURBIN_REGULATED_YES = 'Yes';
66
+ const DURBIN_REGULATED_NO = 'No';
67
+ const DURBIN_REGULATED_UNKNOWN = 'Unknown';
68
+
69
+ const DEBIT_YES = 'Yes';
70
+ const DEBIT_NO = 'No';
71
+ const DEBIT_UNKNOWN = 'Unknown';
72
+
73
+ const COMMERCIAL_YES = 'Yes';
74
+ const COMMERCIAL_NO = 'No';
75
+ const COMMERCIAL_UNKNOWN = 'Unknown';
76
+
77
+ const COUNTRY_OF_ISSUANCE_UNKNOWN = "Unknown";
78
+ const ISSUING_BANK_UNKNOWN = "Unknown";
79
+ const PRODUCT_ID_UNKNOWN = "Unknown";
80
+
81
+ /* instance methods */
82
+ /**
83
+ * returns false if default is null or false
84
+ *
85
+ * @return boolean
86
+ */
87
+ public function isDefault()
88
+ {
89
+ return $this->default;
90
+ }
91
+
92
+ /**
93
+ * checks whether the card is expired based on the current date
94
+ *
95
+ * @return boolean
96
+ */
97
+ public function isExpired()
98
+ {
99
+ return $this->expired;
100
+ }
101
+
102
+ /**
103
+ * checks whether the card is associated with venmo sdk
104
+ *
105
+ * @return boolean
106
+ */
107
+ public function isVenmoSdk()
108
+ {
109
+ return $this->venmoSdk;
110
+ }
111
+
112
+ /**
113
+ * sets instance properties from an array of values
114
+ *
115
+ * @access protected
116
+ * @param array $creditCardAttribs array of creditcard data
117
+ * @return void
118
+ */
119
+ protected function _initialize($creditCardAttribs)
120
+ {
121
+ // set the attributes
122
+ $this->_attributes = $creditCardAttribs;
123
+
124
+ // map each address into its own object
125
+ $billingAddress = isset($creditCardAttribs['billingAddress']) ?
126
+ Address::factory($creditCardAttribs['billingAddress']) :
127
+ null;
128
+
129
+ $subscriptionArray = [];
130
+ if (isset($creditCardAttribs['subscriptions'])) {
131
+ foreach ($creditCardAttribs['subscriptions'] AS $subscription) {
132
+ $subscriptionArray[] = Subscription::factory($subscription);
133
+ }
134
+ }
135
+
136
+ $this->_set('subscriptions', $subscriptionArray);
137
+ $this->_set('billingAddress', $billingAddress);
138
+ $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
139
+ $this->_set('maskedNumber', $this->bin . '******' . $this->last4);
140
+
141
+ if(isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
142
+ $verifications = $creditCardAttribs['verifications'];
143
+ usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
144
+
145
+ $this->_set('verification', CreditCardVerification::factory($verifications[0]));
146
+ }
147
+ }
148
+
149
+ private function _compareCreatedAtOnVerifications($verificationAttrib1, $verificationAttrib2)
150
+ {
151
+ return ($verificationAttrib2['createdAt'] < $verificationAttrib1['createdAt']) ? -1 : 1;
152
+ }
153
+
154
+ /**
155
+ * returns false if comparing object is not a CreditCard,
156
+ * or is a CreditCard with a different id
157
+ *
158
+ * @param object $otherCreditCard customer to compare against
159
+ * @return boolean
160
+ */
161
+ public function isEqual($otherCreditCard)
162
+ {
163
+ return !($otherCreditCard instanceof self) ? false : $this->token === $otherCreditCard->token;
164
+ }
165
+
166
+ /**
167
+ * create a printable representation of the object as:
168
+ * ClassName[property=value, property=value]
169
+ * @return string
170
+ */
171
+ public function __toString()
172
+ {
173
+ return __CLASS__ . '[' .
174
+ Util::attributesToString($this->_attributes) .']';
175
+ }
176
+
177
+ /**
178
+ * factory method: returns an instance of CreditCard
179
+ * to the requesting method, with populated properties
180
+ *
181
+ * @ignore
182
+ * @return CreditCard
183
+ */
184
+ public static function factory($attributes)
185
+ {
186
+ $defaultAttributes = [
187
+ 'bin' => '',
188
+ 'expirationMonth' => '',
189
+ 'expirationYear' => '',
190
+ 'last4' => '',
191
+ ];
192
+
193
+ $instance = new self();
194
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
195
+ return $instance;
196
+ }
197
+
198
+
199
+ // static methods redirecting to gateway
200
+
201
+ public static function create($attribs)
202
+ {
203
+ return Configuration::gateway()->creditCard()->create($attribs);
204
+ }
205
+
206
+ public static function createNoValidate($attribs)
207
+ {
208
+ return Configuration::gateway()->creditCard()->createNoValidate($attribs);
209
+ }
210
+
211
+ public static function createFromTransparentRedirect($queryString)
212
+ {
213
+ return Configuration::gateway()->creditCard()->createFromTransparentRedirect($queryString);
214
+ }
215
+
216
+ public static function createCreditCardUrl()
217
+ {
218
+ return Configuration::gateway()->creditCard()->createCreditCardUrl();
219
+ }
220
+
221
+ public static function expired()
222
+ {
223
+ return Configuration::gateway()->creditCard()->expired();
224
+ }
225
+
226
+ public static function fetchExpired($ids)
227
+ {
228
+ return Configuration::gateway()->creditCard()->fetchExpired($ids);
229
+ }
230
+
231
+ public static function expiringBetween($startDate, $endDate)
232
+ {
233
+ return Configuration::gateway()->creditCard()->expiringBetween($startDate, $endDate);
234
+ }
235
+
236
+ public static function fetchExpiring($startDate, $endDate, $ids)
237
+ {
238
+ return Configuration::gateway()->creditCard()->fetchExpiring($startDate, $endDate, $ids);
239
+ }
240
+
241
+ public static function find($token)
242
+ {
243
+ return Configuration::gateway()->creditCard()->find($token);
244
+ }
245
+
246
+ public static function fromNonce($nonce)
247
+ {
248
+ return Configuration::gateway()->creditCard()->fromNonce($nonce);
249
+ }
250
+
251
+ public static function credit($token, $transactionAttribs)
252
+ {
253
+ return Configuration::gateway()->creditCard()->credit($token, $transactionAttribs);
254
+ }
255
+
256
+ public static function creditNoValidate($token, $transactionAttribs)
257
+ {
258
+ return Configuration::gateway()->creditCard()->creditNoValidate($token, $transactionAttribs);
259
+ }
260
+
261
+ public static function sale($token, $transactionAttribs)
262
+ {
263
+ return Configuration::gateway()->creditCard()->sale($token, $transactionAttribs);
264
+ }
265
+
266
+ public static function saleNoValidate($token, $transactionAttribs)
267
+ {
268
+ return Configuration::gateway()->creditCard()->saleNoValidate($token, $transactionAttribs);
269
+ }
270
+
271
+ public static function update($token, $attributes)
272
+ {
273
+ return Configuration::gateway()->creditCard()->update($token, $attributes);
274
+ }
275
+
276
+ public static function updateNoValidate($token, $attributes)
277
+ {
278
+ return Configuration::gateway()->creditCard()->updateNoValidate($token, $attributes);
279
+ }
280
+
281
+ public static function updateCreditCardUrl()
282
+ {
283
+ return Configuration::gateway()->creditCard()->updateCreditCardUrl();
284
+ }
285
+
286
+ public static function updateFromTransparentRedirect($queryString)
287
+ {
288
+ return Configuration::gateway()->creditCard()->updateFromTransparentRedirect($queryString);
289
+ }
290
+
291
+ public static function delete($token)
292
+ {
293
+ return Configuration::gateway()->creditCard()->delete($token);
294
+ }
295
+
296
+ /** @return array */
297
+ public static function allCardTypes()
298
+ {
299
+ return [
300
+ CreditCard::AMEX,
301
+ CreditCard::CARTE_BLANCHE,
302
+ CreditCard::CHINA_UNION_PAY,
303
+ CreditCard::DINERS_CLUB_INTERNATIONAL,
304
+ CreditCard::DISCOVER,
305
+ CreditCard::JCB,
306
+ CreditCard::LASER,
307
+ CreditCard::MAESTRO,
308
+ CreditCard::MASTER_CARD,
309
+ CreditCard::SOLO,
310
+ CreditCard::SWITCH_TYPE,
311
+ CreditCard::VISA,
312
+ CreditCard::UNKNOWN
313
+ ];
314
+ }
315
+ }
316
+ class_alias('Braintree\CreditCard', 'Braintree_CreditCard');
lib/Jmango360/Braintree/lib/Braintree/CreditCardGateway.php ADDED
@@ -0,0 +1,486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree CreditCardGateway module
8
+ * Creates and manages Braintree CreditCards
9
+ *
10
+ * <b>== More information ==</b>
11
+ *
12
+ * For more detailed information on CreditCards, see {@link http://www.braintreepayments.com/gateway/credit-card-api http://www.braintreepaymentsolutions.com/gateway/credit-card-api}<br />
13
+ * For more detailed information on CreditCard verifications, see {@link http://www.braintreepayments.com/gateway/credit-card-verification-api http://www.braintreepaymentsolutions.com/gateway/credit-card-verification-api}
14
+ *
15
+ * @package Braintree
16
+ * @category Resources
17
+ */
18
+ class CreditCardGateway
19
+ {
20
+ private $_gateway;
21
+ private $_config;
22
+ private $_http;
23
+
24
+ public function __construct($gateway)
25
+ {
26
+ $this->_gateway = $gateway;
27
+ $this->_config = $gateway->config;
28
+ $this->_config->assertHasAccessTokenOrKeys();
29
+ $this->_http = new Http($gateway->config);
30
+ }
31
+
32
+ public function create($attribs)
33
+ {
34
+ Util::verifyKeys(self::createSignature(), $attribs);
35
+ return $this->_doCreate('/payment_methods', ['credit_card' => $attribs]);
36
+ }
37
+
38
+ /**
39
+ * attempts the create operation assuming all data will validate
40
+ * returns a CreditCard object instead of a Result
41
+ *
42
+ * @access public
43
+ * @param array $attribs
44
+ * @return CreditCard
45
+ * @throws Exception\ValidationError
46
+ */
47
+ public function createNoValidate($attribs)
48
+ {
49
+ $result = $this->create($attribs);
50
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
51
+ }
52
+ /**
53
+ * create a customer from a TransparentRedirect operation
54
+ *
55
+ * @deprecated since version 2.3.0
56
+ * @access public
57
+ * @param array $attribs
58
+ * @return Result\Successful|Result\Error
59
+ */
60
+ public function createFromTransparentRedirect($queryString)
61
+ {
62
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
63
+ $params = TransparentRedirect::parseAndValidateQueryString(
64
+ $queryString
65
+ );
66
+ return $this->_doCreate(
67
+ '/payment_methods/all/confirm_transparent_redirect_request',
68
+ ['id' => $params['id']]
69
+ );
70
+ }
71
+
72
+ /**
73
+ *
74
+ * @deprecated since version 2.3.0
75
+ * @access public
76
+ * @param none
77
+ * @return string
78
+ */
79
+ public function createCreditCardUrl()
80
+ {
81
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
82
+ return $this->_config->baseUrl() . $this->_config->merchantPath().
83
+ '/payment_methods/all/create_via_transparent_redirect_request';
84
+ }
85
+
86
+ /**
87
+ * returns a ResourceCollection of expired credit cards
88
+ * @return ResourceCollection
89
+ */
90
+ public function expired()
91
+ {
92
+ $path = $this->_config->merchantPath() . '/payment_methods/all/expired_ids';
93
+ $response = $this->_http->post($path);
94
+ $pager = [
95
+ 'object' => $this,
96
+ 'method' => 'fetchExpired',
97
+ 'methodArgs' => []
98
+ ];
99
+
100
+ return new ResourceCollection($response, $pager);
101
+ }
102
+
103
+ public function fetchExpired($ids)
104
+ {
105
+ $path = $this->_config->merchantPath() . "/payment_methods/all/expired";
106
+ $response = $this->_http->post($path, ['search' => ['ids' => $ids]]);
107
+
108
+ return Util::extractattributeasarray(
109
+ $response['paymentMethods'],
110
+ 'creditCard'
111
+ );
112
+ }
113
+ /**
114
+ * returns a ResourceCollection of credit cards expiring between start/end
115
+ *
116
+ * @return ResourceCollection
117
+ */
118
+ public function expiringBetween($startDate, $endDate)
119
+ {
120
+ $queryPath = $this->_config->merchantPath() . '/payment_methods/all/expiring_ids?start=' . date('mY', $startDate) . '&end=' . date('mY', $endDate);
121
+ $response = $this->_http->post($queryPath);
122
+ $pager = [
123
+ 'object' => $this,
124
+ 'method' => 'fetchExpiring',
125
+ 'methodArgs' => [$startDate, $endDate]
126
+ ];
127
+
128
+ return new ResourceCollection($response, $pager);
129
+ }
130
+
131
+ public function fetchExpiring($startDate, $endDate, $ids)
132
+ {
133
+ $queryPath = $this->_config->merchantPath() . '/payment_methods/all/expiring?start=' . date('mY', $startDate) . '&end=' . date('mY', $endDate);
134
+ $response = $this->_http->post($queryPath, ['search' => ['ids' => $ids]]);
135
+
136
+ return Util::extractAttributeAsArray(
137
+ $response['paymentMethods'],
138
+ 'creditCard'
139
+ );
140
+ }
141
+
142
+ /**
143
+ * find a creditcard by token
144
+ *
145
+ * @access public
146
+ * @param string $token credit card unique id
147
+ * @return CreditCard
148
+ * @throws Exception\NotFound
149
+ */
150
+ public function find($token)
151
+ {
152
+ $this->_validateId($token);
153
+ try {
154
+ $path = $this->_config->merchantPath() . '/payment_methods/credit_card/' . $token;
155
+ $response = $this->_http->get($path);
156
+ return CreditCard::factory($response['creditCard']);
157
+ } catch (Exception\NotFound $e) {
158
+ throw new Exception\NotFound(
159
+ 'credit card with token ' . $token . ' not found'
160
+ );
161
+ }
162
+
163
+ }
164
+
165
+ /**
166
+ * Convert a payment method nonce to a credit card
167
+ *
168
+ * @access public
169
+ * @param string $nonce payment method nonce
170
+ * @return CreditCard
171
+ * @throws Exception\NotFound
172
+ */
173
+ public function fromNonce($nonce)
174
+ {
175
+ $this->_validateId($nonce, "nonce");
176
+ try {
177
+ $path = $this->_config->merchantPath() . '/payment_methods/from_nonce/' . $nonce;
178
+ $response = $this->_http->get($path);
179
+ return CreditCard::factory($response['creditCard']);
180
+ } catch (Exception\NotFound $e) {
181
+ throw new Exception\NotFound(
182
+ 'credit card with nonce ' . $nonce . ' locked, consumed or not found'
183
+ );
184
+ }
185
+
186
+ }
187
+
188
+ /**
189
+ * create a credit on the card for the passed transaction
190
+ *
191
+ * @access public
192
+ * @param array $attribs
193
+ * @return Result\Successful|Result\Error
194
+ */
195
+ public function credit($token, $transactionAttribs)
196
+ {
197
+ $this->_validateId($token);
198
+ return Transaction::credit(
199
+ array_merge(
200
+ $transactionAttribs,
201
+ ['paymentMethodToken' => $token]
202
+ )
203
+ );
204
+ }
205
+
206
+ /**
207
+ * create a credit on this card, assuming validations will pass
208
+ *
209
+ * returns a Transaction object on success
210
+ *
211
+ * @access public
212
+ * @param array $attribs
213
+ * @return Transaction
214
+ * @throws Exception\ValidationError
215
+ */
216
+ public function creditNoValidate($token, $transactionAttribs)
217
+ {
218
+ $result = $this->credit($token, $transactionAttribs);
219
+ return Util::returnObjectOrThrowException('Braintree\Transaction', $result);
220
+ }
221
+
222
+ /**
223
+ * create a new sale for the current card
224
+ *
225
+ * @param string $token
226
+ * @param array $transactionAttribs
227
+ * @return Result\Successful|Result\Error
228
+ * @see Transaction::sale()
229
+ */
230
+ public function sale($token, $transactionAttribs)
231
+ {
232
+ $this->_validateId($token);
233
+ return Transaction::sale(
234
+ array_merge(
235
+ $transactionAttribs,
236
+ ['paymentMethodToken' => $token]
237
+ )
238
+ );
239
+ }
240
+
241
+ /**
242
+ * create a new sale using this card, assuming validations will pass
243
+ *
244
+ * returns a Transaction object on success
245
+ *
246
+ * @access public
247
+ * @param array $transactionAttribs
248
+ * @param string $token
249
+ * @return Transaction
250
+ * @throws Exception\ValidationsFailed
251
+ * @see Transaction::sale()
252
+ */
253
+ public function saleNoValidate($token, $transactionAttribs)
254
+ {
255
+ $result = $this->sale($token, $transactionAttribs);
256
+ return Util::returnObjectOrThrowException('Braintree\Transaction', $result);
257
+ }
258
+
259
+ /**
260
+ * updates the creditcard record
261
+ *
262
+ * if calling this method in context, $token
263
+ * is the 2nd attribute. $token is not sent in object context.
264
+ *
265
+ * @access public
266
+ * @param array $attributes
267
+ * @param string $token (optional)
268
+ * @return Result\Successful|Result\Error
269
+ */
270
+ public function update($token, $attributes)
271
+ {
272
+ Util::verifyKeys(self::updateSignature(), $attributes);
273
+ $this->_validateId($token);
274
+ return $this->_doUpdate('put', '/payment_methods/credit_card/' . $token, ['creditCard' => $attributes]);
275
+ }
276
+
277
+ /**
278
+ * update a creditcard record, assuming validations will pass
279
+ *
280
+ * if calling this method in context, $token
281
+ * is the 2nd attribute. $token is not sent in object context.
282
+ * returns a CreditCard object on success
283
+ *
284
+ * @access public
285
+ * @param array $attributes
286
+ * @param string $token
287
+ * @return CreditCard
288
+ * @throws Exception\ValidationsFailed
289
+ */
290
+ public function updateNoValidate($token, $attributes)
291
+ {
292
+ $result = $this->update($token, $attributes);
293
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
294
+ }
295
+ /**
296
+ *
297
+ * @access public
298
+ * @param none
299
+ * @return string
300
+ */
301
+ public function updateCreditCardUrl()
302
+ {
303
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
304
+ return $this->_config->baseUrl() . $this->_config->merchantPath() .
305
+ '/payment_methods/all/update_via_transparent_redirect_request';
306
+ }
307
+
308
+ /**
309
+ * update a customer from a TransparentRedirect operation
310
+ *
311
+ * @deprecated since version 2.3.0
312
+ * @access public
313
+ * @param array $attribs
314
+ * @return object
315
+ */
316
+ public function updateFromTransparentRedirect($queryString)
317
+ {
318
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
319
+ $params = TransparentRedirect::parseAndValidateQueryString(
320
+ $queryString
321
+ );
322
+ return $this->_doUpdate(
323
+ 'post',
324
+ '/payment_methods/all/confirm_transparent_redirect_request',
325
+ ['id' => $params['id']]
326
+ );
327
+ }
328
+
329
+ public function delete($token)
330
+ {
331
+ $this->_validateId($token);
332
+ $path = $this->_config->merchantPath() . '/payment_methods/credit_card/' . $token;
333
+ $this->_http->delete($path);
334
+ return new Result\Successful();
335
+ }
336
+
337
+ private static function baseOptions()
338
+ {
339
+ return ['makeDefault', 'verificationMerchantAccountId', 'verifyCard', 'verificationAmount', 'venmoSdkSession'];
340
+ }
341
+
342
+ private static function baseSignature($options)
343
+ {
344
+ return [
345
+ 'billingAddressId', 'cardholderName', 'cvv', 'number', 'deviceSessionId',
346
+ 'expirationDate', 'expirationMonth', 'expirationYear', 'token', 'venmoSdkPaymentMethodCode',
347
+ 'deviceData', 'fraudMerchantId', 'paymentMethodNonce',
348
+ ['options' => $options],
349
+ [
350
+ 'billingAddress' => self::billingAddressSignature()
351
+ ],
352
+ ];
353
+ }
354
+
355
+ public static function billingAddressSignature()
356
+ {
357
+ return [
358
+ 'firstName',
359
+ 'lastName',
360
+ 'company',
361
+ 'countryCodeAlpha2',
362
+ 'countryCodeAlpha3',
363
+ 'countryCodeNumeric',
364
+ 'countryName',
365
+ 'extendedAddress',
366
+ 'locality',
367
+ 'region',
368
+ 'postalCode',
369
+ 'streetAddress'
370
+ ];
371
+ }
372
+
373
+ public static function createSignature()
374
+ {
375
+ $options = self::baseOptions();
376
+ $options[] = "failOnDuplicatePaymentMethod";
377
+ $signature = self::baseSignature($options);
378
+ $signature[] = 'customerId';
379
+ return $signature;
380
+ }
381
+
382
+ public static function updateSignature()
383
+ {
384
+ $options = self::baseOptions();
385
+ $options[] = "failOnDuplicatePaymentMethod";
386
+ $signature = self::baseSignature($options);
387
+
388
+ $updateExistingBillingSignature = [
389
+ [
390
+ 'options' => [
391
+ 'updateExisting'
392
+ ]
393
+ ]
394
+ ];
395
+
396
+ foreach($signature AS $key => $value) {
397
+ if(is_array($value) and array_key_exists('billingAddress', $value)) {
398
+ $signature[$key]['billingAddress'] = array_merge_recursive($value['billingAddress'], $updateExistingBillingSignature);
399
+ }
400
+ }
401
+
402
+ return $signature;
403
+ }
404
+
405
+ /**
406
+ * sends the create request to the gateway
407
+ *
408
+ * @ignore
409
+ * @param string $subPath
410
+ * @param array $params
411
+ * @return mixed
412
+ */
413
+ public function _doCreate($subPath, $params)
414
+ {
415
+ $fullPath = $this->_config->merchantPath() . $subPath;
416
+ $response = $this->_http->post($fullPath, $params);
417
+
418
+ return $this->_verifyGatewayResponse($response);
419
+ }
420
+
421
+ /**
422
+ * verifies that a valid credit card identifier is being used
423
+ * @ignore
424
+ * @param string $identifier
425
+ * @param Optional $string $identifierType type of identifier supplied, default "token"
426
+ * @throws InvalidArgumentException
427
+ */
428
+ private function _validateId($identifier = null, $identifierType = "token")
429
+ {
430
+ if (empty($identifier)) {
431
+ throw new InvalidArgumentException(
432
+ 'expected credit card id to be set'
433
+ );
434
+ }
435
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
436
+ throw new InvalidArgumentException(
437
+ $identifier . ' is an invalid credit card ' . $identifierType . '.'
438
+ );
439
+ }
440
+ }
441
+
442
+ /**
443
+ * sends the update request to the gateway
444
+ *
445
+ * @ignore
446
+ * @param string $url
447
+ * @param array $params
448
+ * @return mixed
449
+ */
450
+ private function _doUpdate($httpVerb, $subPath, $params)
451
+ {
452
+ $fullPath = $this->_config->merchantPath() . $subPath;
453
+ $response = $this->_http->$httpVerb($fullPath, $params);
454
+ return $this->_verifyGatewayResponse($response);
455
+ }
456
+
457
+ /**
458
+ * generic method for validating incoming gateway responses
459
+ *
460
+ * creates a new CreditCard object and encapsulates
461
+ * it inside a Result\Successful object, or
462
+ * encapsulates a Errors object inside a Result\Error
463
+ * alternatively, throws an Unexpected exception if the response is invalid
464
+ *
465
+ * @ignore
466
+ * @param array $response gateway response values
467
+ * @return Result\Successful|Result\Error
468
+ * @throws Exception\Unexpected
469
+ */
470
+ private function _verifyGatewayResponse($response)
471
+ {
472
+ if (isset($response['creditCard'])) {
473
+ // return a populated instance of Address
474
+ return new Result\Successful(
475
+ CreditCard::factory($response['creditCard'])
476
+ );
477
+ } elseif (isset($response['apiErrorResponse'])) {
478
+ return new Result\Error($response['apiErrorResponse']);
479
+ } else {
480
+ throw new Exception\Unexpected(
481
+ "Expected address or apiErrorResponse"
482
+ );
483
+ }
484
+ }
485
+ }
486
+ class_alias('Braintree\CreditCardGateway', 'Braintree_CreditCardGateway');
lib/Jmango360/Braintree/lib/Braintree/CreditCardVerification.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class CreditCardVerification extends Result\CreditCardVerification
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self($attributes);
9
+ return $instance;
10
+ }
11
+
12
+ // static methods redirecting to gateway
13
+ //
14
+ public static function create($attributes)
15
+ {
16
+ Util::verifyKeys(self::createSignature(), $attributes);
17
+ return Configuration::gateway()->creditCardVerification()->create($attributes);
18
+ }
19
+
20
+ public static function fetch($query, $ids)
21
+ {
22
+ return Configuration::gateway()->creditCardVerification()->fetch($query, $ids);
23
+ }
24
+
25
+ public static function search($query)
26
+ {
27
+ return Configuration::gateway()->creditCardVerification()->search($query);
28
+ }
29
+
30
+ public static function createSignature()
31
+ {
32
+ return [
33
+ ['options' => ['amount', 'merchantAccountId']],
34
+ ['creditCard' =>
35
+ [
36
+ 'cardholderName', 'cvv', 'number',
37
+ 'expirationDate', 'expirationMonth', 'expirationYear',
38
+ ['billingAddress' => CreditCardGateway::billingAddressSignature()]
39
+ ]
40
+ ]];
41
+ }
42
+ }
43
+ class_alias('Braintree\CreditCardVerification', 'Braintree_CreditCardVerification');
lib/Jmango360/Braintree/lib/Braintree/CreditCardVerificationGateway.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class CreditCardVerificationGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_config->assertHasAccessTokenOrKeys();
15
+ $this->_http = new Http($gateway->config);
16
+ }
17
+
18
+ public function create($attributes)
19
+ {
20
+ $response = $this->_http->post($this->_config->merchantPath() . "/verifications", ['verification' => $attributes]);
21
+ return $this->_verifyGatewayResponse($response);
22
+ }
23
+
24
+ private function _verifyGatewayResponse($response)
25
+ {
26
+
27
+ if(isset($response['verification'])){
28
+ return new Result\Successful(
29
+ CreditCardVerification::factory($response['verification'])
30
+ );
31
+ } else if (isset($response['apiErrorResponse'])) {
32
+ return new Result\Error($response['apiErrorResponse']);
33
+ } else {
34
+ throw new Exception\Unexpected(
35
+ "Expected transaction or apiErrorResponse"
36
+ );
37
+ }
38
+ }
39
+
40
+ public function fetch($query, $ids)
41
+ {
42
+ $criteria = [];
43
+ foreach ($query as $term) {
44
+ $criteria[$term->name] = $term->toparam();
45
+ }
46
+ $criteria["ids"] = CreditCardVerificationSearch::ids()->in($ids)->toparam();
47
+ $path = $this->_config->merchantPath() . '/verifications/advanced_search';
48
+ $response = $this->_http->post($path, ['search' => $criteria]);
49
+
50
+ return Util::extractattributeasarray(
51
+ $response['creditCardVerifications'],
52
+ 'verification'
53
+ );
54
+ }
55
+
56
+ public function search($query)
57
+ {
58
+ $criteria = [];
59
+ foreach ($query as $term) {
60
+ $criteria[$term->name] = $term->toparam();
61
+ }
62
+
63
+ $path = $this->_config->merchantPath() . '/verifications/advanced_search_ids';
64
+ $response = $this->_http->post($path, ['search' => $criteria]);
65
+ $pager = [
66
+ 'object' => $this,
67
+ 'method' => 'fetch',
68
+ 'methodArgs' => [$query]
69
+ ];
70
+
71
+ return new ResourceCollection($response, $pager);
72
+ }
73
+ }
74
+ class_alias('Braintree\CreditCardVerificationGateway', 'Braintree_CreditCardVerificationGateway');
lib/Jmango360/Braintree/lib/Braintree/CreditCardVerificationSearch.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class CreditCardVerificationSearch
5
+ {
6
+ public static function id() {
7
+ return new TextNode('id');
8
+ }
9
+
10
+ public static function creditCardCardholderName() {
11
+ return new TextNode('credit_card_cardholder_name');
12
+ }
13
+
14
+ public static function billingAddressDetailsPostalCode() {
15
+ return new TextNode('billing_address_details_postal_code');
16
+ }
17
+
18
+ public static function customerEmail() {
19
+ return new TextNode('customer_email');
20
+ }
21
+
22
+ public static function customerId() {
23
+ return new TextNode('customer_id');
24
+ }
25
+
26
+ public static function paymentMethodToken(){
27
+ return new TextNode('payment_method_token');
28
+ }
29
+
30
+ public static function creditCardExpirationDate() {
31
+ return new EqualityNode('credit_card_expiration_date');
32
+ }
33
+
34
+ public static function creditCardNumber() {
35
+ return new PartialMatchNode('credit_card_number');
36
+ }
37
+
38
+ public static function ids() {
39
+ return new MultipleValueNode('ids');
40
+ }
41
+
42
+ public static function createdAt() {
43
+ return new RangeNode("created_at");
44
+ }
45
+
46
+ public static function creditCardCardType()
47
+ {
48
+ return new MultipleValueNode("credit_card_card_type", CreditCard::allCardTypes());
49
+ }
50
+
51
+ public static function status()
52
+ {
53
+ return new MultipleValueNode("status", Result\CreditCardVerification::allStatuses());
54
+ }
55
+ }
56
+ class_alias('Braintree\CreditCardVerificationSearch', 'Braintree_CreditCardVerificationSearch');
lib/Jmango360/Braintree/lib/Braintree/Customer.php ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Customer module
6
+ * Creates and manages Customers
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * For more detailed information on Customers, see {@link http://www.braintreepayments.com/gateway/customer-api http://www.braintreepaymentsolutions.com/gateway/customer-api}
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read array $addresses
16
+ * @property-read array $paymentMethods
17
+ * @property-read string $company
18
+ * @property-read string $createdAt
19
+ * @property-read array $creditCards
20
+ * @property-read array $paypalAccounts
21
+ * @property-read array $applePayCards
22
+ * @property-read array $androidPayCards
23
+ * @property-read array $amexExpressCheckoutCards
24
+ * @property-read array $venmoAccounts
25
+ * @property-read array $visaCheckoutCards
26
+ * @property-read array $masterpassCards
27
+ * @property-read array $coinbaseAccounts
28
+ * @property-read array $customFields custom fields passed with the request
29
+ * @property-read string $email
30
+ * @property-read string $fax
31
+ * @property-read string $firstName
32
+ * @property-read string $id
33
+ * @property-read string $lastName
34
+ * @property-read string $phone
35
+ * @property-read string $updatedAt
36
+ * @property-read string $website
37
+ */
38
+ class Customer extends Base
39
+ {
40
+ /**
41
+ *
42
+ * @return Customer[]
43
+ */
44
+ public static function all()
45
+ {
46
+ return Configuration::gateway()->customer()->all();
47
+ }
48
+
49
+ /**
50
+ *
51
+ * @param string $query
52
+ * @param int[] $ids
53
+ * @return Customer|Customer[]
54
+ */
55
+ public static function fetch($query, $ids)
56
+ {
57
+ return Configuration::gateway()->customer()->fetch($query, $ids);
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @param array $attribs
63
+ * @return Result\Successful|Result\Error
64
+ */
65
+ public static function create($attribs = [])
66
+ {
67
+ return Configuration::gateway()->customer()->create($attribs);
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @param array $attribs
73
+ * @return Customer
74
+ */
75
+ public static function createNoValidate($attribs = [])
76
+ {
77
+ return Configuration::gateway()->customer()->createNoValidate($attribs);
78
+ }
79
+
80
+ /**
81
+ * @deprecated since version 2.3.0
82
+ * @param string $queryString
83
+ * @return Result\Successful
84
+ */
85
+ public static function createFromTransparentRedirect($queryString)
86
+ {
87
+ return Configuration::gateway()->customer()->createFromTransparentRedirect($queryString);
88
+ }
89
+
90
+ /**
91
+ * @deprecated since version 2.3.0
92
+ * @return string
93
+ */
94
+ public static function createCustomerUrl()
95
+ {
96
+ return Configuration::gateway()->customer()->createCustomerUrl();
97
+ }
98
+
99
+ /**
100
+ *
101
+ * @throws Exception\NotFound
102
+ * @param string $id customer id
103
+ * @return Customer
104
+ */
105
+ public static function find($id)
106
+ {
107
+ return Configuration::gateway()->customer()->find($id);
108
+ }
109
+
110
+ /**
111
+ *
112
+ * @param int $customerId
113
+ * @param array $transactionAttribs
114
+ * @return Result\Successful|Result\Error
115
+ */
116
+ public static function credit($customerId, $transactionAttribs)
117
+ {
118
+ return Configuration::gateway()->customer()->credit($customerId, $transactionAttribs);
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @throws Exception\ValidationError
124
+ * @param type $customerId
125
+ * @param type $transactionAttribs
126
+ * @return Transaction
127
+ */
128
+ public static function creditNoValidate($customerId, $transactionAttribs)
129
+ {
130
+ return Configuration::gateway()->customer()->creditNoValidate($customerId, $transactionAttribs);
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @throws Exception on invalid id or non-200 http response code
136
+ * @param int $customerId
137
+ * @return Result\Successful
138
+ */
139
+ public static function delete($customerId)
140
+ {
141
+ return Configuration::gateway()->customer()->delete($customerId);
142
+ }
143
+
144
+ /**
145
+ *
146
+ * @param int $customerId
147
+ * @param array $transactionAttribs
148
+ * @return Transaction
149
+ */
150
+ public static function sale($customerId, $transactionAttribs)
151
+ {
152
+ return Configuration::gateway()->customer()->sale($customerId, $transactionAttribs);
153
+ }
154
+
155
+ /**
156
+ *
157
+ * @param int $customerId
158
+ * @param array $transactionAttribs
159
+ * @return Transaction
160
+ */
161
+ public static function saleNoValidate($customerId, $transactionAttribs)
162
+ {
163
+ return Configuration::gateway()->customer()->saleNoValidate($customerId, $transactionAttribs);
164
+ }
165
+
166
+ /**
167
+ *
168
+ * @throws InvalidArgumentException
169
+ * @param string $query
170
+ * @return ResourceCollection
171
+ */
172
+ public static function search($query)
173
+ {
174
+ return Configuration::gateway()->customer()->search($query);
175
+ }
176
+
177
+ /**
178
+ *
179
+ * @throws Exception\Unexpected
180
+ * @param int $customerId
181
+ * @param array $attributes
182
+ * @return Result\Successful|Result\Error
183
+ */
184
+ public static function update($customerId, $attributes)
185
+ {
186
+ return Configuration::gateway()->customer()->update($customerId, $attributes);
187
+ }
188
+
189
+ /**
190
+ *
191
+ * @throws Exception\Unexpected
192
+ * @param int $customerId
193
+ * @param array $attributes
194
+ * @return CustomerGateway
195
+ */
196
+ public static function updateNoValidate($customerId, $attributes)
197
+ {
198
+ return Configuration::gateway()->customer()->updateNoValidate($customerId, $attributes);
199
+ }
200
+
201
+ /**
202
+ *
203
+ * @deprecated since version 2.3.0
204
+ * @return string
205
+ */
206
+ public static function updateCustomerUrl()
207
+ {
208
+ return Configuration::gateway()->customer()->updateCustomerUrl();
209
+ }
210
+
211
+ /**
212
+ *
213
+ * @deprecated since version 2.3.0
214
+ * @param string $queryString
215
+ * @return Result\Successful|Result\Error
216
+ */
217
+ public static function updateFromTransparentRedirect($queryString)
218
+ {
219
+ return Configuration::gateway()->customer()->updateFromTransparentRedirect($queryString);
220
+ }
221
+
222
+ /* instance methods */
223
+
224
+ /**
225
+ * sets instance properties from an array of values
226
+ *
227
+ * @ignore
228
+ * @access protected
229
+ * @param array $customerAttribs array of customer data
230
+ */
231
+ protected function _initialize($customerAttribs)
232
+ {
233
+ $this->_attributes = $customerAttribs;
234
+
235
+ $addressArray = [];
236
+ if (isset($customerAttribs['addresses'])) {
237
+
238
+ foreach ($customerAttribs['addresses'] AS $address) {
239
+ $addressArray[] = Address::factory($address);
240
+ }
241
+ }
242
+ $this->_set('addresses', $addressArray);
243
+
244
+ $creditCardArray = [];
245
+ if (isset($customerAttribs['creditCards'])) {
246
+ foreach ($customerAttribs['creditCards'] AS $creditCard) {
247
+ $creditCardArray[] = CreditCard::factory($creditCard);
248
+ }
249
+ }
250
+ $this->_set('creditCards', $creditCardArray);
251
+
252
+ $coinbaseAccountArray = [];
253
+ if (isset($customerAttribs['coinbaseAccounts'])) {
254
+ foreach ($customerAttribs['coinbaseAccounts'] AS $coinbaseAccount) {
255
+ $coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
256
+ }
257
+ }
258
+ $this->_set('coinbaseAccounts', $coinbaseAccountArray);
259
+
260
+ $paypalAccountArray = [];
261
+ if (isset($customerAttribs['paypalAccounts'])) {
262
+ foreach ($customerAttribs['paypalAccounts'] AS $paypalAccount) {
263
+ $paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
264
+ }
265
+ }
266
+ $this->_set('paypalAccounts', $paypalAccountArray);
267
+
268
+ $applePayCardArray = [];
269
+ if (isset($customerAttribs['applePayCards'])) {
270
+ foreach ($customerAttribs['applePayCards'] AS $applePayCard) {
271
+ $applePayCardArray[] = ApplePayCard::factory($applePayCard);
272
+ }
273
+ }
274
+ $this->_set('applePayCards', $applePayCardArray);
275
+
276
+ $androidPayCardArray = [];
277
+ if (isset($customerAttribs['androidPayCards'])) {
278
+ foreach ($customerAttribs['androidPayCards'] AS $androidPayCard) {
279
+ $androidPayCardArray[] = AndroidPayCard::factory($androidPayCard);
280
+ }
281
+ }
282
+ $this->_set('androidPayCards', $androidPayCardArray);
283
+
284
+ $amexExpressCheckoutCardArray = [];
285
+ if (isset($customerAttribs['amexExpressCheckoutCards'])) {
286
+ foreach ($customerAttribs['amexExpressCheckoutCards'] AS $amexExpressCheckoutCard) {
287
+ $amexExpressCheckoutCardArray[] = AmexExpressCheckoutCard::factory($amexExpressCheckoutCard);
288
+ }
289
+ }
290
+ $this->_set('amexExpressCheckoutCards', $amexExpressCheckoutCardArray);
291
+
292
+ $venmoAccountArray = array();
293
+ if (isset($customerAttribs['venmoAccounts'])) {
294
+ foreach ($customerAttribs['venmoAccounts'] AS $venmoAccount) {
295
+ $venmoAccountArray[] = VenmoAccount::factory($venmoAccount);
296
+ }
297
+ }
298
+ $this->_set('venmoAccounts', $venmoAccountArray);
299
+
300
+ $visaCheckoutCardArray = [];
301
+ if (isset($customerAttribs['visaCheckoutCards'])) {
302
+ foreach ($customerAttribs['visaCheckoutCards'] AS $visaCheckoutCard) {
303
+ $visaCheckoutCardArray[] = VisaCheckoutCard::factory($visaCheckoutCard);
304
+ }
305
+ }
306
+ $this->_set('visaCheckoutCards', $visaCheckoutCardArray);
307
+
308
+ $masterpassCardArray = [];
309
+ if (isset($customerAttribs['masterpassCards'])) {
310
+ foreach ($customerAttribs['masterpassCards'] AS $masterpassCard) {
311
+ $masterpassCardArray[] = MasterpassCard::factory($masterpassCard);
312
+ }
313
+ }
314
+ $this->_set('masterpassCards', $masterpassCardArray);
315
+
316
+ $usBankAccountArray = array();
317
+ if (isset($customerAttribs['usBankAccounts'])) {
318
+ foreach ($customerAttribs['usBankAccounts'] AS $usBankAccount) {
319
+ $usBankAccountArray[] = UsBankAccount::factory($usBankAccount);
320
+ }
321
+ }
322
+ $this->_set('usBankAccounts', $usBankAccountArray);
323
+
324
+ $this->_set('paymentMethods', array_merge(
325
+ $this->creditCards,
326
+ $this->paypalAccounts,
327
+ $this->applePayCards,
328
+ $this->coinbaseAccounts,
329
+ $this->androidPayCards,
330
+ $this->amexExpressCheckoutCards,
331
+ $this->venmoAccounts,
332
+ $this->visaCheckoutCards,
333
+ $this->masterpassCards,
334
+ $this->usBankAccounts
335
+ ));
336
+ }
337
+
338
+ /**
339
+ * returns a string representation of the customer
340
+ * @return string
341
+ */
342
+ public function __toString()
343
+ {
344
+ return __CLASS__ . '[' .
345
+ Util::attributesToString($this->_attributes) .']';
346
+ }
347
+
348
+ /**
349
+ * returns false if comparing object is not a Customer,
350
+ * or is a Customer with a different id
351
+ *
352
+ * @param object $otherCust customer to compare against
353
+ * @return boolean
354
+ */
355
+ public function isEqual($otherCust)
356
+ {
357
+ return !($otherCust instanceof Customer) ? false : $this->id === $otherCust->id;
358
+ }
359
+
360
+ /**
361
+ * returns an array containt all of the customer's payment methods
362
+ *
363
+ * @deprecated since version 3.1.0 - use the paymentMethods property directly
364
+ *
365
+ * @return array
366
+ */
367
+ public function paymentMethods()
368
+ {
369
+ return $this->paymentMethods;
370
+ }
371
+
372
+ /**
373
+ * returns the customer's default payment method
374
+ *
375
+ * @return CreditCard|PayPalAccount
376
+ */
377
+ public function defaultPaymentMethod()
378
+ {
379
+ $defaultPaymentMethods = array_filter($this->paymentMethods, 'Braintree\Customer::_defaultPaymentMethodFilter');
380
+ return current($defaultPaymentMethods);
381
+ }
382
+
383
+ public static function _defaultPaymentMethodFilter($paymentMethod)
384
+ {
385
+ return $paymentMethod->isDefault();
386
+ }
387
+
388
+ /* private class properties */
389
+
390
+ /**
391
+ * @access protected
392
+ * @var array registry of customer data
393
+ */
394
+ protected $_attributes = [
395
+ 'addresses' => '',
396
+ 'company' => '',
397
+ 'creditCards' => '',
398
+ 'email' => '',
399
+ 'fax' => '',
400
+ 'firstName' => '',
401
+ 'id' => '',
402
+ 'lastName' => '',
403
+ 'phone' => '',
404
+ 'createdAt' => '',
405
+ 'updatedAt' => '',
406
+ 'website' => '',
407
+ ];
408
+
409
+ /**
410
+ * factory method: returns an instance of Customer
411
+ * to the requesting method, with populated properties
412
+ *
413
+ * @ignore
414
+ * @param array $attributes
415
+ * @return Customer
416
+ */
417
+ public static function factory($attributes)
418
+ {
419
+ $instance = new Customer();
420
+ $instance->_initialize($attributes);
421
+ return $instance;
422
+ }
423
+ }
424
+ class_alias('Braintree\Customer', 'Braintree_Customer');
lib/Jmango360/Braintree/lib/Braintree/CustomerGateway.php ADDED
@@ -0,0 +1,637 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree CustomerGateway module
8
+ * Creates and manages Customers
9
+ *
10
+ * <b>== More information ==</b>
11
+ *
12
+ * For more detailed information on Customers, see {@link http://www.braintreepayments.com/gateway/customer-api http://www.braintreepaymentsolutions.com/gateway/customer-api}
13
+ *
14
+ * @package Braintree
15
+ * @category Resources
16
+ */
17
+ class CustomerGateway
18
+ {
19
+ private $_gateway;
20
+ private $_config;
21
+ private $_http;
22
+
23
+ public function __construct($gateway)
24
+ {
25
+ $this->_gateway = $gateway;
26
+ $this->_config = $gateway->config;
27
+ $this->_config->assertHasAccessTokenOrKeys();
28
+ $this->_http = new Http($gateway->config);
29
+ }
30
+
31
+ public function all()
32
+ {
33
+ $path = $this->_config->merchantPath() . '/customers/advanced_search_ids';
34
+ $response = $this->_http->post($path);
35
+ $pager = [
36
+ 'object' => $this,
37
+ 'method' => 'fetch',
38
+ 'methodArgs' => [[]]
39
+ ];
40
+
41
+ return new ResourceCollection($response, $pager);
42
+ }
43
+
44
+ public function fetch($query, $ids)
45
+ {
46
+ $criteria = [];
47
+ foreach ($query as $term) {
48
+ $criteria[$term->name] = $term->toparam();
49
+ }
50
+ $criteria["ids"] = CustomerSearch::ids()->in($ids)->toparam();
51
+ $path = $this->_config->merchantPath() . '/customers/advanced_search';
52
+ $response = $this->_http->post($path, ['search' => $criteria]);
53
+
54
+ return Util::extractattributeasarray(
55
+ $response['customers'],
56
+ 'customer'
57
+ );
58
+ }
59
+
60
+ /**
61
+ * Creates a customer using the given +attributes+. If <tt>:id</tt> is not passed,
62
+ * the gateway will generate it.
63
+ *
64
+ * <code>
65
+ * $result = Customer::create(array(
66
+ * 'first_name' => 'John',
67
+ * 'last_name' => 'Smith',
68
+ * 'company' => 'Smith Co.',
69
+ * 'email' => 'john@smith.com',
70
+ * 'website' => 'www.smithco.com',
71
+ * 'fax' => '419-555-1234',
72
+ * 'phone' => '614-555-1234'
73
+ * ));
74
+ * if($result->success) {
75
+ * echo 'Created customer ' . $result->customer->id;
76
+ * } else {
77
+ * echo 'Could not create customer, see result->errors';
78
+ * }
79
+ * </code>
80
+ *
81
+ * @access public
82
+ * @param array $attribs
83
+ * @return Braintree_Result_Successful|Braintree_Result_Error
84
+ */
85
+ public function create($attribs = [])
86
+ {
87
+ Util::verifyKeys(self::createSignature(), $attribs);
88
+ return $this->_doCreate('/customers', ['customer' => $attribs]);
89
+ }
90
+
91
+ /**
92
+ * attempts the create operation assuming all data will validate
93
+ * returns a Customer object instead of a Result
94
+ *
95
+ * @access public
96
+ * @param array $attribs
97
+ * @return Customer
98
+ * @throws Exception\ValidationError
99
+ */
100
+ public function createNoValidate($attribs = [])
101
+ {
102
+ $result = $this->create($attribs);
103
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
104
+ }
105
+ /**
106
+ * create a customer from a TransparentRedirect operation
107
+ *
108
+ * @deprecated since version 2.3.0
109
+ * @access public
110
+ * @param array $attribs
111
+ * @return Customer
112
+ */
113
+ public function createFromTransparentRedirect($queryString)
114
+ {
115
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
116
+ $params = TransparentRedirect::parseAndValidateQueryString(
117
+ $queryString
118
+ );
119
+ return $this->_doCreate(
120
+ '/customers/all/confirm_transparent_redirect_request',
121
+ ['id' => $params['id']]
122
+ );
123
+ }
124
+
125
+ /**
126
+ *
127
+ * @deprecated since version 2.3.0
128
+ * @access public
129
+ * @param none
130
+ * @return string
131
+ */
132
+ public function createCustomerUrl()
133
+ {
134
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
135
+ return $this->_config->baseUrl() . $this->_config->merchantPath() .
136
+ '/customers/all/create_via_transparent_redirect_request';
137
+ }
138
+
139
+
140
+ /**
141
+ * creates a full array signature of a valid create request
142
+ * @return array gateway create request format
143
+ */
144
+ public static function createSignature()
145
+ {
146
+ $creditCardSignature = CreditCardGateway::createSignature();
147
+ unset($creditCardSignature[array_search('customerId', $creditCardSignature)]);
148
+
149
+ $signature = [
150
+ 'id', 'company', 'email', 'fax', 'firstName',
151
+ 'lastName', 'phone', 'website', 'deviceData',
152
+ 'deviceSessionId', 'fraudMerchantId', 'paymentMethodNonce',
153
+ ['riskData' =>
154
+ ['customerBrowser', 'customerIp', 'customer_browser', 'customer_ip']
155
+ ],
156
+ ['creditCard' => $creditCardSignature],
157
+ ['customFields' => ['_anyKey_']],
158
+ ['options' => [
159
+ ['paypal' => [
160
+ 'payee_email',
161
+ 'order_id',
162
+ 'custom_field',
163
+ 'description',
164
+ 'amount',
165
+ ]]
166
+ ]],
167
+ ];
168
+ return $signature;
169
+ }
170
+
171
+ /**
172
+ * creates a full array signature of a valid update request
173
+ * @return array update request format
174
+ */
175
+ public static function updateSignature()
176
+ {
177
+ $creditCardSignature = CreditCardGateway::updateSignature();
178
+
179
+ foreach($creditCardSignature AS $key => $value) {
180
+ if(is_array($value) and array_key_exists('options', $value)) {
181
+ array_push($creditCardSignature[$key]['options'], 'updateExistingToken');
182
+ }
183
+ }
184
+
185
+ $signature = [
186
+ 'id', 'company', 'email', 'fax', 'firstName',
187
+ 'lastName', 'phone', 'website', 'deviceData',
188
+ 'deviceSessionId', 'fraudMerchantId', 'paymentMethodNonce', 'defaultPaymentMethodToken',
189
+ ['creditCard' => $creditCardSignature],
190
+ ['customFields' => ['_anyKey_']],
191
+ ['options' => [
192
+ ['paypal' => ['payee_email']],
193
+ ]],
194
+ ];
195
+ return $signature;
196
+ }
197
+
198
+
199
+ /**
200
+ * find a customer by id
201
+ *
202
+ * @access public
203
+ * @param string id customer Id
204
+ * @return Customer|boolean The customer object or false if the request fails.
205
+ * @throws Exception\NotFound
206
+ */
207
+ public function find($id)
208
+ {
209
+ $this->_validateId($id);
210
+ try {
211
+ $path = $this->_config->merchantPath() . '/customers/' . $id;
212
+ $response = $this->_http->get($path);
213
+ return Customer::factory($response['customer']);
214
+ } catch (Exception\NotFound $e) {
215
+ throw new Exception\NotFound(
216
+ 'customer with id ' . $id . ' not found'
217
+ );
218
+ }
219
+ }
220
+
221
+ /**
222
+ * credit a customer for the passed transaction
223
+ *
224
+ * @access public
225
+ * @param int $customerId
226
+ * @param array $transactionAttribs
227
+ * @return Result\Successful|Result\Error
228
+ */
229
+ public function credit($customerId, $transactionAttribs)
230
+ {
231
+ $this->_validateId($customerId);
232
+ return Transaction::credit(
233
+ array_merge($transactionAttribs,
234
+ ['customerId' => $customerId]
235
+ )
236
+ );
237
+ }
238
+
239
+ /**
240
+ * credit a customer, assuming validations will pass
241
+ *
242
+ * returns a Transaction object on success
243
+ *
244
+ * @access public
245
+ * @param int $customerId
246
+ * @param array $transactionAttribs
247
+ * @return Transaction
248
+ * @throws Exception\ValidationError
249
+ */
250
+ public function creditNoValidate($customerId, $transactionAttribs)
251
+ {
252
+ $result = $this->credit($customerId, $transactionAttribs);
253
+ return Util::returnObjectOrThrowException('Braintree\Transaction', $result);
254
+ }
255
+
256
+ /**
257
+ * delete a customer by id
258
+ *
259
+ * @param string $customerId
260
+ */
261
+ public function delete($customerId)
262
+ {
263
+ $this->_validateId($customerId);
264
+ $path = $this->_config->merchantPath() . '/customers/' . $customerId;
265
+ $this->_http->delete($path);
266
+ return new Result\Successful();
267
+ }
268
+
269
+ /**
270
+ * create a new sale for a customer
271
+ *
272
+ * @param string $customerId
273
+ * @param array $transactionAttribs
274
+ * @return Result\Successful|Result\Error
275
+ * @see Transaction::sale()
276
+ */
277
+ public function sale($customerId, $transactionAttribs)
278
+ {
279
+ $this->_validateId($customerId);
280
+ return Transaction::sale(
281
+ array_merge($transactionAttribs,
282
+ ['customerId' => $customerId]
283
+ )
284
+ );
285
+ }
286
+
287
+ /**
288
+ * create a new sale for a customer, assuming validations will pass
289
+ *
290
+ * returns a Transaction object on success
291
+ * @access public
292
+ * @param string $customerId
293
+ * @param array $transactionAttribs
294
+ * @return Transaction
295
+ * @throws Exception\ValidationsFailed
296
+ * @see Transaction::sale()
297
+ */
298
+ public function saleNoValidate($customerId, $transactionAttribs)
299
+ {
300
+ $result = $this->sale($customerId, $transactionAttribs);
301
+ return Util::returnObjectOrThrowException('Braintree\Transaction', $result);
302
+ }
303
+
304
+ /**
305
+ * Returns a ResourceCollection of customers matching the search query.
306
+ *
307
+ * If <b>query</b> is a string, the search will be a basic search.
308
+ * If <b>query</b> is a hash, the search will be an advanced search.
309
+ * For more detailed information and examples, see {@link http://www.braintreepayments.com/gateway/customer-api#searching http://www.braintreepaymentsolutions.com/gateway/customer-api}
310
+ *
311
+ * @param mixed $query search query
312
+ * @return ResourceCollection
313
+ * @throws InvalidArgumentException
314
+ */
315
+ public function search($query)
316
+ {
317
+ $criteria = [];
318
+ foreach ($query as $term) {
319
+ $result = $term->toparam();
320
+ if(is_null($result) || empty($result)) {
321
+ throw new InvalidArgumentException('Operator must be provided');
322
+ }
323
+
324
+ $criteria[$term->name] = $term->toparam();
325
+ }
326
+
327
+ $path = $this->_config->merchantPath() . '/customers/advanced_search_ids';
328
+ $response = $this->_http->post($path, ['search' => $criteria]);
329
+ $pager = [
330
+ 'object' => $this,
331
+ 'method' => 'fetch',
332
+ 'methodArgs' => [$query]
333
+ ];
334
+
335
+ return new ResourceCollection($response, $pager);
336
+ }
337
+
338
+ /**
339
+ * updates the customer record
340
+ *
341
+ * if calling this method in static context, customerId
342
+ * is the 2nd attribute. customerId is not sent in object context.
343
+ *
344
+ * @access public
345
+ * @param string $customerId (optional)
346
+ * @param array $attributes
347
+ * @return Result\Successful|Result\Error
348
+ */
349
+ public function update($customerId, $attributes)
350
+ {
351
+ Util::verifyKeys(self::updateSignature(), $attributes);
352
+ $this->_validateId($customerId);
353
+ return $this->_doUpdate(
354
+ 'put',
355
+ '/customers/' . $customerId,
356
+ ['customer' => $attributes]
357
+ );
358
+ }
359
+
360
+ /**
361
+ * update a customer record, assuming validations will pass
362
+ *
363
+ * if calling this method in static context, customerId
364
+ * is the 2nd attribute. customerId is not sent in object context.
365
+ * returns a Customer object on success
366
+ *
367
+ * @access public
368
+ * @param string $customerId
369
+ * @param array $attributes
370
+ * @return Customer
371
+ * @throws Exception\ValidationsFailed
372
+ */
373
+ public function updateNoValidate($customerId, $attributes)
374
+ {
375
+ $result = $this->update($customerId, $attributes);
376
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
377
+ }
378
+ /**
379
+ *
380
+ * @deprecated since version 2.3.0
381
+ * @access public
382
+ * @return string
383
+ */
384
+ public function updateCustomerUrl()
385
+ {
386
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
387
+ return $this->_config->baseUrl() . $this->_config->merchantPath() .
388
+ '/customers/all/update_via_transparent_redirect_request';
389
+ }
390
+
391
+ /**
392
+ * update a customer from a TransparentRedirect operation
393
+ *
394
+ * @deprecated since version 2.3.0
395
+ * @access public
396
+ * @param string $queryString
397
+ * @return object
398
+ */
399
+ public function updateFromTransparentRedirect($queryString)
400
+ {
401
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
402
+ $params = TransparentRedirect::parseAndValidateQueryString(
403
+ $queryString
404
+ );
405
+ return $this->_doUpdate(
406
+ 'post',
407
+ '/customers/all/confirm_transparent_redirect_request',
408
+ ['id' => $params['id']]
409
+ );
410
+ }
411
+
412
+ /* instance methods */
413
+
414
+ /**
415
+ * sets instance properties from an array of values
416
+ *
417
+ * @ignore
418
+ * @access protected
419
+ * @param array $customerAttribs array of customer data
420
+ * @return void
421
+ */
422
+ protected function _initialize($customerAttribs)
423
+ {
424
+ // set the attributes
425
+ $this->_attributes = $customerAttribs;
426
+
427
+ // map each address into its own object
428
+ $addressArray = [];
429
+ if (isset($customerAttribs['addresses'])) {
430
+
431
+ foreach ($customerAttribs['addresses'] AS $address) {
432
+ $addressArray[] = Address::factory($address);
433
+ }
434
+ }
435
+ $this->_set('addresses', $addressArray);
436
+
437
+ // map each creditCard into its own object
438
+ $creditCardArray = [];
439
+ if (isset($customerAttribs['creditCards'])) {
440
+ foreach ($customerAttribs['creditCards'] AS $creditCard) {
441
+ $creditCardArray[] = CreditCard::factory($creditCard);
442
+ }
443
+ }
444
+ $this->_set('creditCards', $creditCardArray);
445
+
446
+ // map each coinbaseAccount into its own object
447
+ $coinbaseAccountArray = [];
448
+ if (isset($customerAttribs['coinbaseAccounts'])) {
449
+ foreach ($customerAttribs['coinbaseAccounts'] AS $coinbaseAccount) {
450
+ $coinbaseAccountArray[] = CoinbaseAccount::factory($coinbaseAccount);
451
+ }
452
+ }
453
+ $this->_set('coinbaseAccounts', $coinbaseAccountArray);
454
+
455
+ // map each paypalAccount into its own object
456
+ $paypalAccountArray = [];
457
+ if (isset($customerAttribs['paypalAccounts'])) {
458
+ foreach ($customerAttribs['paypalAccounts'] AS $paypalAccount) {
459
+ $paypalAccountArray[] = PayPalAccount::factory($paypalAccount);
460
+ }
461
+ }
462
+ $this->_set('paypalAccounts', $paypalAccountArray);
463
+
464
+ // map each applePayCard into its own object
465
+ $applePayCardArray = [];
466
+ if (isset($customerAttribs['applePayCards'])) {
467
+ foreach ($customerAttribs['applePayCards'] AS $applePayCard) {
468
+ $applePayCardArray[] = ApplePayCard::factory($applePayCard);
469
+ }
470
+ }
471
+ $this->_set('applePayCards', $applePayCardArray);
472
+
473
+ // map each androidPayCard into its own object
474
+ $androidPayCardArray = [];
475
+ if (isset($customerAttribs['androidPayCards'])) {
476
+ foreach ($customerAttribs['androidPayCards'] AS $androidPayCard) {
477
+ $androidPayCardArray[] = AndroidPayCard::factory($androidPayCard);
478
+ }
479
+ }
480
+ $this->_set('androidPayCards', $androidPayCardArray);
481
+
482
+ $this->_set('paymentMethods', array_merge($this->creditCards, $this->paypalAccounts, $this->applePayCards, $this->coinbaseAccounts, $this->androidPayCards));
483
+ }
484
+
485
+ /**
486
+ * returns a string representation of the customer
487
+ * @return string
488
+ */
489
+ public function __toString()
490
+ {
491
+ return __CLASS__ . '[' .
492
+ Util::attributesToString($this->_attributes) .']';
493
+ }
494
+
495
+ /**
496
+ * returns false if comparing object is not a Customer,
497
+ * or is a Customer with a different id
498
+ *
499
+ * @param object $otherCust customer to compare against
500
+ * @return boolean
501
+ */
502
+ public function isEqual($otherCust)
503
+ {
504
+ return !($otherCust instanceof Customer) ? false : $this->id === $otherCust->id;
505
+ }
506
+
507
+ /**
508
+ * returns an array containt all of the customer's payment methods
509
+ *
510
+ * @return array
511
+ */
512
+ public function paymentMethods()
513
+ {
514
+ return $this->paymentMethods;
515
+ }
516
+
517
+ /**
518
+ * returns the customer's default payment method
519
+ *
520
+ * @return CreditCard|PayPalAccount|ApplePayCard|AndroidPayCard
521
+ */
522
+ public function defaultPaymentMethod()
523
+ {
524
+ $defaultPaymentMethods = array_filter($this->paymentMethods, 'Braintree\\Customer::_defaultPaymentMethodFilter');
525
+ return current($defaultPaymentMethods);
526
+ }
527
+
528
+ public static function _defaultPaymentMethodFilter($paymentMethod)
529
+ {
530
+ return $paymentMethod->isDefault();
531
+ }
532
+
533
+ /* private class properties */
534
+
535
+ /**
536
+ * @access protected
537
+ * @var array registry of customer data
538
+ */
539
+ protected $_attributes = [
540
+ 'addresses' => '',
541
+ 'company' => '',
542
+ 'creditCards' => '',
543
+ 'email' => '',
544
+ 'fax' => '',
545
+ 'firstName' => '',
546
+ 'id' => '',
547
+ 'lastName' => '',
548
+ 'phone' => '',
549
+ 'createdAt' => '',
550
+ 'updatedAt' => '',
551
+ 'website' => '',
552
+ ];
553
+
554
+ /**
555
+ * sends the create request to the gateway
556
+ *
557
+ * @ignore
558
+ * @param string $subPath
559
+ * @param array $params
560
+ * @return mixed
561
+ */
562
+ public function _doCreate($subPath, $params)
563
+ {
564
+ $fullPath = $this->_config->merchantPath() . $subPath;
565
+ $response = $this->_http->post($fullPath, $params);
566
+
567
+ return $this->_verifyGatewayResponse($response);
568
+ }
569
+
570
+ /**
571
+ * verifies that a valid customer id is being used
572
+ * @ignore
573
+ * @param string customer id
574
+ * @throws InvalidArgumentException
575
+ */
576
+ private function _validateId($id = null) {
577
+ if (is_null($id)) {
578
+ throw new InvalidArgumentException(
579
+ 'expected customer id to be set'
580
+ );
581
+ }
582
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
583
+ throw new InvalidArgumentException(
584
+ $id . ' is an invalid customer id.'
585
+ );
586
+ }
587
+ }
588
+
589
+
590
+ /* private class methods */
591
+
592
+ /**
593
+ * sends the update request to the gateway
594
+ *
595
+ * @ignore
596
+ * @param string $subPath
597
+ * @param array $params
598
+ * @return mixed
599
+ */
600
+ private function _doUpdate($httpVerb, $subPath, $params)
601
+ {
602
+ $fullPath = $this->_config->merchantPath() . $subPath;
603
+ $response = $this->_http->$httpVerb($fullPath, $params);
604
+
605
+ return $this->_verifyGatewayResponse($response);
606
+ }
607
+
608
+ /**
609
+ * generic method for validating incoming gateway responses
610
+ *
611
+ * creates a new Customer object and encapsulates
612
+ * it inside a Result\Successful object, or
613
+ * encapsulates a Errors object inside a Result\Error
614
+ * alternatively, throws an Unexpected exception if the response is invalid.
615
+ *
616
+ * @ignore
617
+ * @param array $response gateway response values
618
+ * @return Result\Successful|Result\Error
619
+ * @throws Exception\Unexpected
620
+ */
621
+ private function _verifyGatewayResponse($response)
622
+ {
623
+ if (isset($response['customer'])) {
624
+ // return a populated instance of Customer
625
+ return new Result\Successful(
626
+ Customer::factory($response['customer'])
627
+ );
628
+ } else if (isset($response['apiErrorResponse'])) {
629
+ return new Result\Error($response['apiErrorResponse']);
630
+ } else {
631
+ throw new Exception\Unexpected(
632
+ "Expected customer or apiErrorResponse"
633
+ );
634
+ }
635
+ }
636
+ }
637
+ class_alias('Braintree\CustomerGateway', 'Braintree_CustomerGateway');
lib/Jmango360/Braintree/lib/Braintree/CustomerSearch.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class CustomerSearch
5
+ {
6
+ public static function addressCountryName() { return new TextNode('address_country_name'); }
7
+ public static function addressExtendedAddress() { return new TextNode('address_extended_address'); }
8
+ public static function addressFirstName() { return new TextNode('address_first_name'); }
9
+ public static function addressLastName() { return new TextNode('address_last_name'); }
10
+ public static function addressLocality() { return new TextNode('address_locality'); }
11
+ public static function addressPostalCode() { return new TextNode('address_postal_code'); }
12
+ public static function addressRegion() { return new TextNode('address_region'); }
13
+ public static function addressStreetAddress() { return new TextNode('address_street_address'); }
14
+ public static function cardholderName() { return new TextNode('cardholder_name'); }
15
+ public static function company() { return new TextNode('company'); }
16
+ public static function email() { return new TextNode('email'); }
17
+ public static function fax() { return new TextNode('fax'); }
18
+ public static function firstName() { return new TextNode('first_name'); }
19
+ public static function id() { return new TextNode('id'); }
20
+ public static function lastName() { return new TextNode('last_name'); }
21
+ public static function paymentMethodToken() { return new TextNode('payment_method_token'); }
22
+ public static function paymentMethodTokenWithDuplicates() { return new IsNode('payment_method_token_with_duplicates'); }
23
+ public static function paypalAccountEmail() { return new IsNode('paypal_account_email'); }
24
+ public static function phone() { return new TextNode('phone'); }
25
+ public static function website() { return new TextNode('website'); }
26
+
27
+ public static function creditCardExpirationDate() { return new EqualityNode('credit_card_expiration_date'); }
28
+ public static function creditCardNumber() { return new PartialMatchNode('credit_card_number'); }
29
+
30
+ public static function ids() { return new MultipleValueNode('ids'); }
31
+
32
+ public static function createdAt() { return new RangeNode("created_at"); }
33
+ }
34
+ class_alias('Braintree\CustomerSearch', 'Braintree_CustomerSearch');
lib/Jmango360/Braintree/lib/Braintree/Descriptor.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Descriptor extends Instance
5
+ {
6
+ }
7
+ class_alias('Braintree\Descriptor', 'Braintree_Descriptor');
lib/Jmango360/Braintree/lib/Braintree/Digest.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Digest encryption module
6
+ * Digest creates an HMAC-SHA1 hash for encrypting messages
7
+ */
8
+ class Digest
9
+ {
10
+ public static function hexDigestSha1($key, $string)
11
+ {
12
+ if(function_exists('hash_hmac')) {
13
+ return self::_builtInHmacSha1($string, $key);
14
+ } else {
15
+ return self::_hmacSha1($string, $key);
16
+ }
17
+ }
18
+
19
+ public static function hexDigestSha256($key, $string)
20
+ {
21
+ return hash_hmac('sha256', $string, hash('sha256', $key, true));
22
+ }
23
+
24
+ public static function secureCompare($left, $right)
25
+ {
26
+ if (strlen($left) != strlen($right)) {
27
+ return false;
28
+ }
29
+
30
+ $leftBytes = unpack("C*", $left);
31
+ $rightBytes = unpack("C*", $right);
32
+
33
+ $result = 0;
34
+ for ($i = 1; $i <= count($leftBytes); $i++) {
35
+ $result = $result | ($leftBytes[$i] ^ $rightBytes[$i]);
36
+ }
37
+ return $result == 0;
38
+ }
39
+
40
+ public static function _builtInHmacSha1($message, $key)
41
+ {
42
+ return hash_hmac('sha1', $message, sha1($key, true));
43
+ }
44
+
45
+ public static function _hmacSha1($message, $key)
46
+ {
47
+ $pack = 'H40';
48
+ $keyDigest = sha1($key,true);
49
+ $innerPad = str_repeat(chr(0x36), 64);
50
+ $outerPad = str_repeat(chr(0x5C), 64);
51
+
52
+ for ($i = 0; $i < 20; $i++) {
53
+ $innerPad{$i} = $keyDigest{$i} ^ $innerPad{$i};
54
+ $outerPad{$i} = $keyDigest{$i} ^ $outerPad{$i};
55
+ }
56
+
57
+ return sha1($outerPad.pack($pack, sha1($innerPad.$message)));
58
+ }
59
+ }
60
+ class_alias('Braintree\Digest', 'Braintree_Digest');
lib/Jmango360/Braintree/lib/Braintree/Disbursement.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Disbursement extends Base
5
+ {
6
+ private $_merchantAccount;
7
+
8
+ protected function _initialize($disbursementAttribs)
9
+ {
10
+ $this->_attributes = $disbursementAttribs;
11
+ $this->merchantAccountDetails = $disbursementAttribs['merchantAccount'];
12
+
13
+ if (isset($disbursementAttribs['merchantAccount'])) {
14
+ $this->_set('merchantAccount',
15
+ MerchantAccount::factory($disbursementAttribs['merchantAccount'])
16
+ );
17
+ }
18
+ }
19
+
20
+ public function transactions()
21
+ {
22
+ $collection = Transaction::search([
23
+ TransactionSearch::ids()->in($this->transactionIds),
24
+ ]);
25
+
26
+ return $collection;
27
+ }
28
+
29
+ public static function factory($attributes)
30
+ {
31
+ $instance = new self();
32
+ $instance->_initialize($attributes);
33
+ return $instance;
34
+ }
35
+
36
+ public function __toString()
37
+ {
38
+ $display = [
39
+ 'id', 'merchantAccountDetails', 'exceptionMessage', 'amount',
40
+ 'disbursementDate', 'followUpAction', 'retry', 'success',
41
+ 'transactionIds'
42
+ ];
43
+
44
+ $displayAttributes = [];
45
+ foreach ($display AS $attrib) {
46
+ $displayAttributes[$attrib] = $this->$attrib;
47
+ }
48
+ return __CLASS__ . '[' .
49
+ Util::attributesToString($displayAttributes) .']';
50
+ }
51
+ }
52
+ class_alias('Braintree\Disbursement', 'Braintree_Disbursement');
lib/Jmango360/Braintree/lib/Braintree/DisbursementDetails.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Disbursement details from a transaction
6
+ * Creates an instance of DisbursementDetails as returned from a transaction
7
+ *
8
+ *
9
+ * @package Braintree
10
+ *
11
+ * @property-read string $settlementAmount
12
+ * @property-read string $settlementCurrencyIsoCode
13
+ * @property-read string $settlementCurrencyExchangeRate
14
+ * @property-read string $fundsHeld
15
+ * @property-read string $success
16
+ * @property-read string $disbursementDate
17
+ */
18
+ class DisbursementDetails extends Instance
19
+ {
20
+ public function isValid() {
21
+ return !is_null($this->disbursementDate);
22
+ }
23
+ }
24
+ class_alias('Braintree\DisbursementDetails', 'Braintree_DisbursementDetails');
lib/Jmango360/Braintree/lib/Braintree/Discount.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Discount extends Modification
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self();
9
+ $instance->_initialize($attributes);
10
+ return $instance;
11
+ }
12
+
13
+
14
+ // static methods redirecting to gateway
15
+
16
+ public static function all()
17
+ {
18
+ return Configuration::gateway()->discount()->all();
19
+ }
20
+ }
21
+ class_alias('Braintree\Discount', 'Braintree_Discount');
lib/Jmango360/Braintree/lib/Braintree/DiscountGateway.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class DiscountGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_config->assertHasAccessTokenOrKeys();
15
+ $this->_http = new Http($gateway->config);
16
+ }
17
+
18
+ public function all()
19
+ {
20
+ $path = $this->_config->merchantPath() . '/discounts';
21
+ $response = $this->_http->get($path);
22
+
23
+ $discounts = ["discount" => $response['discounts']];
24
+
25
+ return Util::extractAttributeAsArray(
26
+ $discounts,
27
+ 'discount'
28
+ );
29
+ }
30
+ }
31
+ class_alias('Braintree\DiscountGateway', 'Braintree_DiscountGateway');
lib/Jmango360/Braintree/lib/Braintree/Dispute.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Creates an instance of Dispute as returned from a transaction
6
+ *
7
+ *
8
+ * @package Braintree
9
+ *
10
+ * @property-read string $amount
11
+ * @property-read string $currencyIsoCode
12
+ * @property-read date $receivedDate
13
+ * @property-read string $reason
14
+ * @property-read string $status
15
+ * @property-read string $disbursementDate
16
+ * @property-read object $transactionDetails
17
+ */
18
+ class Dispute extends Base
19
+ {
20
+ protected $_attributes = [];
21
+
22
+ /* Dispute Status */
23
+ const OPEN = 'open';
24
+ const WON = 'won';
25
+ const LOST = 'lost';
26
+
27
+ /* deprecated; for backwards compatibilty */
28
+ const Open = 'open';
29
+
30
+ /* Dispute Reason */
31
+ const CANCELLED_RECURRING_TRANSACTION = "cancelled_recurring_transaction";
32
+ const CREDIT_NOT_PROCESSED = "credit_not_processed";
33
+ const DUPLICATE = "duplicate";
34
+ const FRAUD = "fraud";
35
+ const GENERAL = "general";
36
+ const INVALID_ACCOUNT = "invalid_account";
37
+ const NOT_RECOGNIZED = "not_recognized";
38
+ const PRODUCT_NOT_RECEIVED = "product_not_received";
39
+ const PRODUCT_UNSATISFACTORY = "product_unsatisfactory";
40
+ const TRANSACTION_AMOUNT_DIFFERS = "transaction_amount_differs";
41
+ const RETRIEVAL = "retrieval";
42
+
43
+ /* Dispute Kind */
44
+ const CHARGEBACK = 'chargeback';
45
+ const PRE_ARBITRATION = 'pre_arbitration';
46
+ // RETRIEVAL for kind already defined under Dispute Reason
47
+
48
+ protected function _initialize($disputeAttribs)
49
+ {
50
+ $this->_attributes = $disputeAttribs;
51
+
52
+ if (isset($disputeAttribs['transaction'])) {
53
+ $this->_set('transactionDetails',
54
+ new Dispute\TransactionDetails($disputeAttribs['transaction'])
55
+ );
56
+ }
57
+ }
58
+
59
+ public static function factory($attributes)
60
+ {
61
+ $instance = new self();
62
+ $instance->_initialize($attributes);
63
+ return $instance;
64
+ }
65
+
66
+ public function __toString()
67
+ {
68
+ $display = [
69
+ 'amount', 'reason', 'status',
70
+ 'replyByDate', 'receivedDate', 'currencyIsoCode'
71
+ ];
72
+
73
+ $displayAttributes = [];
74
+ foreach ($display AS $attrib) {
75
+ $displayAttributes[$attrib] = $this->$attrib;
76
+ }
77
+ return __CLASS__ . '[' .
78
+ Util::attributesToString($displayAttributes) .']';
79
+ }
80
+ }
81
+ class_alias('Braintree\Dispute', 'Braintree_Dispute');
lib/Jmango360/Braintree/lib/Braintree/Dispute/TransactionDetails.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Dispute;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Transaction details for a dispute
8
+ *
9
+ * @package Braintree
10
+ */
11
+
12
+ /**
13
+ * Creates an instance of DisbursementDetails as returned from a transaction
14
+ *
15
+ *
16
+ * @package Braintree
17
+ *
18
+ * @property-read string $amount
19
+ * @property-read string $id
20
+ */
21
+ class TransactionDetails extends Instance
22
+ {
23
+ }
24
+
25
+ class_alias('Braintree\Dispute\TransactionDetails', 'Braintree_Dispute_TransactionDetails');
lib/Jmango360/Braintree/lib/Braintree/EqualityNode.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class EqualityNode extends IsNode
5
+ {
6
+ function isNot($value)
7
+ {
8
+ $this->searchTerms['is_not'] = strval($value);
9
+ return $this;
10
+ }
11
+ }
12
+ class_alias('Braintree\EqualityNode', 'Braintree_EqualityNode');
lib/Jmango360/Braintree/lib/Braintree/Error/Codes.php ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Error;
3
+
4
+ /**
5
+ *
6
+ * Validation Error codes and messages
7
+ *
8
+ * ErrorCodes class provides constants for validation errors.
9
+ * The constants should be used to check for a specific validation
10
+ * error in a ValidationErrorCollection.
11
+ * The error messages returned from the server may change;
12
+ * but the codes will remain the same.
13
+ *
14
+ * @package Braintree
15
+ * @subpackage Errors
16
+ * @category Validation
17
+ */
18
+ class Codes
19
+ {
20
+ const ADDRESS_CANNOT_BE_BLANK = '81801';
21
+ const ADDRESS_COMPANY_IS_INVALID = '91821';
22
+ const ADDRESS_COMPANY_IS_TOO_LONG = '81802';
23
+ const ADDRESS_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = '91814';
24
+ const ADDRESS_COUNTRY_CODE_ALPHA3_IS_NOT_ACCEPTED = '91816';
25
+ const ADDRESS_COUNTRY_CODE_NUMERIC_IS_NOT_ACCEPTED = '91817';
26
+ const ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED = '91803';
27
+ const ADDRESS_EXTENDED_ADDRESS_IS_INVALID = '91823';
28
+ const ADDRESS_EXTENDED_ADDRESS_IS_TOO_LONG = '81804';
29
+ const ADDRESS_FIRST_NAME_IS_INVALID = '91819';
30
+ const ADDRESS_FIRST_NAME_IS_TOO_LONG = '81805';
31
+ const ADDRESS_INCONSISTENT_COUNTRY = '91815';
32
+ const ADDRESS_LAST_NAME_IS_INVALID = '91820';
33
+ const ADDRESS_LAST_NAME_IS_TOO_LONG = '81806';
34
+ const ADDRESS_LOCALITY_IS_INVALID = '91824';
35
+ const ADDRESS_LOCALITY_IS_TOO_LONG = '81807';
36
+ const ADDRESS_POSTAL_CODE_INVALID_CHARACTERS = '81813';
37
+ const ADDRESS_POSTAL_CODE_IS_INVALID = '91826';
38
+ const ADDRESS_POSTAL_CODE_IS_REQUIRED = '81808';
39
+ const ADDRESS_POSTAL_CODE_IS_TOO_LONG = '81809';
40
+ const ADDRESS_REGION_IS_INVALID = '91825';
41
+ const ADDRESS_REGION_IS_TOO_LONG = '81810';
42
+ const ADDRESS_STATE_IS_INVALID_FOR_SELLER_PROTECTION = '81827';
43
+ const ADDRESS_STREET_ADDRESS_IS_INVALID = '91822';
44
+ const ADDRESS_STREET_ADDRESS_IS_REQUIRED = '81811';
45
+ const ADDRESS_STREET_ADDRESS_IS_TOO_LONG = '81812';
46
+ const ADDRESS_TOO_MANY_ADDRESSES_PER_CUSTOMER = '91818';
47
+
48
+ const APPLE_PAY_CARDS_ARE_NOT_ACCEPTED = '83501';
49
+ const APPLE_PAY_CUSTOMER_ID_IS_REQUIRED_FOR_VAULTING = '83502';
50
+ const APPLE_PAY_TOKEN_IS_IN_USE = '93503';
51
+ const APPLE_PAY_PAYMENT_METHOD_NONCE_CONSUMED = '93504';
52
+ const APPLE_PAY_PAYMENT_METHOD_NONCE_UNKNOWN = '93505';
53
+ const APPLE_PAY_PAYMENT_METHOD_NONCE_UNLOCKED = '93506';
54
+ const APPLE_PAY_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '83518';
55
+ const APPLE_PAY_CANNOT_UPDATE_APPLE_PAY_CARD_USING_PAYMENT_METHOD_NONCE = '93507';
56
+ const APPLE_PAY_NUMBER_IS_REQUIRED = '93508';
57
+ const APPLE_PAY_EXPIRATION_MONTH_IS_REQUIRED = '93509';
58
+ const APPLE_PAY_EXPIRATION_YEAR_IS_REQUIRED = '93510';
59
+ const APPLE_PAY_CRYPTOGRAM_IS_REQUIRED = '93511';
60
+ const APPLE_PAY_DECRYPTION_FAILED = '83512';
61
+ const APPLE_PAY_DISABLED = '93513';
62
+ const APPLE_PAY_MERCHANT_NOT_CONFIGURED = '93514';
63
+ const APPLE_PAY_MERCHANT_KEYS_ALREADY_CONFIGURED = '93515';
64
+ const APPLE_PAY_MERCHANT_KEYS_NOT_CONFIGURED = '93516';
65
+ const APPLE_PAY_CERTIFICATE_INVALID = '93517';
66
+ const APPLE_PAY_CERTIFICATE_MISMATCH = '93519';
67
+ const APPLE_PAY_INVALID_TOKEN = '83520';
68
+ const APPLE_PAY_PRIVATE_KEY_MISMATCH = '93521';
69
+ const APPLE_PAY_KEY_MISMATCH_STORING_CERTIFICATE = '93522';
70
+
71
+ const AUTHORIZATION_FINGERPRINT_INVALID_CREATED_AT = '93204';
72
+ const AUTHORIZATION_FINGERPRINT_INVALID_FORMAT = '93202';
73
+ const AUTHORIZATION_FINGERPRINT_INVALID_PUBLIC_KEY = '93205';
74
+ const AUTHORIZATION_FINGERPRINT_INVALID_SIGNATURE = '93206';
75
+ const AUTHORIZATION_FINGERPRINT_MISSING_FINGERPRINT = '93201';
76
+ const AUTHORIZATION_FINGERPRINT_OPTIONS_NOT_ALLOWED_WITHOUT_CUSTOMER = '93207';
77
+ const AUTHORIZATION_FINGERPRINT_SIGNATURE_REVOKED = '93203';
78
+
79
+ const CLIENT_TOKEN_CUSTOMER_DOES_NOT_EXIST = '92804';
80
+ const CLIENT_TOKEN_FAIL_ON_DUPLICATE_PAYMENT_METHOD_REQUIRES_CUSTOMER_ID = '92803';
81
+ const CLIENT_TOKEN_MAKE_DEFAULT_REQUIRES_CUSTOMER_ID = '92801';
82
+ const CLIENT_TOKEN_PROXY_MERCHANT_DOES_NOT_EXIST = '92805';
83
+ const CLIENT_TOKEN_UNSUPPORTED_VERSION = '92806';
84
+ const CLIENT_TOKEN_VERIFY_CARD_REQUIRES_CUSTOMER_ID = '92802';
85
+ const CLIENT_TOKEN_MERCHANT_ACCOUNT_DOES_NOT_EXIST = '92807';
86
+
87
+ const CREDIT_CARD_BILLING_ADDRESS_CONFLICT = '91701';
88
+ const CREDIT_CARD_BILLING_ADDRESS_FORMAT_IS_INVALID = '91744';
89
+ const CREDIT_CARD_BILLING_ADDRESS_ID_IS_INVALID = '91702';
90
+ const CREDIT_CARD_CANNOT_UPDATE_CARD_USING_PAYMENT_METHOD_NONCE = '91735';
91
+ const CREDIT_CARD_CARDHOLDER_NAME_IS_TOO_LONG = '81723';
92
+ const CREDIT_CARD_CREDIT_CARD_TYPE_IS_NOT_ACCEPTED = '81703';
93
+ const CREDIT_CARD_CREDIT_CARD_TYPE_IS_NOT_ACCEPTED_BY_SUBSCRIPTION_MERCHANT_ACCOUNT = '81718';
94
+ const CREDIT_CARD_CUSTOMER_ID_IS_INVALID = '91705';
95
+ const CREDIT_CARD_CUSTOMER_ID_IS_REQUIRED = '91704';
96
+ const CREDIT_CARD_CVV_IS_INVALID = '81707';
97
+ const CREDIT_CARD_CVV_IS_REQUIRED = '81706';
98
+ const CREDIT_CARD_CVV_VERIFICATION_FAILED = '81736';
99
+ const CREDIT_CARD_DUPLICATE_CARD_EXISTS = '81724';
100
+ const CREDIT_CARD_EXPIRATION_DATE_CONFLICT = '91708';
101
+ const CREDIT_CARD_EXPIRATION_DATE_IS_INVALID = '81710';
102
+ const CREDIT_CARD_EXPIRATION_DATE_IS_REQUIRED = '81709';
103
+ const CREDIT_CARD_EXPIRATION_DATE_YEAR_IS_INVALID = '81711';
104
+ const CREDIT_CARD_EXPIRATION_MONTH_IS_INVALID = '81712';
105
+ const CREDIT_CARD_EXPIRATION_YEAR_IS_INVALID = '81713';
106
+ const CREDIT_CARD_INVALID_PARAMS_FOR_CREDIT_CARD_UPDATE = '91745';
107
+ const CREDIT_CARD_INVALID_VENMO_SDK_PAYMENT_METHOD_CODE = '91727';
108
+ const CREDIT_CARD_NUMBER_INVALID_LENGTH = '81716';
109
+ const CREDIT_CARD_NUMBER_IS_INVALID = '81715';
110
+ const CREDIT_CARD_NUMBER_IS_PROHIBITED = '81750';
111
+ const CREDIT_CARD_NUMBER_IS_REQUIRED = '81714';
112
+ const CREDIT_CARD_NUMBER_LENGTH_IS_INVALID = '81716';
113
+ const CREDIT_CARD_NUMBER_MUST_BE_TEST_NUMBER = '81717';
114
+ const CREDIT_CARD_OPTIONS_UPDATE_EXISTING_TOKEN_IS_INVALID = '91723';
115
+ const CREDIT_CARD_OPTIONS_UPDATE_EXISTING_TOKEN_NOT_ALLOWED = '91729';
116
+ const CREDIT_CARD_OPTIONS_VERIFICATION_AMOUNT_CANNOT_BE_NEGATIVE = '91739';
117
+ const CREDIT_CARD_OPTIONS_VERIFICATION_AMOUNT_FORMAT_IS_INVALID = '91740';
118
+ const CREDIT_CARD_OPTIONS_VERIFICATION_AMOUNT_IS_TOO_LARGE = '91752';
119
+ const CREDIT_CARD_OPTIONS_VERIFICATION_AMOUNT_NOT_SUPPORTED_BY_PROCESSOR = '91741';
120
+ const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91728';
121
+ const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_FORBIDDEN = '91743';
122
+ const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91742';
123
+ const CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '91755';
124
+ const CREDIT_CARD_PAYMENT_METHOD_CONFLICT = '81725';
125
+ const CREDIT_CARD_PAYMENT_METHOD_IS_NOT_A_CREDIT_CARD = '91738';
126
+ const CREDIT_CARD_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91734';
127
+ const CREDIT_CARD_PAYMENT_METHOD_NONCE_CONSUMED = '91731';
128
+ const CREDIT_CARD_PAYMENT_METHOD_NONCE_LOCKED = '91733';
129
+ const CREDIT_CARD_PAYMENT_METHOD_NONCE_UNKNOWN = '91732';
130
+ const CREDIT_CARD_POSTAL_CODE_VERIFICATION_FAILED = '81737';
131
+ const CREDIT_CARD_TOKEN_FORMAT_IS_INVALID = '91718';
132
+ const CREDIT_CARD_TOKEN_INVALID = '91718';
133
+ const CREDIT_CARD_TOKEN_IS_IN_USE = '91719';
134
+ const CREDIT_CARD_TOKEN_IS_NOT_ALLOWED = '91721';
135
+ const CREDIT_CARD_TOKEN_IS_REQUIRED = '91722';
136
+ const CREDIT_CARD_TOKEN_IS_TOO_LONG = '91720';
137
+ const CREDIT_CARD_VENMO_SDK_PAYMENT_METHOD_CODE_CARD_TYPE_IS_NOT_ACCEPTED = '91726';
138
+ const CREDIT_CARD_VERIFICATION_NOT_SUPPORTED_ON_THIS_MERCHANT_ACCOUNT = '91730';
139
+
140
+ const CUSTOMER_COMPANY_IS_TOO_LONG = '81601';
141
+ const CUSTOMER_CUSTOM_FIELD_IS_INVALID = '91602';
142
+ const CUSTOMER_CUSTOM_FIELD_IS_TOO_LONG = '81603';
143
+ const CUSTOMER_EMAIL_FORMAT_IS_INVALID = '81604';
144
+ const CUSTOMER_EMAIL_IS_INVALID = '81604';
145
+ const CUSTOMER_EMAIL_IS_REQUIRED = '81606';
146
+ const CUSTOMER_EMAIL_IS_TOO_LONG = '81605';
147
+ const CUSTOMER_FAX_IS_TOO_LONG = '81607';
148
+ const CUSTOMER_FIRST_NAME_IS_TOO_LONG = '81608';
149
+ const CUSTOMER_ID_IS_INVAILD = '91610'; //Deprecated
150
+ const CUSTOMER_ID_IS_INVALID = '91610';
151
+ const CUSTOMER_ID_IS_IN_USE = '91609';
152
+ const CUSTOMER_ID_IS_NOT_ALLOWED = '91611';
153
+ const CUSTOMER_ID_IS_REQUIRED = '91613';
154
+ const CUSTOMER_ID_IS_TOO_LONG = '91612';
155
+ const CUSTOMER_LAST_NAME_IS_TOO_LONG = '81613';
156
+ const CUSTOMER_PHONE_IS_TOO_LONG = '81614';
157
+ const CUSTOMER_VAULTED_PAYMENT_INSTRUMENT_NONCE_BELONGS_TO_DIFFERENT_CUSTOMER = '91617';
158
+ const CUSTOMER_WEBSITE_FORMAT_IS_INVALID = '81616';
159
+ const CUSTOMER_WEBSITE_IS_INVALID = '81616';
160
+ const CUSTOMER_WEBSITE_IS_TOO_LONG = '81615';
161
+
162
+ const DESCRIPTOR_NAME_FORMAT_IS_INVALID = '92201';
163
+ const DESCRIPTOR_PHONE_FORMAT_IS_INVALID = '92202';
164
+ const DESCRIPTOR_INTERNATIONAL_NAME_FORMAT_IS_INVALID = '92204';
165
+ const DESCRIPTOR_DYNAMIC_DESCRIPTORS_DISABLED = '92203';
166
+ const DESCRIPTOR_INTERNATIONAL_PHONE_FORMAT_IS_INVALID = '92205';
167
+ const DESCRIPTOR_URL_FORMAT_IS_INVALID = '92206';
168
+
169
+ const INDUSTRY_DATA_INDUSTRY_TYPE_IS_INVALID = '93401';
170
+ const INDUSTRY_DATA_LODGING_EMPTY_DATA = '93402';
171
+ const INDUSTRY_DATA_LODGING_FOLIO_NUMBER_IS_INVALID = '93403';
172
+ const INDUSTRY_DATA_LODGING_CHECK_IN_DATE_IS_INVALID = '93404';
173
+ const INDUSTRY_DATA_LODGING_CHECK_OUT_DATE_IS_INVALID = '93405';
174
+ const INDUSTRY_DATA_LODGING_CHECK_OUT_DATE_MUST_FOLLOW_CHECK_IN_DATE = '93406';
175
+ const INDUSTRY_DATA_LODGING_UNKNOWN_DATA_FIELD = '93407';
176
+ const INDUSTRY_DATA_TRAVEL_CRUISE_EMPTY_DATA = '93408';
177
+ const INDUSTRY_DATA_TRAVEL_CRUISE_UNKNOWN_DATA_FIELD = '93409';
178
+ const INDUSTRY_DATA_TRAVEL_CRUISE_TRAVEL_PACKAGE_IS_INVALID = '93410';
179
+ const INDUSTRY_DATA_TRAVEL_CRUISE_DEPARTURE_DATE_IS_INVALID = '93411';
180
+ const INDUSTRY_DATA_TRAVEL_CRUISE_LODGING_CHECK_IN_DATE_IS_INVALID = '93412';
181
+ const INDUSTRY_DATA_TRAVEL_CRUISE_LODGING_CHECK_OUT_DATE_IS_INVALID = '93413';
182
+
183
+ const MERCHANT_COUNTRY_CANNOT_BE_BLANK = '83603';
184
+ const MERCHANT_COUNTRY_CODE_ALPHA2_IS_INVALID = '93607';
185
+ const MERCHANT_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = '93606';
186
+ const MERCHANT_COUNTRY_CODE_ALPHA3_IS_INVALID = '93605';
187
+ const MERCHANT_COUNTRY_CODE_ALPHA3_IS_NOT_ACCEPTED = '93604';
188
+ const MERCHANT_COUNTRY_CODE_NUMERIC_IS_INVALID = '93609';
189
+ const MERCHANT_COUNTRY_CODE_NUMERIC_IS_NOT_ACCEPTED = '93608';
190
+ const MERCHANT_COUNTRY_NAME_IS_INVALID = '93611';
191
+ const MERCHANT_COUNTRY_NAME_IS_NOT_ACCEPTED = '93610';
192
+ const MERCHANT_CURRENCIES_ARE_INVALID = '93614';
193
+ const MERCHANT_EMAIL_FORMAT_IS_INVALID = '93602';
194
+ const MERCHANT_EMAIL_IS_REQUIRED = '83601';
195
+ const MERCHANT_INCONSISTENT_COUNTRY = '93612';
196
+ const MERCHANT_ACCOUNT_PAYMENT_METHODS_ARE_INVALID = '93613';
197
+ const MERCHANT_PAYMENT_METHODS_ARE_NOT_ALLOWED = '93615';
198
+ const MERCHANT_MERCHANT_ACCOUNT_EXISTS_FOR_CURRENCY = '93616';
199
+ const MERCHANT_CURRENCY_IS_REQUIRED = '93617';
200
+ const MERCHANT_CURRENCY_IS_INVALID = '93618';
201
+ const MERCHANT_NO_MERCHANT_ACCOUNTS = '93619';
202
+ const MERCHANT_MERCHANT_ACCOUNT_EXISTS_FOR_ID = '93620';
203
+ const MERCHANT_MERCHANT_ACCOUNT_NOT_AUTH_ONBOARDED = '93621';
204
+
205
+ const MERCHANT_ACCOUNT_ID_FORMAT_IS_INVALID = '82603';
206
+ const MERCHANT_ACCOUNT_ID_IS_IN_USE = '82604';
207
+ const MERCHANT_ACCOUNT_ID_IS_NOT_ALLOWED = '82605';
208
+ const MERCHANT_ACCOUNT_ID_IS_TOO_LONG = '82602';
209
+ const MERCHANT_ACCOUNT_MASTER_MERCHANT_ACCOUNT_ID_IS_INVALID = '82607';
210
+ const MERCHANT_ACCOUNT_MASTER_MERCHANT_ACCOUNT_ID_IS_REQUIRED = '82606';
211
+ const MERCHANT_ACCOUNT_MASTER_MERCHANT_ACCOUNT_MUST_BE_ACTIVE = '82608';
212
+ const MERCHANT_ACCOUNT_TOS_ACCEPTED_IS_REQUIRED = '82610';
213
+ const MERCHANT_ACCOUNT_CANNOT_BE_UPDATED = '82674';
214
+ const MERCHANT_ACCOUNT_DECLINED = '82626';
215
+ const MERCHANT_ACCOUNT_DECLINED_MASTER_CARD_MATCH = '82622';
216
+ const MERCHANT_ACCOUNT_DECLINED_OFAC = '82621';
217
+ const MERCHANT_ACCOUNT_DECLINED_FAILED_KYC = '82623';
218
+ const MERCHANT_ACCOUNT_DECLINED_SSN_INVALID = '82624';
219
+ const MERCHANT_ACCOUNT_DECLINED_SSN_MATCHES_DECEASED = '82625';
220
+ const MERCHANT_ACCOUNT_ID_CANNOT_BE_UPDATED = '82675';
221
+ const MERCHANT_ACCOUNT_MASTER_MERCHANT_ACCOUNT_ID_CANNOT_BE_UPDATED = '82676';
222
+
223
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ACCOUNT_NUMBER_IS_REQUIRED = '82614';
224
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_COMPANY_NAME_IS_INVALID = '82631';
225
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_COMPANY_NAME_IS_REQUIRED_WITH_TAX_ID = '82633';
226
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DATE_OF_BIRTH_IS_REQUIRED = '82612';
227
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED = '82626'; // Keep for backwards compatibility
228
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED_MASTER_CARD_MATCH = '82622'; // Keep for backwards compatibility
229
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED_OFAC = '82621'; // Keep for backwards compatibility
230
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED_FAILED_KYC = '82623'; // Keep for backwards compatibility
231
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED_SSN_INVALID = '82624'; // Keep for backwards compatibility
232
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DECLINED_SSN_MATCHES_DECEASED = '82625'; // Keep for backwards compatibility
233
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_EMAIL_ADDRESS_IS_INVALID = '82616';
234
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_FIRST_NAME_IS_INVALID = '82627';
235
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_FIRST_NAME_IS_REQUIRED = '82609';
236
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_LAST_NAME_IS_INVALID = '82628';
237
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_LAST_NAME_IS_REQUIRED = '82611';
238
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_PHONE_IS_INVALID = '82636';
239
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ROUTING_NUMBER_IS_INVALID = '82635';
240
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ROUTING_NUMBER_IS_REQUIRED = '82613';
241
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_SSN_IS_INVALID = '82615';
242
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_TAX_ID_IS_INVALID = '82632';
243
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_TAX_ID_IS_REQUIRED_WITH_COMPANY_NAME = '82634';
244
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_DATE_OF_BIRTH_IS_INVALID = '82663';
245
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_REGION_IS_INVALID = '82664';
246
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_EMAIL_ADDRESS_IS_REQUIRED = '82665';
247
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ACCOUNT_NUMBER_IS_INVALID = '82670';
248
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_TAX_ID_MUST_BE_BLANK = '82673';
249
+
250
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_LOCALITY_IS_REQUIRED = '82618';
251
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_POSTAL_CODE_IS_INVALID = '82630';
252
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_POSTAL_CODE_IS_REQUIRED = '82619';
253
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_REGION_IS_REQUIRED = '82620';
254
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_STREET_ADDRESS_IS_INVALID = '82629';
255
+ const MERCHANT_ACCOUNT_APPLICANT_DETAILS_ADDRESS_STREET_ADDRESS_IS_REQUIRED = '82617';
256
+
257
+ const MERCHANT_ACCOUNT_BUSINESS_DBA_NAME_IS_INVALID = '82646';
258
+ const MERCHANT_ACCOUNT_BUSINESS_TAX_ID_IS_INVALID = '82647';
259
+ const MERCHANT_ACCOUNT_BUSINESS_TAX_ID_IS_REQUIRED_WITH_LEGAL_NAME = '82648';
260
+ const MERCHANT_ACCOUNT_BUSINESS_LEGAL_NAME_IS_REQUIRED_WITH_TAX_ID = '82669';
261
+ const MERCHANT_ACCOUNT_BUSINESS_TAX_ID_MUST_BE_BLANK = '82672';
262
+ const MERCHANT_ACCOUNT_BUSINESS_LEGAL_NAME_IS_INVALID = '82677';
263
+ const MERCHANT_ACCOUNT_BUSINESS_ADDRESS_REGION_IS_INVALID = '82684';
264
+ const MERCHANT_ACCOUNT_BUSINESS_ADDRESS_STREET_ADDRESS_IS_INVALID = '82685';
265
+ const MERCHANT_ACCOUNT_BUSINESS_ADDRESS_POSTAL_CODE_IS_INVALID = '82686';
266
+
267
+ const MERCHANT_ACCOUNT_INDIVIDUAL_FIRST_NAME_IS_REQUIRED = '82637';
268
+ const MERCHANT_ACCOUNT_INDIVIDUAL_LAST_NAME_IS_REQUIRED = '82638';
269
+ const MERCHANT_ACCOUNT_INDIVIDUAL_DATE_OF_BIRTH_IS_REQUIRED = '82639';
270
+ const MERCHANT_ACCOUNT_INDIVIDUAL_SSN_IS_INVALID = '82642';
271
+ const MERCHANT_ACCOUNT_INDIVIDUAL_EMAIL_IS_INVALID = '82643';
272
+ const MERCHANT_ACCOUNT_INDIVIDUAL_FIRST_NAME_IS_INVALID = '82644';
273
+ const MERCHANT_ACCOUNT_INDIVIDUAL_LAST_NAME_IS_INVALID = '82645';
274
+ const MERCHANT_ACCOUNT_INDIVIDUAL_PHONE_IS_INVALID = '82656';
275
+ const MERCHANT_ACCOUNT_INDIVIDUAL_DATE_OF_BIRTH_IS_INVALID = '82666';
276
+ const MERCHANT_ACCOUNT_INDIVIDUAL_EMAIL_IS_REQUIRED = '82667';
277
+
278
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_STREET_ADDRESS_IS_REQUIRED = '82657';
279
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_LOCALITY_IS_REQUIRED = '82658';
280
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_POSTAL_CODE_IS_REQUIRED = '82659';
281
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_REGION_IS_REQUIRED = '82660';
282
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_STREET_ADDRESS_IS_INVALID = '82661';
283
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_POSTAL_CODE_IS_INVALID = '82662';
284
+ const MERCHANT_ACCOUNT_INDIVIDUAL_ADDRESS_REGION_IS_INVALID = '82668';
285
+
286
+ const MERCHANT_ACCOUNT_FUNDING_ROUTING_NUMBER_IS_REQUIRED = '82640';
287
+ const MERCHANT_ACCOUNT_FUNDING_ACCOUNT_NUMBER_IS_REQUIRED = '82641';
288
+ const MERCHANT_ACCOUNT_FUNDING_ROUTING_NUMBER_IS_INVALID = '82649';
289
+ const MERCHANT_ACCOUNT_FUNDING_ACCOUNT_NUMBER_IS_INVALID = '82671';
290
+ const MERCHANT_ACCOUNT_FUNDING_DESTINATION_IS_REQUIRED = '82678';
291
+ const MERCHANT_ACCOUNT_FUNDING_DESTINATION_IS_INVALID = '82679';
292
+ const MERCHANT_ACCOUNT_FUNDING_EMAIL_IS_REQUIRED = '82680';
293
+ const MERCHANT_ACCOUNT_FUNDING_EMAIL_IS_INVALID = '82681';
294
+ const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_REQUIRED = '82682';
295
+ const MERCHANT_ACCOUNT_FUNDING_MOBILE_PHONE_IS_INVALID = '82683';
296
+
297
+ const OAUTH_INVALID_GRANT = '93801';
298
+ const OAUTH_INVALID_CREDENTIALS = '93802';
299
+ const OAUTH_INVALID_SCOPE = '93803';
300
+ const OAUTH_INVALID_REQUEST = '93804';
301
+ const OAUTH_UNSUPPORTED_GRANT_TYPE = '93805';
302
+
303
+ const PAYMENT_METHOD_CANNOT_FORWARD_PAYMENT_METHOD_TYPE = '93106';
304
+ const PAYMENT_METHOD_CUSTOMER_ID_IS_INVALID = '93105';
305
+ const PAYMENT_METHOD_CUSTOMER_ID_IS_REQUIRED = '93104';
306
+ const PAYMENT_METHOD_NONCE_IS_INVALID = '93102';
307
+ const PAYMENT_METHOD_NONCE_IS_REQUIRED = '93103';
308
+ const PAYMENT_METHOD_PAYMENT_METHOD_NONCE_CONSUMED = '93107';
309
+ const PAYMENT_METHOD_PAYMENT_METHOD_NONCE_UNKNOWN = '93108';
310
+ const PAYMENT_METHOD_PAYMENT_METHOD_NONCE_LOCKED = '93109';
311
+ const PAYMENT_METHOD_PAYMENT_METHOD_PARAMS_ARE_REQUIRED = '93101';
312
+
313
+ const PAYPAL_ACCOUNT_AUTH_EXPIRED = '92911';
314
+ const PAYPAL_ACCOUNT_CANNOT_HAVE_BOTH_ACCESS_TOKEN_AND_CONSENT_CODE = '82903';
315
+ const PAYPAL_ACCOUNT_CANNOT_HAVE_FUNDING_SOURCE_WITHOUT_ACCESS_TOKEN = '92912';
316
+ const PAYPAL_ACCOUNT_CANNOT_UPDATE_PAYPAL_ACCOUNT_USING_PAYMENT_METHOD_NONCE = '92914';
317
+ const PAYPAL_ACCOUNT_CANNOT_VAULT_ONE_TIME_USE_PAYPAL_ACCOUNT = '82902';
318
+ const PAYPAL_ACCOUNT_CONSENT_CODE_OR_ACCESS_TOKEN_IS_REQUIRED = '82901';
319
+ const PAYPAL_ACCOUNT_CUSTOMER_ID_IS_REQUIRED_FOR_VAULTING = '82905';
320
+ const PAYPAL_ACCOUNT_INVALID_FUNDING_SOURCE_SELECTION = '92913';
321
+ const PAYPAL_ACCOUNT_INVALID_PARAMS_FOR_PAYPAL_ACCOUNT_UPDATE = '92915';
322
+ const PAYPAL_ACCOUNT_PAYMENT_METHOD_NONCE_CONSUMED = '92907';
323
+ const PAYPAL_ACCOUNT_PAYMENT_METHOD_NONCE_LOCKED = '92909';
324
+ const PAYPAL_ACCOUNT_PAYMENT_METHOD_NONCE_UNKNOWN = '92908';
325
+ const PAYPAL_ACCOUNT_PAYPAL_ACCOUNTS_ARE_NOT_ACCEPTED = '82904';
326
+ const PAYPAL_ACCOUNT_PAYPAL_COMMUNICATION_ERROR = '92910';
327
+ const PAYPAL_ACCOUNT_TOKEN_IS_IN_USE = '92906';
328
+
329
+ const SEPA_BANK_ACCOUNT_ACCOUNT_HOLDER_NAME_IS_REQUIRED = '93003';
330
+ const SEPA_BANK_ACCOUNT_BIC_IS_REQUIRED = '93002';
331
+ const SEPA_BANK_ACCOUNT_IBAN_IS_REQUIRED = '93001';
332
+
333
+ const SEPA_MANDATE_ACCOUNT_HOLDER_NAME_IS_REQUIRED = '83301';
334
+ const SEPA_MANDATE_BIC_INVALID_CHARACTER = '83306';
335
+ const SEPA_MANDATE_BIC_IS_REQUIRED = '83302';
336
+ const SEPA_MANDATE_BIC_LENGTH_IS_INVALID = '83307';
337
+ const SEPA_MANDATE_BIC_UNSUPPORTED_COUNTRY = '83308';
338
+ const SEPA_MANDATE_BILLING_ADDRESS_CONFLICT = '93311';
339
+ const SEPA_MANDATE_BILLING_ADDRESS_ID_IS_INVALID = '93312';
340
+ const SEPA_MANDATE_IBAN_INVALID_CHARACTER = '83305';
341
+ const SEPA_MANDATE_IBAN_INVALID_FORMAT = '83310';
342
+ const SEPA_MANDATE_IBAN_IS_REQUIRED = '83303';
343
+ const SEPA_MANDATE_IBAN_UNSUPPORTED_COUNTRY = '83309';
344
+ const SEPA_MANDATE_TYPE_IS_REQUIRED = '93304';
345
+ const SEPA_MANDATE_TYPE_IS_INVALID = '93313';
346
+
347
+ const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_INVALID = '82302';
348
+ const SETTLEMENT_BATCH_SUMMARY_SETTLEMENT_DATE_IS_REQUIRED = '82301';
349
+ const SETTLEMENT_BATCH_SUMMARY_CUSTOM_FIELD_IS_INVALID = '82303';
350
+
351
+ const SUBSCRIPTION_BILLING_DAY_OF_MONTH_CANNOT_BE_UPDATED = '91918';
352
+ const SUBSCRIPTION_BILLING_DAY_OF_MONTH_IS_INVALID = '91914';
353
+ const SUBSCRIPTION_BILLING_DAY_OF_MONTH_MUST_BE_NUMERIC = '91913';
354
+ const SUBSCRIPTION_CANNOT_ADD_DUPLICATE_ADDON_OR_DISCOUNT = '91911';
355
+ const SUBSCRIPTION_CANNOT_EDIT_CANCELED_SUBSCRIPTION = '81901';
356
+ const SUBSCRIPTION_CANNOT_EDIT_EXPIRED_SUBSCRIPTION = '81910';
357
+ const SUBSCRIPTION_CANNOT_EDIT_PRICE_CHANGING_FIELDS_ON_PAST_DUE_SUBSCRIPTION = '91920';
358
+ const SUBSCRIPTION_FIRST_BILLING_DATE_CANNOT_BE_IN_THE_PAST = '91916';
359
+ const SUBSCRIPTION_FIRST_BILLING_DATE_CANNOT_BE_UPDATED = '91919';
360
+ const SUBSCRIPTION_FIRST_BILLING_DATE_IS_INVALID = '91915';
361
+ const SUBSCRIPTION_ID_IS_IN_USE = '81902';
362
+ const SUBSCRIPTION_INCONSISTENT_NUMBER_OF_BILLING_CYCLES = '91908';
363
+ const SUBSCRIPTION_INCONSISTENT_START_DATE = '91917';
364
+ const SUBSCRIPTION_INVALID_REQUEST_FORMAT = '91921';
365
+ const SUBSCRIPTION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91901';
366
+ const SUBSCRIPTION_MISMATCH_CURRENCY_ISO_CODE = '91923';
367
+ const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_CANNOT_BE_BLANK = '91912';
368
+ const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_IS_TOO_SMALL = '91909';
369
+ const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_MUST_BE_GREATER_THAN_ZERO = '91907';
370
+ const SUBSCRIPTION_NUMBER_OF_BILLING_CYCLES_MUST_BE_NUMERIC = '91906';
371
+ const SUBSCRIPTION_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91924';
372
+ const SUBSCRIPTION_PAYMENT_METHOD_NONCE_IS_INVALID = '91925';
373
+ const SUBSCRIPTION_PAYMENT_METHOD_NONCE_NOT_ASSOCIATED_WITH_CUSTOMER = '91926';
374
+ const SUBSCRIPTION_PAYMENT_METHOD_NONCE_UNVAULTED_CARD_IS_NOT_ACCEPTED = '91927';
375
+ const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_CARD_TYPE_IS_NOT_ACCEPTED = '91902';
376
+ const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_IS_INVALID = '91903';
377
+ const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_NOT_ASSOCIATED_WITH_CUSTOMER = '91905';
378
+ const SUBSCRIPTION_PLAN_BILLING_FREQUENCY_CANNOT_BE_UPDATED = '91922';
379
+ const SUBSCRIPTION_PLAN_ID_IS_INVALID = '91904';
380
+ const SUBSCRIPTION_PRICE_CANNOT_BE_BLANK = '81903';
381
+ const SUBSCRIPTION_PRICE_FORMAT_IS_INVALID = '81904';
382
+ const SUBSCRIPTION_PRICE_IS_TOO_LARGE = '81923';
383
+ const SUBSCRIPTION_STATUS_IS_CANCELED = '81905';
384
+ const SUBSCRIPTION_TOKEN_FORMAT_IS_INVALID = '81906';
385
+ const SUBSCRIPTION_TRIAL_DURATION_FORMAT_IS_INVALID = '81907';
386
+ const SUBSCRIPTION_TRIAL_DURATION_IS_REQUIRED = '81908';
387
+ const SUBSCRIPTION_TRIAL_DURATION_UNIT_IS_INVALID = '81909';
388
+ const SUBSCRIPTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_INSTRUMENT_TYPE = '91930';
389
+ const SUBSCRIPTION_PAYMENT_METHOD_NONCE_INSTRUMENT_TYPE_DOES_NOT_SUPPORT_SUBSCRIPTIONS = '91929';
390
+ const SUBSCRIPTION_PAYMENT_METHOD_TOKEN_INSTRUMENT_TYPE_DOES_NOT_SUPPORT_SUBSCRIPTIONS = '91928';
391
+
392
+ const SUBSCRIPTION_MODIFICATION_AMOUNT_CANNOT_BE_BLANK = '92003';
393
+ const SUBSCRIPTION_MODIFICATION_AMOUNT_IS_INVALID = '92002';
394
+ const SUBSCRIPTION_MODIFICATION_AMOUNT_IS_TOO_LARGE = '92023';
395
+ const SUBSCRIPTION_MODIFICATION_CANNOT_EDIT_MODIFICATIONS_ON_PAST_DUE_SUBSCRIPTION = '92022';
396
+ const SUBSCRIPTION_MODIFICATION_CANNOT_UPDATE_AND_REMOVE = '92015';
397
+ const SUBSCRIPTION_MODIFICATION_EXISTING_ID_IS_INCORRECT_KIND = '92020';
398
+ const SUBSCRIPTION_MODIFICATION_EXISTING_ID_IS_INVALID = '92011';
399
+ const SUBSCRIPTION_MODIFICATION_EXISTING_ID_IS_REQUIRED = '92012';
400
+ const SUBSCRIPTION_MODIFICATION_ID_TO_REMOVE_IS_INCORRECT_KIND = '92021';
401
+ const SUBSCRIPTION_MODIFICATION_ID_TO_REMOVE_IS_INVALID = '92025';
402
+ const SUBSCRIPTION_MODIFICATION_ID_TO_REMOVE_IS_NOT_PRESENT = '92016';
403
+ const SUBSCRIPTION_MODIFICATION_INCONSISTENT_NUMBER_OF_BILLING_CYCLES = '92018';
404
+ const SUBSCRIPTION_MODIFICATION_INHERITED_FROM_ID_IS_INVALID = '92013';
405
+ const SUBSCRIPTION_MODIFICATION_INHERITED_FROM_ID_IS_REQUIRED = '92014';
406
+ const SUBSCRIPTION_MODIFICATION_MISSING = '92024';
407
+ const SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_CANNOT_BE_BLANK = '92017';
408
+ const SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_IS_INVALID = '92005';
409
+ const SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_MUST_BE_GREATER_THAN_ZERO = '92019';
410
+ const SUBSCRIPTION_MODIFICATION_QUANTITY_CANNOT_BE_BLANK = '92004';
411
+ const SUBSCRIPTION_MODIFICATION_QUANTITY_IS_INVALID = '92001';
412
+ const SUBSCRIPTION_MODIFICATION_QUANTITY_MUST_BE_GREATER_THAN_ZERO = '92010';
413
+
414
+ const TRANSACTION_AMOUNT_CANNOT_BE_NEGATIVE = '81501';
415
+ const TRANSACTION_AMOUNT_DOES_NOT_MATCH3_D_SECURE_AMOUNT = '91585';
416
+ const TRANSACTION_AMOUNT_DOES_NOT_MATCH_IDEAL_PAYMENT_AMOUNT = '915144';
417
+ const TRANSACTION_AMOUNT_FORMAT_IS_INVALID = '81503';
418
+ const TRANSACTION_AMOUNT_IS_INVALID = '81503';
419
+ const TRANSACTION_AMOUNT_IS_REQUIRED = '81502';
420
+ const TRANSACTION_AMOUNT_IS_TOO_LARGE = '81528';
421
+ const TRANSACTION_AMOUNT_MUST_BE_GREATER_THAN_ZERO = '81531';
422
+ const TRANSACTION_BILLING_ADDRESS_CONFLICT = '91530';
423
+ const TRANSACTION_CANNOT_BE_VOIDED = '91504';
424
+ const TRANSACTION_CANNOT_CANCEL_RELEASE = '91562';
425
+ const TRANSACTION_CANNOT_CLONE_CREDIT = '91543';
426
+ const TRANSACTION_CANNOT_CLONE_MARKETPLACE_TRANSACTION = '915137';
427
+ const TRANSACTION_CANNOT_CLONE_TRANSACTION_WITH_PAYPAL_ACCOUNT = '91573';
428
+ const TRANSACTION_CANNOT_CLONE_TRANSACTION_WITH_VAULT_CREDIT_CARD = '91540';
429
+ const TRANSACTION_CANNOT_CLONE_UNSUCCESSFUL_TRANSACTION = '91542';
430
+ const TRANSACTION_CANNOT_CLONE_VOICE_AUTHORIZATIONS = '91541';
431
+ const TRANSACTION_CANNOT_HOLD_IN_ESCROW = '91560';
432
+ const TRANSACTION_CANNOT_PARTIALLY_REFUND_ESCROWED_TRANSACTION = '91563';
433
+ const TRANSACTION_CANNOT_REFUND_CREDIT = '91505';
434
+ const TRANSACTION_CANNOT_REFUND_SETTLING_TRANSACTION = '91574';
435
+ const TRANSACTION_CANNOT_REFUND_UNLESS_SETTLED = '91506';
436
+ const TRANSACTION_CANNOT_REFUND_WITH_PENDING_MERCHANT_ACCOUNT = '91559';
437
+ const TRANSACTION_CANNOT_REFUND_WITH_SUSPENDED_MERCHANT_ACCOUNT = '91538';
438
+ const TRANSACTION_CANNOT_RELEASE_FROM_ESCROW = '91561';
439
+ const TRANSACTION_CANNOT_SIMULATE_SETTLEMENT = '91575';
440
+ const TRANSACTION_CANNOT_SUBMIT_FOR_PARTIAL_SETTLEMENT = '915103';
441
+ const TRANSACTION_CANNOT_SUBMIT_FOR_SETTLEMENT = '91507';
442
+ const TRANSACTION_CANNOT_UPDATE_DETAILS_NOT_SUBMITTED_FOR_SETTLEMENT = '915129';
443
+ const TRANSACTION_CHANNEL_IS_TOO_LONG = '91550';
444
+ const TRANSACTION_CREDIT_CARD_IS_REQUIRED = '91508';
445
+ const TRANSACTION_CUSTOMER_DEFAULT_PAYMENT_METHOD_CARD_TYPE_IS_NOT_ACCEPTED = '81509';
446
+ const TRANSACTION_CUSTOMER_DOES_NOT_HAVE_CREDIT_CARD = '91511';
447
+ const TRANSACTION_CUSTOMER_ID_IS_INVALID = '91510';
448
+ const TRANSACTION_CUSTOM_FIELD_IS_INVALID = '91526';
449
+ const TRANSACTION_CUSTOM_FIELD_IS_TOO_LONG = '81527';
450
+ const TRANSACTION_HAS_ALREADY_BEEN_REFUNDED = '91512';
451
+ const TRANSACTION_IDEAL_PAYMENT_NOT_COMPLETE = '815141';
452
+ const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_MATCH3_D_SECURE_MERCHANT_ACCOUNT = '91584';
453
+ const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_MATCH_IDEAL_PAYMENT_MERCHANT_ACCOUNT = '915143';
454
+ const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_MOTO = '91558';
455
+ const TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_REFUNDS = '91547';
456
+ const TRANSACTION_MERCHANT_ACCOUNT_ID_IS_INVALID = '91513';
457
+ const TRANSACTION_MERCHANT_ACCOUNT_IS_SUSPENDED = '91514';
458
+ const TRANSACTION_MERCHANT_ACCOUNT_NAME_IS_INVALID = '91513'; //Deprecated
459
+ const TRANSACTION_OPTIONS_PAY_PAL_CUSTOM_FIELD_TOO_LONG = '91580';
460
+ const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_CLONING = '91544';
461
+ const TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_PAYPAL_UNILATERAL = '91582';
462
+ const TRANSACTION_OPTIONS_USE_BILLING_FOR_SHIPPING_DISABLED = '91572';
463
+ const TRANSACTION_OPTIONS_VAULT_IS_DISABLED = '91525';
464
+ const TRANSACTION_ORDER_ID_DOES_NOT_MATCH_IDEAL_PAYMENT_ORDER_ID = '91503';
465
+ const TRANSACTION_ORDER_ID_IS_REQUIRED_WITH_IDEAL_PAYMENT = '91502';
466
+ const TRANSACTION_ORDER_ID_IS_TOO_LONG = '91501';
467
+ const TRANSACTION_PAYMENT_INSTRUMENT_NOT_SUPPORTED_BY_MERCHANT_ACCOUNT = '91577';
468
+ const TRANSACTION_PAYMENT_INSTRUMENT_TYPE_IS_NOT_ACCEPTED = '915101';
469
+ const TRANSACTION_PAYMENT_METHOD_CONFLICT = '91515';
470
+ const TRANSACTION_PAYMENT_METHOD_CONFLICT_WITH_VENMO_SDK = '91549';
471
+ const TRANSACTION_PAYMENT_METHOD_DOES_NOT_BELONG_TO_CUSTOMER = '91516';
472
+ const TRANSACTION_PAYMENT_METHOD_DOES_NOT_BELONG_TO_SUBSCRIPTION = '91527';
473
+ const TRANSACTION_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = '91567';
474
+ const TRANSACTION_PAYMENT_METHOD_NONCE_CONSUMED = '91564';
475
+ const TRANSACTION_PAYMENT_METHOD_NONCE_HAS_NO_VALID_PAYMENT_INSTRUMENT_TYPE = '91569';
476
+ const TRANSACTION_PAYMENT_METHOD_NONCE_LOCKED = '91566';
477
+ const TRANSACTION_PAYMENT_METHOD_NONCE_UNKNOWN = '91565';
478
+ const TRANSACTION_PAYMENT_METHOD_TOKEN_CARD_TYPE_IS_NOT_ACCEPTED = '91517';
479
+ const TRANSACTION_PAYMENT_METHOD_TOKEN_IS_INVALID = '91518';
480
+ const TRANSACTION_PAYPAL_NOT_ENABLED = '91576';
481
+ const TRANSACTION_PAY_PAL_AUTH_EXPIRED = '91579';
482
+ const TRANSACTION_PAY_PAL_VAULT_RECORD_MISSING_DATA = '91583';
483
+ const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_CANNOT_BE_SET = '91519';
484
+ const TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_IS_INVALID = '81520';
485
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_AUTHS = '915104';
486
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_CREDITS = '91546';
487
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_PARTIAL_SETTLEMENT = '915102';
488
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_ORDER_ID = '915107';
489
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DESCRIPTOR = '915108';
490
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_UPDATING_DETAILS = '915130';
491
+ const TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_VOICE_AUTHORIZATIONS = '91545';
492
+ const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_INVALID = '91548';
493
+ const TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG = '91537';
494
+ const TRANSACTION_REFUND_AMOUNT_IS_TOO_LARGE = '91521';
495
+ const TRANSACTION_SERVICE_FEE_AMOUNT_CANNOT_BE_NEGATIVE = '91554';
496
+ const TRANSACTION_SERVICE_FEE_AMOUNT_FORMAT_IS_INVALID = '91555';
497
+ const TRANSACTION_SERVICE_FEE_AMOUNT_IS_TOO_LARGE = '91556';
498
+ const TRANSACTION_SERVICE_FEE_AMOUNT_NOT_ALLOWED_ON_MASTER_MERCHANT_ACCOUNT = '91557';
499
+ const TRANSACTION_SERVICE_FEE_IS_NOT_ALLOWED_ON_CREDITS = '91552';
500
+ const TRANSACTION_SERVICE_FEE_NOT_ACCEPTED_FOR_PAYPAL = '91578';
501
+ const TRANSACTION_SETTLEMENT_AMOUNT_IS_LESS_THAN_SERVICE_FEE_AMOUNT = '91551';
502
+ const TRANSACTION_SETTLEMENT_AMOUNT_IS_TOO_LARGE = '91522';
503
+ const TRANSACTION_SHIPPING_ADDRESS_DOESNT_MATCH_CUSTOMER = '91581';
504
+ const TRANSACTION_SUBSCRIPTION_DOES_NOT_BELONG_TO_CUSTOMER = '91529';
505
+ const TRANSACTION_SUBSCRIPTION_ID_IS_INVALID = '91528';
506
+ const TRANSACTION_SUBSCRIPTION_STATUS_MUST_BE_PAST_DUE = '91531';
507
+ const TRANSACTION_SUB_MERCHANT_ACCOUNT_REQUIRES_SERVICE_FEE_AMOUNT = '91553';
508
+ const TRANSACTION_TAX_AMOUNT_CANNOT_BE_NEGATIVE = '81534';
509
+ const TRANSACTION_TAX_AMOUNT_FORMAT_IS_INVALID = '81535';
510
+ const TRANSACTION_TAX_AMOUNT_IS_TOO_LARGE = '81536';
511
+
512
+ const TRANSACTION_THREE_D_SECURE_AUTHENTICATION_FAILED = '81571';
513
+ const TRANSACTION_THREE_D_SECURE_TOKEN_IS_INVALID = '91568';
514
+ const TRANSACTION_THREE_D_SECURE_TRANSACTION_DATA_DOESNT_MATCH_VERIFY = '91570';
515
+ const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_REQUIRED = '915113';
516
+ const TRANSACTION_THREE_D_SECURE_CAVV_IS_REQUIRED = '915116';
517
+ const TRANSACTION_THREE_D_SECURE_XID_IS_REQUIRED = '915115';
518
+ const TRANSACTION_THREE_D_SECURE_ECI_FLAG_IS_INVALID = '915114';
519
+ const TRANSACTION_THREE_D_SECURE_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_CARD_TYPE = '915131';
520
+ const TRANSACTION_TYPE_IS_INVALID = '91523';
521
+ const TRANSACTION_TYPE_IS_REQUIRED = '91524';
522
+ const TRANSACTION_UNSUPPORTED_VOICE_AUTHORIZATION = '91539';
523
+
524
+ const VERIFICATION_OPTIONS_AMOUNT_CANNOT_BE_NEGATIVE = '94201';
525
+ const VERIFICATION_OPTIONS_AMOUNT_FORMAT_IS_INVALID = '94202';
526
+ const VERIFICATION_OPTIONS_AMOUNT_IS_TOO_LARGE = '94207';
527
+ const VERIFICATION_OPTIONS_AMOUNT_NOT_SUPPORTED_BY_PROCESSOR = '94203';
528
+ const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_ID_IS_INVALID = '94204';
529
+ const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_SUSPENDED = '94205';
530
+ const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_IS_FORBIDDEN = '94206';
531
+ const VERIFICATION_OPTIONS_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = '94208';
532
+ }
533
+ class_alias('Braintree\Error\Codes', 'Braintree_Error_Codes');
lib/Jmango360/Braintree/lib/Braintree/Error/ErrorCollection.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Error;
3
+
4
+ use Braintree\Util;
5
+
6
+ /**
7
+ *
8
+ * Error handler
9
+ * Handles validation errors
10
+ *
11
+ * Contains a read-only property $error which is a ValidationErrorCollection
12
+ *
13
+ * @package Braintree
14
+ * @subpackage Errors
15
+ * @category Errors
16
+ *
17
+ * @property-read object $errors
18
+ */
19
+ class ErrorCollection implements \Countable
20
+ {
21
+ private $_errors;
22
+
23
+ public function __construct($errorData)
24
+ {
25
+ $this->_errors =
26
+ new ValidationErrorCollection($errorData);
27
+ }
28
+
29
+ /**
30
+ * Return count of items in collection
31
+ * Implements countable
32
+ *
33
+ * @return integer
34
+ */
35
+ public function count()
36
+ {
37
+ return $this->deepSize();
38
+ }
39
+
40
+ /**
41
+ * Returns all of the validation errors at all levels of nesting in a single, flat array.
42
+ */
43
+ public function deepAll()
44
+ {
45
+ return $this->_errors->deepAll();
46
+ }
47
+
48
+ /**
49
+ * Returns the total number of validation errors at all levels of nesting. For example,
50
+ *if creating a customer with a credit card and a billing address, and each of the customer,
51
+ * credit card, and billing address has 1 error, this method will return 3.
52
+ *
53
+ * @return int size
54
+ */
55
+ public function deepSize()
56
+ {
57
+ $size = $this->_errors->deepSize();
58
+ return $size;
59
+ }
60
+
61
+ /**
62
+ * return errors for the passed key name
63
+ *
64
+ * @param string $key
65
+ * @return mixed
66
+ */
67
+ public function forKey($key)
68
+ {
69
+ return $this->_errors->forKey($key);
70
+ }
71
+
72
+ /**
73
+ * return errors for the passed html field.
74
+ * For example, $result->errors->onHtmlField("transaction[customer][last_name]")
75
+ *
76
+ * @param string $field
77
+ * @return array
78
+ */
79
+ public function onHtmlField($field)
80
+ {
81
+ $pieces = preg_split("/[\[\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
82
+ $errors = $this;
83
+ foreach(array_slice($pieces, 0, -1) as $key) {
84
+ $errors = $errors->forKey(Util::delimiterToCamelCase($key));
85
+ if (!isset($errors)) { return []; }
86
+ }
87
+ $finalKey = Util::delimiterToCamelCase(end($pieces));
88
+ return $errors->onAttribute($finalKey);
89
+ }
90
+
91
+ /**
92
+ * Returns the errors at the given nesting level (see forKey) in a single, flat array:
93
+ *
94
+ * <code>
95
+ * $result = Customer::create(...);
96
+ * $customerErrors = $result->errors->forKey('customer')->shallowAll();
97
+ * </code>
98
+ */
99
+ public function shallowAll()
100
+ {
101
+ return $this->_errors->shallowAll();
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @ignore
107
+ */
108
+ public function __get($name)
109
+ {
110
+ $varName = "_$name";
111
+ return isset($this->$varName) ? $this->$varName : null;
112
+ }
113
+
114
+ /**
115
+ *
116
+ * @ignore
117
+ */
118
+ public function __toString()
119
+ {
120
+ return sprintf('%s', $this->_errors);
121
+ }
122
+ }
123
+ class_alias('Braintree\Error\ErrorCollection', 'Braintree_Error_ErrorCollection');
lib/Jmango360/Braintree/lib/Braintree/Error/Validation.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Error;
3
+
4
+ use Braintree\Util;
5
+
6
+ /**
7
+ * error object returned as part of a validation error collection
8
+ * provides read-only access to $attribute, $code, and $message
9
+ *
10
+ * <b>== More information ==</b>
11
+ *
12
+ * For more detailed information on Validation errors, see {@link http://www.braintreepayments.com/gateway/validation-errors http://www.braintreepaymentsolutions.com/gateway/validation-errors}
13
+ *
14
+ * @package Braintree
15
+ * @subpackage Error
16
+ *
17
+ * @property-read string $attribute
18
+ * @property-read string $code
19
+ * @property-read string $message
20
+ */
21
+ class Validation
22
+ {
23
+ private $_attribute;
24
+ private $_code;
25
+ private $_message;
26
+
27
+ /**
28
+ * @ignore
29
+ * @param array $attributes
30
+ */
31
+ public function __construct($attributes)
32
+ {
33
+ $this->_initializeFromArray($attributes);
34
+ }
35
+ /**
36
+ * initializes instance properties from the keys/values of an array
37
+ * @ignore
38
+ * @access protected
39
+ * @param array $attributes array of properties to set - single level
40
+ * @return void
41
+ */
42
+ private function _initializeFromArray($attributes)
43
+ {
44
+ foreach($attributes AS $name => $value) {
45
+ $varName = "_$name";
46
+ $this->$varName = Util::delimiterToCamelCase($value, '_');
47
+ }
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @ignore
53
+ */
54
+ public function __get($name)
55
+ {
56
+ $varName = "_$name";
57
+ return isset($this->$varName) ? $this->$varName : null;
58
+ }
59
+ }
60
+ class_alias('Braintree\Error\Validation', 'Braintree_Error_Validation');
lib/Jmango360/Braintree/lib/Braintree/Error/ValidationErrorCollection.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Error;
3
+
4
+ use Braintree\Collection;
5
+
6
+ /**
7
+ * collection of errors enumerating all validation errors for a given request
8
+ *
9
+ * <b>== More information ==</b>
10
+ *
11
+ * For more detailed information on Validation errors, see {@link http://www.braintreepayments.com/gateway/validation-errors http://www.braintreepaymentsolutions.com/gateway/validation-errors}
12
+ *
13
+ * @package Braintree
14
+ * @subpackage Error
15
+ *
16
+ * @property-read array $errors
17
+ * @property-read array $nested
18
+ */
19
+ class ValidationErrorCollection extends Collection
20
+ {
21
+ private $_errors = [];
22
+ private $_nested = [];
23
+
24
+ /**
25
+ * @ignore
26
+ */
27
+ public function __construct($data)
28
+ {
29
+ foreach($data AS $key => $errorData)
30
+ // map errors to new collections recursively
31
+ if ($key == 'errors') {
32
+ foreach ($errorData AS $error) {
33
+ $this->_errors[] = new Validation($error);
34
+ }
35
+ } else {
36
+ $this->_nested[$key] = new ValidationErrorCollection($errorData);
37
+ }
38
+
39
+ }
40
+
41
+ public function deepAll()
42
+ {
43
+ $validationErrors = array_merge([], $this->_errors);
44
+ foreach($this->_nested as $nestedErrors)
45
+ {
46
+ $validationErrors = array_merge($validationErrors, $nestedErrors->deepAll());
47
+ }
48
+ return $validationErrors;
49
+ }
50
+
51
+ public function deepSize()
52
+ {
53
+ $total = sizeof($this->_errors);
54
+ foreach($this->_nested as $_nestedErrors)
55
+ {
56
+ $total = $total + $_nestedErrors->deepSize();
57
+ }
58
+ return $total;
59
+ }
60
+
61
+ public function forIndex($index)
62
+ {
63
+ return $this->forKey("index" . $index);
64
+ }
65
+
66
+ public function forKey($key)
67
+ {
68
+ return isset($this->_nested[$key]) ? $this->_nested[$key] : null;
69
+ }
70
+
71
+ public function onAttribute($attribute)
72
+ {
73
+ $matches = [];
74
+ foreach ($this->_errors AS $key => $error) {
75
+ if($error->attribute == $attribute) {
76
+ $matches[] = $error;
77
+ }
78
+ }
79
+ return $matches;
80
+ }
81
+
82
+
83
+ public function shallowAll()
84
+ {
85
+ return $this->_errors;
86
+ }
87
+
88
+ /**
89
+ *
90
+ * @ignore
91
+ */
92
+ public function __get($name)
93
+ {
94
+ $varName = "_$name";
95
+ return isset($this->$varName) ? $this->$varName : null;
96
+ }
97
+
98
+ /**
99
+ * @ignore
100
+ */
101
+ public function __toString()
102
+ {
103
+ $output = [];
104
+
105
+ // TODO: implement scope
106
+ if (!empty($this->_errors)) {
107
+ $output[] = $this->_inspect($this->_errors);
108
+ }
109
+ if (!empty($this->_nested)) {
110
+ foreach ($this->_nested AS $key => $values) {
111
+ $output[] = $this->_inspect($this->_nested);
112
+ }
113
+ }
114
+ return join(', ', $output);
115
+ }
116
+
117
+ /**
118
+ * @ignore
119
+ */
120
+ private function _inspect($errors, $scope = null)
121
+ {
122
+ $eOutput = '[' . __CLASS__ . '/errors:[';
123
+ foreach($errors AS $error => $errorObj) {
124
+ $outputErrs[] = "({$errorObj->error['code']} {$errorObj->error['message']})";
125
+ }
126
+ $eOutput .= join(', ', $outputErrs) . ']]';
127
+
128
+ return $eOutput;
129
+ }
130
+ }
131
+ class_alias('Braintree\Error\ValidationErrorCollection', 'Braintree_Error_ValidationErrorCollection');
lib/Jmango360/Braintree/lib/Braintree/EuropeBankAccount.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree EuropeBankAccount module
6
+ * Creates and manages Braintree Europe Bank Accounts
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * See {@link https://developers.braintreepayments.com/javascript+php}<br />
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $account-holder-name
16
+ * @property-read string $bic
17
+ * @property-read string $customerId
18
+ * @property-read string $default
19
+ * @property-read string $image-url
20
+ * @property-read string $mandate-reference-number
21
+ * @property-read string $masked-iban
22
+ * @property-read string $token
23
+ */
24
+ class EuropeBankAccount extends Base
25
+ {
26
+
27
+ /* instance methods */
28
+ /**
29
+ * returns false if default is null or false
30
+ *
31
+ * @return boolean
32
+ */
33
+ public function isDefault()
34
+ {
35
+ return $this->default;
36
+ }
37
+
38
+ /**
39
+ * factory method: returns an instance of EuropeBankAccount
40
+ * to the requesting method, with populated properties
41
+ *
42
+ * @ignore
43
+ * @return EuropeBankAccount
44
+ */
45
+ public static function factory($attributes)
46
+ {
47
+ $defaultAttributes = [
48
+ ];
49
+
50
+ $instance = new self();
51
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
52
+ return $instance;
53
+ }
54
+
55
+ /**
56
+ * sets instance properties from an array of values
57
+ *
58
+ * @access protected
59
+ * @param array $europeBankAccountAttribs array of EuropeBankAccount properties
60
+ * @return void
61
+ */
62
+ protected function _initialize($europeBankAccountAttribs)
63
+ {
64
+ $this->_attributes = $europeBankAccountAttribs;
65
+ }
66
+ }
67
+ class_alias('Braintree\EuropeBankAccount', 'Braintree_EuropeBankAccount');
lib/Jmango360/Braintree/lib/Braintree/Exception.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * super class for all Braintree exceptions
6
+ *
7
+ * @package Braintree
8
+ * @subpackage Exception
9
+ */
10
+ class Exception extends \Exception
11
+ {
12
+ }
13
+ class_alias('Braintree\Exception', 'Braintree_Exception');
lib/Jmango360/Braintree/lib/Braintree/Exception/Authentication.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when authentication fails.
8
+ * This may be caused by an incorrect Configuration
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Exception
12
+ */
13
+ class Authentication extends Exception
14
+ {
15
+
16
+ }
17
+ class_alias('Braintree\Exception\Authentication', 'Braintree_Exception_Authentication');
lib/Jmango360/Braintree/lib/Braintree/Exception/Authorization.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when authorization fails
8
+ * Raised when the API key being used is not authorized to perform
9
+ * the attempted action according to the roles assigned to the user
10
+ * who owns the API key.
11
+ *
12
+ * @package Braintree
13
+ * @subpackage Exception
14
+ */
15
+ class Authorization extends Exception
16
+ {
17
+
18
+ }
19
+ class_alias('Braintree\Exception\Authorization', 'Braintree_Exception_Authorization');
lib/Jmango360/Braintree/lib/Braintree/Exception/Configuration.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the Braintree library is not completely configured.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ * @see Configuration
12
+ */
13
+ class Configuration extends Exception
14
+ {
15
+
16
+ }
17
+ class_alias('Braintree\Exception\Configuration', 'Braintree_Exception_Configuration');
lib/Jmango360/Braintree/lib/Braintree/Exception/Connection.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the connection fails
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ * @copyright 2015 Braintree, a division of PayPal, Inc.
12
+ */
13
+ class Connection extends Exception
14
+ {
15
+
16
+ }
17
+ class_alias('Braintree\Exception\Connection', 'Braintree_Exception_Connection');
lib/Jmango360/Braintree/lib/Braintree/Exception/DownForMaintenance.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the gateway is down for maintenance.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class DownForMaintenance extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\DownForMaintenance', 'Braintree_Exception_DownForMaintenance');
lib/Jmango360/Braintree/lib/Braintree/Exception/ForgedQueryString.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when a suspected forged query string is present
8
+ * Raised from methods that confirm transparent redirect requests
9
+ * when the given query string cannot be verified. This may indicate
10
+ * an attempted hack on the merchant's transparent redirect
11
+ * confirmation URL.
12
+ *
13
+ * @package Braintree
14
+ * @subpackage Exception
15
+ */
16
+ class ForgedQueryString extends Exception
17
+ {
18
+
19
+ }
20
+ class_alias('Braintree\Exception\ForgedQueryString', 'Braintree_Exception_ForgedQueryString');
lib/Jmango360/Braintree/lib/Braintree/Exception/InvalidChallenge.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ class InvalidChallenge extends Exception
7
+ {
8
+ }
9
+ class_alias('Braintree\Exception\InvalidChallenge', 'Braintree_Exception_InvalidChallenge');
lib/Jmango360/Braintree/lib/Braintree/Exception/InvalidSignature.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ class InvalidSignature extends Exception
7
+ {
8
+ }
9
+ class_alias('Braintree\Exception\InvalidSignature', 'Braintree_Exception_InvalidSignature');
lib/Jmango360/Braintree/lib/Braintree/Exception/NotFound.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when a record could not be found.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class NotFound extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\NotFound', 'Braintree_Exception_NotFound');
lib/Jmango360/Braintree/lib/Braintree/Exception/SSLCaFileNotFound.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the SSL CaFile is not found.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class SSLCaFileNotFound extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\SSLCaFileNotFound', 'Braintree_Exception_SSLCaFileNotFound');
lib/Jmango360/Braintree/lib/Braintree/Exception/SSLCertificate.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the SSL certificate fails verification.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class SSLCertificate extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\SSLCertificate', 'Braintree_Exception_SSLCertificate');
lib/Jmango360/Braintree/lib/Braintree/Exception/ServerError.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when an unexpected server error occurs.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class ServerError extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\ServerError', 'Braintree_Exception_ServerError');
lib/Jmango360/Braintree/lib/Braintree/Exception/TestOperationPerformedInProduction.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when a test method is used in production.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class TestOperationPerformedInProduction extends Exception
13
+ {
14
+ }
15
+ class_alias('Braintree\Exception\TestOperationPerformedInProduction', 'Braintree_Exception_TestOperationPerformedInProduction');
lib/Jmango360/Braintree/lib/Braintree/Exception/Timeout.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when a Timeout occurs
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class Timeout extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\Timeout', 'Braintree_Exception_Timeout');
lib/Jmango360/Braintree/lib/Braintree/Exception/TooManyRequests.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when the gateway request rate-limit is exceeded.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class TooManyRequests extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\TooManyRequests', 'Braintree_Exception_TooManyRequests');
lib/Jmango360/Braintree/lib/Braintree/Exception/Unexpected.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when an error occurs that the client library is not built to handle.
8
+ * This shouldn't happen.
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Exception
12
+ */
13
+ class Unexpected extends Exception
14
+ {
15
+
16
+ }
17
+ class_alias('Braintree\Exception\Unexpected', 'Braintree_Exception_Unexpected');
lib/Jmango360/Braintree/lib/Braintree/Exception/UpgradeRequired.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised when a client library must be upgraded.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class UpgradeRequired extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\UpgradeRequired', 'Braintree_Exception_UpgradeRequired');
lib/Jmango360/Braintree/lib/Braintree/Exception/ValidationsFailed.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Exception;
3
+
4
+ use Braintree\Exception;
5
+
6
+ /**
7
+ * Raised from non-validating methods when gateway validations fail.
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Exception
11
+ */
12
+ class ValidationsFailed extends Exception
13
+ {
14
+
15
+ }
16
+ class_alias('Braintree\Exception\ValidationsFailed', 'Braintree_Exception_ValidationsFailed');
lib/Jmango360/Braintree/lib/Braintree/FacilitatorDetails.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class FacilitatorDetails extends Base
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self();
9
+ $instance->_initialize($attributes);
10
+
11
+ return $instance;
12
+ }
13
+
14
+ protected function _initialize($attributes)
15
+ {
16
+ $this->_attributes = $attributes;
17
+ }
18
+
19
+ /**
20
+ * returns a string representation of the three d secure info
21
+ * @return string
22
+ */
23
+ public function __toString()
24
+ {
25
+ return __CLASS__ . '[' .
26
+ Util::attributesToString($this->_attributes) .']';
27
+ }
28
+
29
+ }
30
+ class_alias('Braintree\FacilitatorDetails', 'Braintree_FacilitatorDetails');
lib/Jmango360/Braintree/lib/Braintree/Gateway.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Gateway module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+ class Gateway
11
+ {
12
+ /**
13
+ *
14
+ * @var Configuration
15
+ */
16
+ public $config;
17
+
18
+ public function __construct($config)
19
+ {
20
+ if (is_array($config)) {
21
+ $config = new Configuration($config);
22
+ }
23
+ $this->config = $config;
24
+ }
25
+
26
+ /**
27
+ *
28
+ * @return AddOnGateway
29
+ */
30
+ public function addOn()
31
+ {
32
+ return new AddOnGateway($this);
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @return AddressGateway
38
+ */
39
+ public function address()
40
+ {
41
+ return new AddressGateway($this);
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return ClientTokenGateway
47
+ */
48
+ public function clientToken()
49
+ {
50
+ return new ClientTokenGateway($this);
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return CreditCardGateway
56
+ */
57
+ public function creditCard()
58
+ {
59
+ return new CreditCardGateway($this);
60
+ }
61
+
62
+ /**
63
+ *
64
+ * @return CreditCardVerificationGateway
65
+ */
66
+ public function creditCardVerification()
67
+ {
68
+ return new CreditCardVerificationGateway($this);
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @return CustomerGateway
74
+ */
75
+ public function customer()
76
+ {
77
+ return new CustomerGateway($this);
78
+ }
79
+
80
+ /**
81
+ *
82
+ * @return DiscountGateway
83
+ */
84
+ public function discount()
85
+ {
86
+ return new DiscountGateway($this);
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return MerchantGateway
92
+ */
93
+ public function merchant()
94
+ {
95
+ return new MerchantGateway($this);
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @return MerchantAccountGateway
101
+ */
102
+ public function merchantAccount()
103
+ {
104
+ return new MerchantAccountGateway($this);
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @return OAuthGateway
110
+ */
111
+ public function oauth()
112
+ {
113
+ return new OAuthGateway($this);
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @return PaymentMethodGateway
119
+ */
120
+ public function paymentMethod()
121
+ {
122
+ return new PaymentMethodGateway($this);
123
+ }
124
+
125
+ /**
126
+ *
127
+ * @return PaymentMethodNonceGateway
128
+ */
129
+ public function paymentMethodNonce()
130
+ {
131
+ return new PaymentMethodNonceGateway($this);
132
+ }
133
+
134
+ /**
135
+ *
136
+ * @return PayPalAccountGateway
137
+ */
138
+ public function payPalAccount()
139
+ {
140
+ return new PayPalAccountGateway($this);
141
+ }
142
+
143
+ /**
144
+ *
145
+ * @return PlanGateway
146
+ */
147
+ public function plan()
148
+ {
149
+ return new PlanGateway($this);
150
+ }
151
+
152
+ /**
153
+ *
154
+ * @return SettlementBatchSummaryGateway
155
+ */
156
+ public function settlementBatchSummary()
157
+ {
158
+ return new SettlementBatchSummaryGateway($this);
159
+ }
160
+
161
+ /**
162
+ *
163
+ * @return SubscriptionGateway
164
+ */
165
+ public function subscription()
166
+ {
167
+ return new SubscriptionGateway($this);
168
+ }
169
+
170
+ /**
171
+ *
172
+ * @return TestingGateway
173
+ */
174
+ public function testing()
175
+ {
176
+ return new TestingGateway($this);
177
+ }
178
+
179
+ /**
180
+ *
181
+ * @return TransactionGateway
182
+ */
183
+ public function transaction()
184
+ {
185
+ return new TransactionGateway($this);
186
+ }
187
+
188
+ /**
189
+ *
190
+ * @return TransparentRedirectGateway
191
+ */
192
+ public function transparentRedirect()
193
+ {
194
+ return new TransparentRedirectGateway($this);
195
+ }
196
+
197
+ /**
198
+ *
199
+ * @return UsBankAccountGateway
200
+ */
201
+ public function usBankAccount()
202
+ {
203
+ return new UsBankAccountGateway($this);
204
+ }
205
+
206
+ /**
207
+ *
208
+ * @return IdealPaymentGateway
209
+ */
210
+ public function idealPayment()
211
+ {
212
+ return new IdealPaymentGateway($this);
213
+ }
214
+
215
+ /**
216
+ *
217
+ * @return WebhookNotificationGateway
218
+ */
219
+ public function webhookNotification()
220
+ {
221
+ return new WebhookNotificationGateway($this);
222
+ }
223
+ }
224
+ class_alias('Braintree\Gateway', 'Braintree_Gateway');
lib/Jmango360/Braintree/lib/Braintree/Http.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree HTTP Client
6
+ * processes Http requests using curl
7
+ */
8
+ class Http
9
+ {
10
+ protected $_config;
11
+ private $_useClientCredentials = false;
12
+
13
+ public function __construct($config)
14
+ {
15
+ $this->_config = $config;
16
+ }
17
+
18
+ public function delete($path)
19
+ {
20
+ $response = $this->_doRequest('DELETE', $path);
21
+ if ($response['status'] === 200) {
22
+ return true;
23
+ } else {
24
+ Util::throwStatusCodeException($response['status']);
25
+ }
26
+ }
27
+
28
+ public function get($path)
29
+ {
30
+ $response = $this->_doRequest('GET', $path);
31
+ if ($response['status'] === 200) {
32
+ return Xml::buildArrayFromXml($response['body']);
33
+ } else {
34
+ Util::throwStatusCodeException($response['status']);
35
+ }
36
+ }
37
+
38
+ public function post($path, $params = null)
39
+ {
40
+ $response = $this->_doRequest('POST', $path, $this->_buildXml($params));
41
+ $responseCode = $response['status'];
42
+ if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode == 400) {
43
+ return Xml::buildArrayFromXml($response['body']);
44
+ } else {
45
+ Util::throwStatusCodeException($responseCode);
46
+ }
47
+ }
48
+
49
+ public function put($path, $params = null)
50
+ {
51
+ $response = $this->_doRequest('PUT', $path, $this->_buildXml($params));
52
+ $responseCode = $response['status'];
53
+ if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode == 400) {
54
+ return Xml::buildArrayFromXml($response['body']);
55
+ } else {
56
+ Util::throwStatusCodeException($responseCode);
57
+ }
58
+ }
59
+
60
+ private function _buildXml($params)
61
+ {
62
+ return empty($params) ? null : Xml::buildXmlFromArray($params);
63
+ }
64
+
65
+ private function _getHeaders()
66
+ {
67
+ return [
68
+ 'Accept: application/xml',
69
+ 'Content-Type: application/xml',
70
+ ];
71
+ }
72
+
73
+ private function _getAuthorization()
74
+ {
75
+ if ($this->_useClientCredentials) {
76
+ return [
77
+ 'user' => $this->_config->getClientId(),
78
+ 'password' => $this->_config->getClientSecret(),
79
+ ];
80
+ } else if ($this->_config->isAccessToken()) {
81
+ return [
82
+ 'token' => $this->_config->getAccessToken(),
83
+ ];
84
+ } else {
85
+ return [
86
+ 'user' => $this->_config->getPublicKey(),
87
+ 'password' => $this->_config->getPrivateKey(),
88
+ ];
89
+ }
90
+ }
91
+
92
+ public function useClientCredentials()
93
+ {
94
+ $this->_useClientCredentials = true;
95
+ }
96
+
97
+ private function _doRequest($httpVerb, $path, $requestBody = null)
98
+ {
99
+ return $this->_doUrlRequest($httpVerb, $this->_config->baseUrl() . $path, $requestBody);
100
+ }
101
+
102
+ public function _doUrlRequest($httpVerb, $url, $requestBody = null)
103
+ {
104
+ $curl = curl_init();
105
+ curl_setopt($curl, CURLOPT_TIMEOUT, $this->_config->timeout());
106
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $httpVerb);
107
+ curl_setopt($curl, CURLOPT_URL, $url);
108
+
109
+ if ($this->_config->acceptGzipEncoding()) {
110
+ curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
111
+ }
112
+ if ($this->_config->sslVersion()) {
113
+ curl_setopt($curl, CURLOPT_SSLVERSION, $this->_config->sslVersion());
114
+ }
115
+
116
+ $headers = $this->_getHeaders($curl);
117
+ $headers[] = 'User-Agent: Braintree PHP Library ' . Version::get();
118
+ $headers[] = 'X-ApiVersion: ' . Configuration::API_VERSION;
119
+
120
+ $authorization = $this->_getAuthorization();
121
+ if (isset($authorization['user'])) {
122
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
123
+ curl_setopt($curl, CURLOPT_USERPWD, $authorization['user'] . ':' . $authorization['password']);
124
+ } else if (isset($authorization['token'])) {
125
+ $headers[] = 'Authorization: Bearer ' . $authorization['token'];
126
+ }
127
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
128
+
129
+ // curl_setopt($curl, CURLOPT_VERBOSE, true);
130
+ if ($this->_config->sslOn()) {
131
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
132
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
133
+ curl_setopt($curl, CURLOPT_CAINFO, $this->getCaFile());
134
+ }
135
+
136
+ if (!empty($requestBody)) {
137
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
138
+ }
139
+
140
+ if ($this->_config->isUsingProxy()) {
141
+ $proxyHost = $this->_config->getProxyHost();
142
+ $proxyPort = $this->_config->getProxyPort();
143
+ $proxyType = $this->_config->getProxyType();
144
+ $proxyUser = $this->_config->getProxyUser();
145
+ $proxyPwd= $this->_config->getProxyPassword();
146
+ curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
147
+ if (!empty($proxyType)) {
148
+ curl_setopt($curl, CURLOPT_PROXYTYPE, $proxyType);
149
+ }
150
+ if ($this->_config->isAuthenticatedProxy()) {
151
+ curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUser . ':' . $proxyPwd);
152
+ }
153
+ }
154
+
155
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
156
+ $response = curl_exec($curl);
157
+ $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
158
+ $error_code = curl_errno($curl);
159
+ $error = curl_error($curl);
160
+
161
+ if ($error_code == 28 && $httpStatus == 0) {
162
+ throw new Exception\Timeout();
163
+ }
164
+
165
+ curl_close($curl);
166
+ if ($this->_config->sslOn()) {
167
+ if ($httpStatus == 0) {
168
+ throw new Exception\SSLCertificate($error, $error_code);
169
+ }
170
+ } else if ($error_code) {
171
+ throw new Exception\Connection($error, $error_code);
172
+ }
173
+
174
+ return ['status' => $httpStatus, 'body' => $response];
175
+ }
176
+
177
+ private function getCaFile()
178
+ {
179
+ static $memo;
180
+
181
+ if ($memo === null) {
182
+ $caFile = $this->_config->caFile();
183
+
184
+ if (substr($caFile, 0, 7) !== 'phar://') {
185
+ return $caFile;
186
+ }
187
+
188
+ $extractedCaFile = sys_get_temp_dir() . '/api_braintreegateway_com.ca.crt';
189
+
190
+ if (!file_exists($extractedCaFile) || sha1_file($extractedCaFile) != sha1_file($caFile)) {
191
+ if (!copy($caFile, $extractedCaFile)) {
192
+ throw new Exception\SSLCaFileNotFound();
193
+ }
194
+ }
195
+ $memo = $extractedCaFile;
196
+ }
197
+
198
+ return $memo;
199
+ }
200
+ }
201
+ class_alias('Braintree\Http', 'Braintree_Http');
lib/Jmango360/Braintree/lib/Braintree/IbanBankAccount.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree IbanBankAccount module
6
+ * PHP Version 5
7
+ *
8
+ * @package Braintree
9
+ *
10
+ * @property-read string $maskedIban
11
+ * @property-read string $bic
12
+ * @property-read string $ibanCountry
13
+ * @property-read string $description
14
+ * @property-read string $ibanAccountNumberLast4
15
+ */
16
+ class IbanBankAccount extends Base
17
+ {
18
+ /**
19
+ * create a printable representation of the object as:
20
+ * ClassName[property=value, property=value]
21
+ * @ignore
22
+ * @return string
23
+ */
24
+ public function __toString()
25
+ {
26
+ return __CLASS__ . '[' .
27
+ Util::attributesToString($this->_attributes) . ']';
28
+ }
29
+
30
+ /**
31
+ * sets instance properties from an array of values
32
+ *
33
+ * @ignore
34
+ * @access protected
35
+ * @param array $ibanAttribs array of ibanBankAccount data
36
+ * @return void
37
+ */
38
+ protected function _initialize($ibanAttribs)
39
+ {
40
+ // set the attributes
41
+ $this->_attributes = $ibanAttribs;
42
+ }
43
+
44
+ /**
45
+ * factory method: returns an instance of IbanBankAccount
46
+ * to the requesting method, with populated properties
47
+ * @ignore
48
+ * @return IbanBankAccount
49
+ */
50
+ public static function factory($attributes)
51
+ {
52
+ $instance = new self();
53
+ $instance->_initialize($attributes);
54
+ return $instance;
55
+ }
56
+ }
57
+ class_alias('Braintree\IbanBankAccount', 'Braintree_IbanBankAccount');
lib/Jmango360/Braintree/lib/Braintree/IdealPayment.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree IdealPayment module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Manages Braintree IdealPayments
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ *
20
+ * @property-read string $id
21
+ * @property-read string $idealTransactionId
22
+ * @property-read string $currency
23
+ * @property-read string $amount
24
+ * @property-read string $status
25
+ * @property-read string $orderId
26
+ * @property-read string $issuer
27
+ * @property-read string $ibanBankAccount
28
+ */
29
+ class IdealPayment extends Base
30
+ {
31
+ /**
32
+ * factory method: returns an instance of IdealPayment
33
+ * to the requesting method, with populated properties
34
+ *
35
+ * @ignore
36
+ * @return IdealPayment
37
+ */
38
+ public static function factory($attributes)
39
+ {
40
+ $instance = new self();
41
+ $instance->_initialize($attributes);
42
+ return $instance;
43
+ }
44
+
45
+ /* instance methods */
46
+
47
+ /**
48
+ * sets instance properties from an array of values
49
+ *
50
+ * @access protected
51
+ * @param array $idealPaymentAttribs array of idealPayment data
52
+ * @return void
53
+ */
54
+ protected function _initialize($idealPaymentAttribs)
55
+ {
56
+ // set the attributes
57
+ $this->_attributes = $idealPaymentAttribs;
58
+
59
+ $ibanBankAccount = isset($idealPaymentAttribs['ibanBankAccount']) ?
60
+ IbanBankAccount::factory($idealPaymentAttribs['ibanBankAccount']) :
61
+ null;
62
+ $this->_set('ibanBankAccount', $ibanBankAccount);
63
+ }
64
+
65
+ /**
66
+ * create a printable representation of the object as:
67
+ * ClassName[property=value, property=value]
68
+ * @return string
69
+ */
70
+ public function __toString()
71
+ {
72
+ return __CLASS__ . '[' .
73
+ Util::attributesToString($this->_attributes) . ']';
74
+ }
75
+
76
+
77
+ // static methods redirecting to gateway
78
+
79
+ public static function find($idealPaymentId)
80
+ {
81
+ return Configuration::gateway()->idealPayment()->find($idealPaymentId);
82
+ }
83
+
84
+ public static function sale($idealPaymentId, $transactionAttribs)
85
+ {
86
+ $transactionAttribs['options'] = [
87
+ 'submitForSettlement' => true
88
+ ];
89
+ return Configuration::gateway()->idealPayment()->sale($idealPaymentId, $transactionAttribs);
90
+ }
91
+ }
92
+ class_alias('Braintree\IdealPayment', 'Braintree_IdealPayment');
lib/Jmango360/Braintree/lib/Braintree/IdealPaymentGateway.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree IdealPaymentGateway module
8
+ *
9
+ * @package Braintree
10
+ * @category Resources
11
+ */
12
+
13
+ /**
14
+ * Manages Braintree IdealPayments
15
+ *
16
+ * <b>== More information ==</b>
17
+ *
18
+ *
19
+ * @package Braintree
20
+ * @category Resources
21
+ */
22
+ class IdealPaymentGateway
23
+ {
24
+ private $_gateway;
25
+ private $_config;
26
+ private $_http;
27
+
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+ /**
37
+ * find an IdealPayment by id
38
+ *
39
+ * @access public
40
+ * @param string $idealPaymentId
41
+ * @return IdealPayment
42
+ * @throws Exception\NotFound
43
+ */
44
+ public function find($idealPaymentId)
45
+ {
46
+ try {
47
+ $path = $this->_config->merchantPath() . '/ideal_payments/' . $idealPaymentId;
48
+ $response = $this->_http->get($path);
49
+ return IdealPayment::factory($response['idealPayment']);
50
+ } catch (Exception\NotFound $e) {
51
+ throw new Exception\NotFound(
52
+ 'iDEAL Payment with id ' . $idealPaymentId . ' not found'
53
+ );
54
+ }
55
+ }
56
+
57
+ /**
58
+ * create a new sale for the current IdealPayment
59
+ *
60
+ * @param string $idealPaymentId
61
+ * @param array $transactionAttribs
62
+ * @return Result\Successful|Result\Error
63
+ * @see Transaction::sale()
64
+ */
65
+ public function sale($idealPaymentId, $transactionAttribs)
66
+ {
67
+ return Transaction::sale(
68
+ array_merge(
69
+ $transactionAttribs,
70
+ ['paymentMethodNonce' => $idealPaymentId]
71
+ )
72
+ );
73
+ }
74
+
75
+ /**
76
+ * generic method for validating incoming gateway responses
77
+ *
78
+ * creates a new IdealPayment object and encapsulates
79
+ * it inside a Result\Successful object, or
80
+ * encapsulates a Errors object inside a Result\Error
81
+ * alternatively, throws an Unexpected exception if the response is invalid.
82
+ *
83
+ * @ignore
84
+ * @param array $response gateway response values
85
+ * @return Result\Successful|Result\Error
86
+ * @throws Exception\Unexpected
87
+ */
88
+ private function _verifyGatewayResponse($response)
89
+ {
90
+ if (isset($response['idealPayment'])) {
91
+ // return a populated instance of IdealPayment
92
+ return new Result\Successful(
93
+ IdealPayment::factory($response['idealPayment'])
94
+ );
95
+ } else if (isset($response['apiErrorResponse'])) {
96
+ return new Result\Error($response['apiErrorResponse']);
97
+ } else {
98
+ throw new Exception\Unexpected(
99
+ 'Expected Ideal Payment or apiErrorResponse'
100
+ );
101
+ }
102
+ }
103
+ }
104
+ class_alias('Braintree\IdealPaymentGateway', 'Braintree_IdealPaymentGateway');
lib/Jmango360/Braintree/lib/Braintree/Instance.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Class Instance template
6
+ *
7
+ * @abstract
8
+ */
9
+ abstract class Instance
10
+ {
11
+ protected $_attributes = [];
12
+
13
+ /**
14
+ *
15
+ * @param array $attributes
16
+ */
17
+ public function __construct($attributes)
18
+ {
19
+ if (!empty($attributes)) {
20
+ $this->_initializeFromArray($attributes);
21
+ }
22
+ }
23
+
24
+ /**
25
+ * returns private/nonexistent instance properties
26
+ * @access public
27
+ * @param string $name property name
28
+ * @return mixed contents of instance properties
29
+ */
30
+ public function __get($name)
31
+ {
32
+ if (array_key_exists($name, $this->_attributes)) {
33
+ return $this->_attributes[$name];
34
+ } else {
35
+ trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
36
+ return null;
37
+ }
38
+ }
39
+
40
+ /**
41
+ * used by isset() and empty()
42
+ * @access public
43
+ * @param string $name property name
44
+ * @return boolean
45
+ */
46
+ public function __isset($name)
47
+ {
48
+ return array_key_exists($name, $this->_attributes);
49
+ }
50
+
51
+ /**
52
+ * create a printable representation of the object as:
53
+ * ClassName[property=value, property=value]
54
+ * @return string
55
+ */
56
+ public function __toString()
57
+ {
58
+ $objOutput = Util::implodeAssociativeArray($this->_attributes);
59
+ return get_class($this) .'[' . $objOutput . ']';
60
+ }
61
+ /**
62
+ * initializes instance properties from the keys/values of an array
63
+ * @ignore
64
+ * @access protected
65
+ * @param <type> $aAttribs array of properties to set - single level
66
+ * @return void
67
+ */
68
+ private function _initializeFromArray($attributes)
69
+ {
70
+ $this->_attributes = $attributes;
71
+ }
72
+
73
+ }
74
+ class_alias('Braintree\Instance', 'Braintree_Instance');
lib/Jmango360/Braintree/lib/Braintree/IsNode.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class IsNode
5
+ {
6
+ public function __construct($name)
7
+ {
8
+ $this->name = $name;
9
+ $this->searchTerms = [];
10
+ }
11
+
12
+ public function is($value)
13
+ {
14
+ $this->searchTerms['is'] = strval($value);
15
+
16
+ return $this;
17
+ }
18
+
19
+ public function toParam()
20
+ {
21
+ return $this->searchTerms;
22
+ }
23
+ }
24
+ class_alias('Braintree\IsNode', 'Braintree_IsNode');
lib/Jmango360/Braintree/lib/Braintree/KeyValueNode.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class KeyValueNode
5
+ {
6
+ public function __construct($name)
7
+ {
8
+ $this->name = $name;
9
+ $this->searchTerm = True;
10
+ }
11
+
12
+ public function is($value)
13
+ {
14
+ $this->searchTerm = $value;
15
+ return $this;
16
+ }
17
+
18
+ public function toParam()
19
+ {
20
+ return $this->searchTerm;
21
+ }
22
+ }
23
+ class_alias('Braintree\KeyValueNode', 'Braintree_KeyValueNode');
lib/Jmango360/Braintree/lib/Braintree/MasterpassCard.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree MasterpassCard module
6
+ * Creates and manages Braintree MasterpassCards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * For more detailed information on CreditCard verifications, see {@link http://www.braintreepayments.com/gateway/credit-card-verification-api http://www.braintreepaymentsolutions.com/gateway/credit-card-verification-api}
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $billingAddress
16
+ * @property-read string $bin
17
+ * @property-read string $cardType
18
+ * @property-read string $cardholderName
19
+ * @property-read string $commercial
20
+ * @property-read string $countryOfIssuance
21
+ * @property-read string $createdAt
22
+ * @property-read string $customerId
23
+ * @property-read string $customerLocation
24
+ * @property-read string $debit
25
+ * @property-read string $default
26
+ * @property-read string $durbinRegulated
27
+ * @property-read string $expirationDate
28
+ * @property-read string $expirationMonth
29
+ * @property-read string $expirationYear
30
+ * @property-read string $expired
31
+ * @property-read string $healthcare
32
+ * @property-read string $imageUrl
33
+ * @property-read string $issuingBank
34
+ * @property-read string $last4
35
+ * @property-read string $maskedNumber
36
+ * @property-read string $payroll
37
+ * @property-read string $prepaid
38
+ * @property-read string $productId
39
+ * @property-read string $subscriptions
40
+ * @property-read string $token
41
+ * @property-read string $uniqueNumberIdentifier
42
+ * @property-read string $updatedAt
43
+ */
44
+ class MasterpassCard extends Base
45
+ {
46
+ /* instance methods */
47
+ /**
48
+ * returns false if default is null or false
49
+ *
50
+ * @return boolean
51
+ */
52
+ public function isDefault()
53
+ {
54
+ return $this->default;
55
+ }
56
+
57
+ /**
58
+ * checks whether the card is expired based on the current date
59
+ *
60
+ * @return boolean
61
+ */
62
+ public function isExpired()
63
+ {
64
+ return $this->expired;
65
+ }
66
+
67
+ /**
68
+ * sets instance properties from an array of values
69
+ *
70
+ * @access protected
71
+ * @param array $creditCardAttribs array of creditcard data
72
+ * @return void
73
+ */
74
+ protected function _initialize($creditCardAttribs)
75
+ {
76
+ // set the attributes
77
+ $this->_attributes = $creditCardAttribs;
78
+
79
+ // map each address into its own object
80
+ $billingAddress = isset($creditCardAttribs['billingAddress']) ?
81
+ Address::factory($creditCardAttribs['billingAddress']) :
82
+ null;
83
+
84
+ $subscriptionArray = [];
85
+ if (isset($creditCardAttribs['subscriptions'])) {
86
+ foreach ($creditCardAttribs['subscriptions'] AS $subscription) {
87
+ $subscriptionArray[] = Subscription::factory($subscription);
88
+ }
89
+ }
90
+
91
+ $this->_set('subscriptions', $subscriptionArray);
92
+ $this->_set('billingAddress', $billingAddress);
93
+ $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
94
+ $this->_set('maskedNumber', $this->bin . '******' . $this->last4);
95
+ }
96
+
97
+ /**
98
+ * returns false if comparing object is not a CreditCard,
99
+ * or is a CreditCard with a different id
100
+ *
101
+ * @param object $otherCreditCard customer to compare against
102
+ * @return boolean
103
+ */
104
+ public function isEqual($otherMasterpassCard)
105
+ {
106
+ return !($otherMasterpassCard instanceof self) ? false : $this->token === $otherMasterpassCard->token;
107
+ }
108
+
109
+ /**
110
+ * create a printable representation of the object as:
111
+ * ClassName[property=value, property=value]
112
+ * @return string
113
+ */
114
+ public function __toString()
115
+ {
116
+ return __CLASS__ . '[' .
117
+ Util::attributesToString($this->_attributes) .']';
118
+ }
119
+
120
+ /**
121
+ * factory method: returns an instance of CreditCard
122
+ * to the requesting method, with populated properties
123
+ *
124
+ * @ignore
125
+ * @return MasterpassCard
126
+ */
127
+ public static function factory($attributes)
128
+ {
129
+ $defaultAttributes = [
130
+ 'bin' => '',
131
+ 'expirationMonth' => '',
132
+ 'expirationYear' => '',
133
+ 'last4' => '',
134
+ ];
135
+
136
+ $instance = new self();
137
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
138
+ return $instance;
139
+ }
140
+ }
141
+ class_alias('Braintree\MasterpassCard', 'Braintree_MasterpassCard');
lib/Jmango360/Braintree/lib/Braintree/Merchant.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Merchant extends Base
5
+ {
6
+ protected function _initialize($attribs)
7
+ {
8
+ $this->_attributes = $attribs;
9
+
10
+ $merchantAccountArray = [];
11
+ if (isset($attribs['merchantAccounts'])) {
12
+ foreach ($attribs['merchantAccounts'] AS $merchantAccount) {
13
+ $merchantAccountArray[] = MerchantAccount::factory($merchantAccount);
14
+ }
15
+ }
16
+ $this->_set('merchantAccounts', $merchantAccountArray);
17
+ }
18
+
19
+ public static function factory($attributes)
20
+ {
21
+ $instance = new self();
22
+ $instance->_initialize($attributes);
23
+ return $instance;
24
+ }
25
+
26
+ /**
27
+ * returns a string representation of the merchant
28
+ * @return string
29
+ */
30
+ public function __toString()
31
+ {
32
+ return __CLASS__ . '[' .
33
+ Util::attributesToString($this->_attributes) .']';
34
+ }
35
+ }
36
+ class_alias('Braintree\Merchant', 'Braintree_Merchant');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccount.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class MerchantAccount extends Base
5
+ {
6
+ const STATUS_ACTIVE = 'active';
7
+ const STATUS_PENDING = 'pending';
8
+ const STATUS_SUSPENDED = 'suspended';
9
+
10
+ const FUNDING_DESTINATION_BANK = 'bank';
11
+ const FUNDING_DESTINATION_EMAIL = 'email';
12
+ const FUNDING_DESTINATION_MOBILE_PHONE = 'mobile_phone';
13
+
14
+ public static function factory($attributes)
15
+ {
16
+ $instance = new self();
17
+ $instance->_initialize($attributes);
18
+ return $instance;
19
+ }
20
+
21
+ protected function _initialize($merchantAccountAttribs)
22
+ {
23
+ $this->_attributes = $merchantAccountAttribs;
24
+
25
+ if (isset($merchantAccountAttribs['individual'])) {
26
+ $individual = $merchantAccountAttribs['individual'];
27
+ $this->_set('individualDetails', MerchantAccount\IndividualDetails::Factory($individual));
28
+ }
29
+
30
+ if (isset($merchantAccountAttribs['business'])) {
31
+ $business = $merchantAccountAttribs['business'];
32
+ $this->_set('businessDetails', MerchantAccount\BusinessDetails::Factory($business));
33
+ }
34
+
35
+ if (isset($merchantAccountAttribs['funding'])) {
36
+ $funding = $merchantAccountAttribs['funding'];
37
+ $this->_set('fundingDetails', new MerchantAccount\FundingDetails($funding));
38
+ }
39
+
40
+ if (isset($merchantAccountAttribs['masterMerchantAccount'])) {
41
+ $masterMerchantAccount = $merchantAccountAttribs['masterMerchantAccount'];
42
+ $this->_set('masterMerchantAccount', self::Factory($masterMerchantAccount));
43
+ }
44
+ }
45
+
46
+
47
+ // static methods redirecting to gateway
48
+
49
+ public static function create($attribs)
50
+ {
51
+ return Configuration::gateway()->merchantAccount()->create($attribs);
52
+ }
53
+
54
+ public static function find($merchant_account_id)
55
+ {
56
+ return Configuration::gateway()->merchantAccount()->find($merchant_account_id);
57
+ }
58
+
59
+ public static function update($merchant_account_id, $attributes)
60
+ {
61
+ return Configuration::gateway()->merchantAccount()->update($merchant_account_id, $attributes);
62
+ }
63
+ }
64
+ class_alias('Braintree\MerchantAccount', 'Braintree_MerchantAccount');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/AddressDetails.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\MerchantAccount;
3
+
4
+ use Braintree\Instance;
5
+
6
+ class AddressDetails extends Instance
7
+ {
8
+ protected $_attributes = [];
9
+ }
10
+ class_alias('Braintree\MerchantAccount\AddressDetails', 'Braintree_MerchantAccount_AddressDetails');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/BusinessDetails.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\MerchantAccount;
3
+
4
+ use Braintree\Base;
5
+
6
+ class BusinessDetails extends Base
7
+ {
8
+ protected function _initialize($businessAttribs)
9
+ {
10
+ $this->_attributes = $businessAttribs;
11
+ if (isset($businessAttribs['address'])) {
12
+ $this->_set('addressDetails', new AddressDetails($businessAttribs['address']));
13
+ }
14
+ }
15
+
16
+ public static function factory($attributes)
17
+ {
18
+ $instance = new self();
19
+ $instance->_initialize($attributes);
20
+ return $instance;
21
+ }
22
+ }
23
+ class_alias('Braintree\MerchantAccount\BusinessDetails', 'Braintree_MerchantAccount_BusinessDetails');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/FundingDetails.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\MerchantAccount;
3
+
4
+ use Braintree\Instance;
5
+
6
+ class FundingDetails extends Instance
7
+ {
8
+ protected $_attributes = [];
9
+ }
10
+ class_alias('Braintree\MerchantAccount\FundingDetails', 'Braintree_MerchantAccount_FundingDetails');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccount/IndividualDetails.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\MerchantAccount;
3
+
4
+ use Braintree\Base;
5
+
6
+ class IndividualDetails extends Base
7
+ {
8
+ protected function _initialize($individualAttribs)
9
+ {
10
+ $this->_attributes = $individualAttribs;
11
+ if (isset($individualAttribs['address'])) {
12
+ $this->_set('addressDetails', new AddressDetails($individualAttribs['address']));
13
+ }
14
+ }
15
+
16
+ public static function factory($attributes)
17
+ {
18
+ $instance = new self();
19
+ $instance->_initialize($attributes);
20
+ return $instance;
21
+ }
22
+ }
23
+ class_alias('Braintree\MerchantAccount\IndividualDetails', 'Braintree_MerchantAccount_IndividualDetails');
lib/Jmango360/Braintree/lib/Braintree/MerchantAccountGateway.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class MerchantAccountGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_config->assertHasAccessTokenOrKeys();
15
+ $this->_http = new Http($gateway->config);
16
+ }
17
+
18
+ public function create($attribs)
19
+ {
20
+ Util::verifyKeys(self::detectSignature($attribs), $attribs);
21
+ return $this->_doCreate('/merchant_accounts/create_via_api', ['merchant_account' => $attribs]);
22
+ }
23
+
24
+ public function find($merchant_account_id)
25
+ {
26
+ try {
27
+ $path = $this->_config->merchantPath() . '/merchant_accounts/' . $merchant_account_id;
28
+ $response = $this->_http->get($path);
29
+ return MerchantAccount::factory($response['merchantAccount']);
30
+ } catch (Exception\NotFound $e) {
31
+ throw new Exception\NotFound('merchant account with id ' . $merchant_account_id . ' not found');
32
+ }
33
+ }
34
+
35
+ public function update($merchant_account_id, $attributes)
36
+ {
37
+ Util::verifyKeys(self::updateSignature(), $attributes);
38
+ return $this->_doUpdate('/merchant_accounts/' . $merchant_account_id . '/update_via_api', ['merchant_account' => $attributes]);
39
+ }
40
+
41
+ public static function detectSignature($attribs)
42
+ {
43
+ if (isset($attribs['applicantDetails'])) {
44
+ trigger_error("DEPRECATED: Passing applicantDetails to create is deprecated. Please use individual, business, and funding", E_USER_NOTICE);
45
+ return self::createDeprecatedSignature();
46
+ } else {
47
+ return self::createSignature();
48
+ }
49
+ }
50
+
51
+ public static function updateSignature()
52
+ {
53
+ $signature = self::createSignature();
54
+ unset($signature['tosAccepted']);
55
+ return $signature;
56
+ }
57
+
58
+ public function createForCurrency($attribs)
59
+ {
60
+ $response = $this->_http->post($this->_config->merchantPath() . '/merchant_accounts/create_for_currency', ['merchant_account' => $attribs]);
61
+ return $this->_verifyGatewayResponse($response);
62
+ }
63
+
64
+ public function all()
65
+ {
66
+ $pager = [
67
+ 'object' => $this,
68
+ 'method' => 'fetchMerchantAccounts',
69
+ ];
70
+ return new PaginatedCollection($pager);
71
+ }
72
+
73
+ public function fetchMerchantAccounts($page)
74
+ {
75
+ $response = $this->_http->get($this->_config->merchantPath() . '/merchant_accounts?page=' . $page);
76
+ $body = $response['merchantAccounts'];
77
+ $merchantAccounts = Util::extractattributeasarray($body, 'merchantAccount');
78
+ $totalItems = $body['totalItems'][0];
79
+ $pageSize = $body['pageSize'][0];
80
+ return new PaginatedResult($totalItems, $pageSize, $merchantAccounts);
81
+ }
82
+
83
+ public static function createSignature()
84
+ {
85
+ $addressSignature = ['streetAddress', 'postalCode', 'locality', 'region'];
86
+ $individualSignature = [
87
+ 'firstName',
88
+ 'lastName',
89
+ 'email',
90
+ 'phone',
91
+ 'dateOfBirth',
92
+ 'ssn',
93
+ ['address' => $addressSignature]
94
+ ];
95
+
96
+ $businessSignature = [
97
+ 'dbaName',
98
+ 'legalName',
99
+ 'taxId',
100
+ ['address' => $addressSignature]
101
+ ];
102
+
103
+ $fundingSignature = [
104
+ 'routingNumber',
105
+ 'accountNumber',
106
+ 'destination',
107
+ 'email',
108
+ 'mobilePhone',
109
+ 'descriptor',
110
+ ];
111
+
112
+ return [
113
+ 'id',
114
+ 'tosAccepted',
115
+ 'masterMerchantAccountId',
116
+ ['individual' => $individualSignature],
117
+ ['funding' => $fundingSignature],
118
+ ['business' => $businessSignature]
119
+ ];
120
+ }
121
+
122
+ public static function createDeprecatedSignature()
123
+ {
124
+ $applicantDetailsAddressSignature = ['streetAddress', 'postalCode', 'locality', 'region'];
125
+ $applicantDetailsSignature = [
126
+ 'companyName',
127
+ 'firstName',
128
+ 'lastName',
129
+ 'email',
130
+ 'phone',
131
+ 'dateOfBirth',
132
+ 'ssn',
133
+ 'taxId',
134
+ 'routingNumber',
135
+ 'accountNumber',
136
+ ['address' => $applicantDetailsAddressSignature]
137
+ ];
138
+
139
+ return [
140
+ ['applicantDetails' => $applicantDetailsSignature],
141
+ 'id',
142
+ 'tosAccepted',
143
+ 'masterMerchantAccountId'
144
+ ];
145
+ }
146
+
147
+ public function _doCreate($subPath, $params)
148
+ {
149
+ $fullPath = $this->_config->merchantPath() . $subPath;
150
+ $response = $this->_http->post($fullPath, $params);
151
+
152
+ return $this->_verifyGatewayResponse($response);
153
+ }
154
+
155
+ private function _doUpdate($subPath, $params)
156
+ {
157
+ $fullPath = $this->_config->merchantPath() . $subPath;
158
+ $response = $this->_http->put($fullPath, $params);
159
+
160
+ return $this->_verifyGatewayResponse($response);
161
+ }
162
+
163
+ private function _verifyGatewayResponse($response)
164
+ {
165
+ if (isset($response['response'])) {
166
+ $response = $response['response'];
167
+ }
168
+ if (isset($response['merchantAccount'])) {
169
+ // return a populated instance of merchantAccount
170
+ return new Result\Successful(
171
+ MerchantAccount::factory($response['merchantAccount'])
172
+ );
173
+ } else if (isset($response['apiErrorResponse'])) {
174
+ return new Result\Error($response['apiErrorResponse']);
175
+ } else {
176
+ throw new Exception\Unexpected(
177
+ "Expected merchant account or apiErrorResponse"
178
+ );
179
+ }
180
+ }
181
+ }
182
+ class_alias('Braintree\MerchantAccountGateway', 'Braintree_MerchantAccountGateway');
lib/Jmango360/Braintree/lib/Braintree/MerchantGateway.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class MerchantGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_config->assertHasClientCredentials();
15
+ $this->_http = new Http($gateway->config);
16
+ $this->_http->useClientCredentials();
17
+ }
18
+
19
+ public function create($attribs)
20
+ {
21
+ $response = $this->_http->post('/merchants/create_via_api', ['merchant' => $attribs]);
22
+ return $this->_verifyGatewayResponse($response);
23
+ }
24
+
25
+ private function _verifyGatewayResponse($response)
26
+ {
27
+ if (isset($response['response']['merchant'])) {
28
+ // return a populated instance of merchant
29
+ return new Result\Successful([
30
+ Merchant::factory($response['response']['merchant']),
31
+ OAuthCredentials::factory($response['response']['credentials']),
32
+ ]);
33
+ } else if (isset($response['apiErrorResponse'])) {
34
+ return new Result\Error($response['apiErrorResponse']);
35
+ } else {
36
+ throw new Exception\Unexpected(
37
+ "Expected merchant or apiErrorResponse"
38
+ );
39
+ }
40
+ }
41
+ }
42
+ class_alias('Braintree\MerchantGateway', 'Braintree_MerchantGateway');
lib/Jmango360/Braintree/lib/Braintree/Modification.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Modification extends Base
5
+ {
6
+ protected function _initialize($attributes)
7
+ {
8
+ $this->_attributes = $attributes;
9
+ }
10
+
11
+ public static function factory($attributes)
12
+ {
13
+ $instance = new self();
14
+ $instance->_initialize($attributes);
15
+ return $instance;
16
+ }
17
+
18
+ public function __toString() {
19
+ return get_called_class() . '[' . Util::attributesToString($this->_attributes) . ']';
20
+ }
21
+ }
22
+ class_alias('Braintree\Modification', 'Braintree_Modification');
lib/Jmango360/Braintree/lib/Braintree/MultipleValueNode.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ class MultipleValueNode
7
+ {
8
+ public function __construct($name, $allowedValues = [])
9
+ {
10
+ $this->name = $name;
11
+ $this->items = [];
12
+ $this->allowedValues = $allowedValues;
13
+ }
14
+
15
+ public function in($values)
16
+ {
17
+ $bad_values = array_diff($values, $this->allowedValues);
18
+ if (count($this->allowedValues) > 0 && count($bad_values) > 0) {
19
+ $message = 'Invalid argument(s) for ' . $this->name . ':';
20
+ foreach ($bad_values AS $bad_value) {
21
+ $message .= ' ' . $bad_value;
22
+ }
23
+
24
+ throw new InvalidArgumentException($message);
25
+ }
26
+
27
+ $this->items = $values;
28
+ return $this;
29
+ }
30
+
31
+ public function is($value)
32
+ {
33
+ return $this->in([$value]);
34
+ }
35
+
36
+ public function toParam()
37
+ {
38
+ return $this->items;
39
+ }
40
+ }
41
+ class_alias('Braintree\MultipleValueNode', 'Braintree_MultipleValueNode');
lib/Jmango360/Braintree/lib/Braintree/MultipleValueOrTextNode.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class MultipleValueOrTextNode extends MultipleValueNode
5
+ {
6
+ public function __construct($name)
7
+ {
8
+ parent::__construct($name);
9
+ $this->textNode = new TextNode($name);
10
+ }
11
+
12
+ public function contains($value)
13
+ {
14
+ $this->textNode->contains($value);
15
+ return $this;
16
+ }
17
+
18
+ public function endsWith($value)
19
+ {
20
+ $this->textNode->endsWith($value);
21
+ return $this;
22
+ }
23
+
24
+ public function is($value)
25
+ {
26
+ $this->textNode->is($value);
27
+ return $this;
28
+ }
29
+
30
+ public function isNot($value)
31
+ {
32
+ $this->textNode->isNot($value);
33
+ return $this;
34
+ }
35
+
36
+ public function startsWith($value)
37
+ {
38
+ $this->textNode->startsWith($value);
39
+ return $this;
40
+ }
41
+
42
+ public function toParam()
43
+ {
44
+ return array_merge(parent::toParam(), $this->textNode->toParam());
45
+ }
46
+ }
47
+ class_alias('Braintree\MultipleValueOrTextNode', 'Braintree_MultipleValueOrTextNode');
lib/Jmango360/Braintree/lib/Braintree/OAuthCredentials.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree OAuthCredentials module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+ class OAuthCredentials extends Base
11
+ {
12
+ protected function _initialize($attribs)
13
+ {
14
+ $this->_attributes = $attribs;
15
+ }
16
+
17
+ public static function factory($attributes)
18
+ {
19
+ $instance = new self();
20
+ $instance->_initialize($attributes);
21
+ return $instance;
22
+ }
23
+
24
+ /**
25
+ * returns a string representation of the access token
26
+ * @return string
27
+ */
28
+ public function __toString()
29
+ {
30
+ return __CLASS__ . '[' .
31
+ Util::attributesToString($this->_attributes) .']';
32
+ }
33
+ }
34
+ class_alias('Braintree\OAuthCredentials', 'Braintree_OAuthCredentials');
lib/Jmango360/Braintree/lib/Braintree/OAuthGateway.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree OAuthGateway module
6
+ * PHP Version 5
7
+ * Creates and manages Braintree Addresses
8
+ *
9
+ * @package Braintree
10
+ */
11
+ class OAuthGateway
12
+ {
13
+ private $_gateway;
14
+ private $_config;
15
+ private $_http;
16
+
17
+ public function __construct($gateway)
18
+ {
19
+ $this->_gateway = $gateway;
20
+ $this->_config = $gateway->config;
21
+ $this->_http = new Http($gateway->config);
22
+ $this->_http->useClientCredentials();
23
+
24
+ $this->_config->assertHasClientCredentials();
25
+ }
26
+
27
+ public function createTokenFromCode($params)
28
+ {
29
+ $params['grantType'] = "authorization_code";
30
+ return $this->_createToken($params);
31
+ }
32
+
33
+ public function createTokenFromRefreshToken($params)
34
+ {
35
+ $params['grantType'] = "refresh_token";
36
+ return $this->_createToken($params);
37
+ }
38
+
39
+ public function revokeAccessToken($accessToken)
40
+ {
41
+ $params = ['token' => $accessToken];
42
+ $response = $this->_http->post('/oauth/revoke_access_token', $params);
43
+ return $this->_verifyGatewayResponse($response);
44
+ }
45
+
46
+ private function _createToken($params)
47
+ {
48
+ $params = ['credentials' => $params];
49
+ $response = $this->_http->post('/oauth/access_tokens', $params);
50
+ return $this->_verifyGatewayResponse($response);
51
+ }
52
+
53
+ private function _verifyGatewayResponse($response)
54
+ {
55
+ if (isset($response['credentials'])) {
56
+ $result = new Result\Successful(
57
+ OAuthCredentials::factory($response['credentials'])
58
+ );
59
+ return $this->_mapSuccess($result);
60
+ } else if (isset($response['result'])) {
61
+ $result = new Result\Successful(
62
+ OAuthResult::factory($response['result'])
63
+ );
64
+ return $this->_mapAccessTokenRevokeSuccess($result);
65
+ } else if (isset($response['apiErrorResponse'])) {
66
+ $result = new Result\Error($response['apiErrorResponse']);
67
+ return $this->_mapError($result);
68
+ } else {
69
+ throw new Exception\Unexpected(
70
+ "Expected credentials or apiErrorResponse"
71
+ );
72
+ }
73
+ }
74
+
75
+ public function _mapError($result)
76
+ {
77
+ $error = $result->errors->deepAll()[0];
78
+
79
+ if ($error->code == Error\Codes::OAUTH_INVALID_GRANT) {
80
+ $result->error = 'invalid_grant';
81
+ } else if ($error->code == Error\Codes::OAUTH_INVALID_CREDENTIALS) {
82
+ $result->error = 'invalid_credentials';
83
+ } else if ($error->code == Error\Codes::OAUTH_INVALID_SCOPE) {
84
+ $result->error = 'invalid_scope';
85
+ }
86
+ $result->errorDescription = explode(': ', $error->message)[1];
87
+ return $result;
88
+ }
89
+
90
+ public function _mapAccessTokenRevokeSuccess($result)
91
+ {
92
+ $result->revocationResult = $result->success;
93
+ return $result;
94
+ }
95
+
96
+ public function _mapSuccess($result)
97
+ {
98
+ $credentials = $result->credentials;
99
+ $result->accessToken = $credentials->accessToken;
100
+ $result->refreshToken = $credentials->refreshToken;
101
+ $result->tokenType = $credentials->tokenType;
102
+ $result->expiresAt = $credentials->expiresAt;
103
+ return $result;
104
+ }
105
+
106
+ public function connectUrl($params = [])
107
+ {
108
+ $query = Util::camelCaseToDelimiterArray($params, '_');
109
+ $query['client_id'] = $this->_config->getClientId();
110
+ $queryString = preg_replace('/\%5B\d+\%5D/', '%5B%5D', http_build_query($query));
111
+ $url = $this->_config->baseUrl() . '/oauth/connect?' . $queryString;
112
+
113
+ return $url . '&signature=' . $this->computeSignature($url) . '&algorithm=SHA256';
114
+ }
115
+
116
+ public function computeSignature($url)
117
+ {
118
+ $key = hash('sha256', $this->_config->getClientSecret(), true);
119
+ return hash_hmac('sha256', $url, $key);
120
+ }
121
+ }
122
+ class_alias('Braintree\OAuthGateway', 'Braintree_OAuthGateway');
lib/Jmango360/Braintree/lib/Braintree/OAuthResult.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree OAuthCredentials module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+ class OAuthResult extends Base
11
+ {
12
+ protected function _initialize($attribs)
13
+ {
14
+ $this->_attributes = $attribs;
15
+ }
16
+
17
+ public static function factory($attributes)
18
+ {
19
+ $instance = new self();
20
+ $instance->_initialize($attributes);
21
+ return $instance;
22
+ }
23
+
24
+ /**
25
+ * returns a string representation of the result
26
+ * @return string
27
+ */
28
+ public function __toString()
29
+ {
30
+ return __CLASS__ . '[' .
31
+ Util::attributesToString($this->_attributes) .']';
32
+ }
33
+ }
34
+ class_alias('Braintree\OAuthResult', 'Braintree_OAuthResult');
lib/Jmango360/Braintree/lib/Braintree/PaginatedCollection.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use Iterator;
5
+
6
+ /**
7
+ * Braintree PaginatedCollection
8
+ * PaginatedCollection is a container object for paginated data
9
+ *
10
+ * retrieves and pages through large collections of results
11
+ *
12
+ * example:
13
+ * <code>
14
+ * $result = MerchantAccount::all();
15
+ *
16
+ * foreach($result as $merchantAccount) {
17
+ * print_r($merchantAccount->status);
18
+ * }
19
+ * </code>
20
+ *
21
+ * @package Braintree
22
+ * @subpackage Utility
23
+ */
24
+ class PaginatedCollection implements Iterator
25
+ {
26
+ private $_pager;
27
+ private $_pageSize;
28
+ private $_currentPage;
29
+ private $_index;
30
+ private $_totalItems;
31
+ private $_items;
32
+
33
+ /**
34
+ * set up the paginated collection
35
+ *
36
+ * expects an array of an object and method to call on it
37
+ *
38
+ * @param array $pager
39
+ */
40
+ public function __construct($pager)
41
+ {
42
+ $this->_pager = $pager;
43
+ $this->_pageSize = 0;
44
+ $this->_currentPage = 0;
45
+ $this->_totalItems = 0;
46
+ $this->_index = 0;
47
+ }
48
+
49
+ /**
50
+ * returns the current item when iterating with foreach
51
+ */
52
+ public function current()
53
+ {
54
+ return $this->_items[($this->_index % $this->_pageSize)];
55
+ }
56
+
57
+ public function key()
58
+ {
59
+ return null;
60
+ }
61
+
62
+ /**
63
+ * advances to the next item in the collection when iterating with foreach
64
+ */
65
+ public function next()
66
+ {
67
+ ++$this->_index;
68
+ }
69
+
70
+ /**
71
+ * rewinds the collection to the first item when iterating with foreach
72
+ */
73
+ public function rewind()
74
+ {
75
+ $this->_index = 0;
76
+ $this->_currentPage = 0;
77
+ $this->_pageSize = 0;
78
+ $this->_totalItems = 0;
79
+ $this->_items = [];
80
+ }
81
+
82
+ /**
83
+ * returns whether the current item is valid when iterating with foreach
84
+ */
85
+ public function valid()
86
+ {
87
+ if ($this->_currentPage == 0 || $this->_index % $this->_pageSize == 0 && $this->_index < $this->_totalItems)
88
+ {
89
+ $this->_getNextPage();
90
+ }
91
+
92
+ return $this->_index < $this->_totalItems;
93
+ }
94
+
95
+ private function _getNextPage()
96
+ {
97
+ $this->_currentPage++;
98
+ $object = $this->_pager['object'];
99
+ $method = $this->_pager['method'];
100
+ $result = call_user_func(
101
+ [$object, $method],
102
+ $this->_currentPage
103
+ );
104
+
105
+ $this->_totalItems= $result->getTotalItems();
106
+ $this->_pageSize = $result->getPageSize();
107
+ $this->_items = $result->getCurrentPage();
108
+ }
109
+ }
110
+ class_alias('Braintree\PaginatedCollection', 'Braintree_PaginatedCollection');
lib/Jmango360/Braintree/lib/Braintree/PaginatedResult.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class PaginatedResult
5
+ {
6
+ private $_totalItems;
7
+ private $_pageSize;
8
+ private $_currentPage;
9
+
10
+ public function __construct($totalItems, $pageSize, $currentPage)
11
+ {
12
+ $this->_totalItems = $totalItems;
13
+ $this->_pageSize = $pageSize;
14
+ $this->_currentPage = $currentPage;
15
+ }
16
+
17
+ public function getTotalItems()
18
+ {
19
+ return $this->_totalItems;
20
+ }
21
+
22
+ public function getPageSize()
23
+ {
24
+ return $this->_pageSize;
25
+ }
26
+
27
+ public function getCurrentPage()
28
+ {
29
+ return $this->_currentPage;
30
+ }
31
+ }
32
+ class_alias('Braintree\PaginatedResult', 'Braintree_PaginatedResult');
lib/Jmango360/Braintree/lib/Braintree/PartialMatchNode.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class PartialMatchNode extends EqualityNode
5
+ {
6
+ public function startsWith($value)
7
+ {
8
+ $this->searchTerms["starts_with"] = strval($value);
9
+ return $this;
10
+ }
11
+
12
+ public function endsWith($value)
13
+ {
14
+ $this->searchTerms["ends_with"] = strval($value);
15
+ return $this;
16
+ }
17
+ }
18
+ class_alias('Braintree\PartialMatchNode', 'Braintree_PartialMatchNode');
lib/Jmango360/Braintree/lib/Braintree/PartnerMerchant.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Partner Merchant information that is generated when a partner is connected
6
+ * to or disconnected from a user.
7
+ *
8
+ * Creates an instance of PartnerMerchants
9
+ *
10
+ * @package Braintree
11
+ *
12
+ * @property-read string $merchantPublicId
13
+ * @property-read string $publicKey
14
+ * @property-read string $privateKey
15
+ * @property-read string $clientSideEncryptionKey
16
+ * @property-read string $partnerMerchantId
17
+ */
18
+ class PartnerMerchant extends Base
19
+ {
20
+ protected $_attributes = [];
21
+
22
+ /**
23
+ * @ignore
24
+ */
25
+ public static function factory($attributes)
26
+ {
27
+ $instance = new self();
28
+ $instance->_initialize($attributes);
29
+
30
+ return $instance;
31
+ }
32
+
33
+ /**
34
+ * @ignore
35
+ */
36
+ protected function _initialize($attributes)
37
+ {
38
+ $this->_attributes = $attributes;
39
+ }
40
+ }
41
+ class_alias('Braintree\PartnerMerchant', 'Braintree_PartnerMerchant');
lib/Jmango360/Braintree/lib/Braintree/PayPalAccount.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree PayPalAccount module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Manages Braintree PayPalAccounts
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ *
20
+ * @property-read string $customerId
21
+ * @property-read string $email
22
+ * @property-read string $token
23
+ * @property-read string $imageUrl
24
+ */
25
+ class PayPalAccount extends Base
26
+ {
27
+ /**
28
+ * factory method: returns an instance of PayPalAccount
29
+ * to the requesting method, with populated properties
30
+ *
31
+ * @ignore
32
+ * @return PayPalAccount
33
+ */
34
+ public static function factory($attributes)
35
+ {
36
+ $instance = new self();
37
+ $instance->_initialize($attributes);
38
+ return $instance;
39
+ }
40
+
41
+ /* instance methods */
42
+
43
+ /**
44
+ * returns false if default is null or false
45
+ *
46
+ * @return boolean
47
+ */
48
+ public function isDefault()
49
+ {
50
+ return $this->default;
51
+ }
52
+
53
+ /**
54
+ * sets instance properties from an array of values
55
+ *
56
+ * @access protected
57
+ * @param array $paypalAccountAttribs array of paypalAccount data
58
+ * @return void
59
+ */
60
+ protected function _initialize($paypalAccountAttribs)
61
+ {
62
+ // set the attributes
63
+ $this->_attributes = $paypalAccountAttribs;
64
+
65
+ $subscriptionArray = [];
66
+ if (isset($paypalAccountAttribs['subscriptions'])) {
67
+ foreach ($paypalAccountAttribs['subscriptions'] AS $subscription) {
68
+ $subscriptionArray[] = Subscription::factory($subscription);
69
+ }
70
+ }
71
+
72
+ $this->_set('subscriptions', $subscriptionArray);
73
+ }
74
+
75
+ /**
76
+ * create a printable representation of the object as:
77
+ * ClassName[property=value, property=value]
78
+ * @return string
79
+ */
80
+ public function __toString()
81
+ {
82
+ return __CLASS__ . '[' .
83
+ Util::attributesToString($this->_attributes) . ']';
84
+ }
85
+
86
+
87
+ // static methods redirecting to gateway
88
+
89
+ public static function find($token)
90
+ {
91
+ return Configuration::gateway()->payPalAccount()->find($token);
92
+ }
93
+
94
+ public static function update($token, $attributes)
95
+ {
96
+ return Configuration::gateway()->payPalAccount()->update($token, $attributes);
97
+ }
98
+
99
+ public static function delete($token)
100
+ {
101
+ return Configuration::gateway()->payPalAccount()->delete($token);
102
+ }
103
+
104
+ public static function sale($token, $transactionAttribs)
105
+ {
106
+ return Configuration::gateway()->payPalAccount()->sale($token, $transactionAttribs);
107
+ }
108
+ }
109
+ class_alias('Braintree\PayPalAccount', 'Braintree_PayPalAccount');
lib/Jmango360/Braintree/lib/Braintree/PayPalAccountGateway.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree PayPalAccountGateway module
8
+ *
9
+ * @package Braintree
10
+ * @category Resources
11
+ */
12
+
13
+ /**
14
+ * Manages Braintree PayPalAccounts
15
+ *
16
+ * <b>== More information ==</b>
17
+ *
18
+ *
19
+ * @package Braintree
20
+ * @category Resources
21
+ */
22
+ class PayPalAccountGateway
23
+ {
24
+ private $_gateway;
25
+ private $_config;
26
+ private $_http;
27
+
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+
37
+ /**
38
+ * find a paypalAccount by token
39
+ *
40
+ * @access public
41
+ * @param string $token paypal accountunique id
42
+ * @return PayPalAccount
43
+ * @throws Exception\NotFound
44
+ */
45
+ public function find($token)
46
+ {
47
+ $this->_validateId($token);
48
+ try {
49
+ $path = $this->_config->merchantPath() . '/payment_methods/paypal_account/' . $token;
50
+ $response = $this->_http->get($path);
51
+ return PayPalAccount::factory($response['paypalAccount']);
52
+ } catch (Exception\NotFound $e) {
53
+ throw new Exception\NotFound(
54
+ 'paypal account with token ' . $token . ' not found'
55
+ );
56
+ }
57
+
58
+ }
59
+
60
+ /**
61
+ * updates the paypalAccount record
62
+ *
63
+ * if calling this method in context, $token
64
+ * is the 2nd attribute. $token is not sent in object context.
65
+ *
66
+ * @access public
67
+ * @param array $attributes
68
+ * @param string $token (optional)
69
+ * @return Result\Successful or Result\Error
70
+ */
71
+ public function update($token, $attributes)
72
+ {
73
+ Util::verifyKeys(self::updateSignature(), $attributes);
74
+ $this->_validateId($token);
75
+ return $this->_doUpdate('put', '/payment_methods/paypal_account/' . $token, ['paypalAccount' => $attributes]);
76
+ }
77
+
78
+ public function delete($token)
79
+ {
80
+ $this->_validateId($token);
81
+ $path = $this->_config->merchantPath() . '/payment_methods/paypal_account/' . $token;
82
+ $this->_http->delete($path);
83
+ return new Result\Successful();
84
+ }
85
+
86
+ /**
87
+ * create a new sale for the current PayPal account
88
+ *
89
+ * @param string $token
90
+ * @param array $transactionAttribs
91
+ * @return Result\Successful|Result\Error
92
+ * @see Transaction::sale()
93
+ */
94
+ public function sale($token, $transactionAttribs)
95
+ {
96
+ $this->_validateId($token);
97
+ return Transaction::sale(
98
+ array_merge(
99
+ $transactionAttribs,
100
+ ['paymentMethodToken' => $token]
101
+ )
102
+ );
103
+ }
104
+
105
+ public static function updateSignature()
106
+ {
107
+ return [
108
+ 'token',
109
+ ['options' => ['makeDefault']]
110
+ ];
111
+ }
112
+
113
+ /**
114
+ * sends the update request to the gateway
115
+ *
116
+ * @ignore
117
+ * @param string $subPath
118
+ * @param array $params
119
+ * @return mixed
120
+ */
121
+ private function _doUpdate($httpVerb, $subPath, $params)
122
+ {
123
+ $fullPath = $this->_config->merchantPath() . $subPath;
124
+ $response = $this->_http->$httpVerb($fullPath, $params);
125
+ return $this->_verifyGatewayResponse($response);
126
+ }
127
+
128
+ /**
129
+ * generic method for validating incoming gateway responses
130
+ *
131
+ * creates a new PayPalAccount object and encapsulates
132
+ * it inside a Result\Successful object, or
133
+ * encapsulates a Errors object inside a Result\Error
134
+ * alternatively, throws an Unexpected exception if the response is invalid.
135
+ *
136
+ * @ignore
137
+ * @param array $response gateway response values
138
+ * @return Result\Successful|Result\Error
139
+ * @throws Exception\Unexpected
140
+ */
141
+ private function _verifyGatewayResponse($response)
142
+ {
143
+ if (isset($response['paypalAccount'])) {
144
+ // return a populated instance of PayPalAccount
145
+ return new Result\Successful(
146
+ PayPalAccount::factory($response['paypalAccount'])
147
+ );
148
+ } else if (isset($response['apiErrorResponse'])) {
149
+ return new Result\Error($response['apiErrorResponse']);
150
+ } else {
151
+ throw new Exception\Unexpected(
152
+ 'Expected paypal account or apiErrorResponse'
153
+ );
154
+ }
155
+ }
156
+
157
+ /**
158
+ * verifies that a valid paypal account identifier is being used
159
+ * @ignore
160
+ * @param string $identifier
161
+ * @param Optional $string $identifierType type of identifier supplied, default 'token'
162
+ * @throws InvalidArgumentException
163
+ */
164
+ private function _validateId($identifier = null, $identifierType = 'token')
165
+ {
166
+ if (empty($identifier)) {
167
+ throw new InvalidArgumentException(
168
+ 'expected paypal account id to be set'
169
+ );
170
+ }
171
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
172
+ throw new InvalidArgumentException(
173
+ $identifier . ' is an invalid paypal account ' . $identifierType . '.'
174
+ );
175
+ }
176
+ }
177
+ }
178
+ class_alias('Braintree\PayPalAccountGateway', 'Braintree_PayPalAccountGateway');
lib/Jmango360/Braintree/lib/Braintree/PaymentInstrumentType.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class PaymentInstrumentType
5
+ {
6
+ const PAYPAL_ACCOUNT = 'paypal_account';
7
+ const COINBASE_ACCOUNT = 'coinbase_account';
8
+ const EUROPE_BANK_ACCOUNT = 'europe_bank_account';
9
+ const CREDIT_CARD = 'credit_card';
10
+ const VISA_CHECKOUT_CARD = 'visa_checkout_card';
11
+ const MASTERPASS_CARD = 'masterpass_card';
12
+ const APPLE_PAY_CARD = 'apple_pay_card';
13
+ const ANDROID_PAY_CARD = 'android_pay_card';
14
+ const VENMO_ACCOUNT = 'venmo_account';
15
+ const US_BANK_ACCOUNT = 'us_bank_account';
16
+ }
17
+ class_alias('Braintree\PaymentInstrumentType', 'Braintree_PaymentInstrumentType');
lib/Jmango360/Braintree/lib/Braintree/PaymentMethod.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree PaymentMethod module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Creates and manages Braintree PaymentMethods
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ */
20
+ class PaymentMethod extends Base
21
+ {
22
+ // static methods redirecting to gateway
23
+
24
+ public static function create($attribs)
25
+ {
26
+ return Configuration::gateway()->paymentMethod()->create($attribs);
27
+ }
28
+
29
+ public static function find($token)
30
+ {
31
+ return Configuration::gateway()->paymentMethod()->find($token);
32
+ }
33
+
34
+ public static function update($token, $attribs)
35
+ {
36
+ return Configuration::gateway()->paymentMethod()->update($token, $attribs);
37
+ }
38
+
39
+ public static function delete($token, $options=[])
40
+ {
41
+ return Configuration::gateway()->paymentMethod()->delete($token, $options);
42
+ }
43
+ }
44
+ class_alias('Braintree\PaymentMethod', 'Braintree_PaymentMethod');
lib/Jmango360/Braintree/lib/Braintree/PaymentMethodGateway.php ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree PaymentMethodGateway module
8
+ *
9
+ * @package Braintree
10
+ * @category Resources
11
+ */
12
+
13
+ /**
14
+ * Creates and manages Braintree PaymentMethods
15
+ *
16
+ * <b>== More information ==</b>
17
+ *
18
+ *
19
+ * @package Braintree
20
+ * @category Resources
21
+ */
22
+ class PaymentMethodGateway
23
+ {
24
+ private $_gateway;
25
+ private $_config;
26
+ private $_http;
27
+
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+
37
+ public function create($attribs)
38
+ {
39
+ Util::verifyKeys(self::createSignature(), $attribs);
40
+ return $this->_doCreate('/payment_methods', ['payment_method' => $attribs]);
41
+ }
42
+
43
+ /**
44
+ * find a PaymentMethod by token
45
+ *
46
+ * @param string $token payment method unique id
47
+ * @return CreditCard|PayPalAccount
48
+ * @throws Exception\NotFound
49
+ */
50
+ public function find($token)
51
+ {
52
+ $this->_validateId($token);
53
+ try {
54
+ $path = $this->_config->merchantPath() . '/payment_methods/any/' . $token;
55
+ $response = $this->_http->get($path);
56
+ if (isset($response['creditCard'])) {
57
+ return CreditCard::factory($response['creditCard']);
58
+ } else if (isset($response['paypalAccount'])) {
59
+ return PayPalAccount::factory($response['paypalAccount']);
60
+ } else if (isset($response['coinbaseAccount'])) {
61
+ return CoinbaseAccount::factory($response['coinbaseAccount']);
62
+ } else if (isset($response['applePayCard'])) {
63
+ return ApplePayCard::factory($response['applePayCard']);
64
+ } else if (isset($response['androidPayCard'])) {
65
+ return AndroidPayCard::factory($response['androidPayCard']);
66
+ } else if (isset($response['amexExpressCheckoutCard'])) {
67
+ return AmexExpressCheckoutCard::factory($response['amexExpressCheckoutCard']);
68
+ } else if (isset($response['europeBankAccount'])) {
69
+ return EuropeBankAccount::factory($response['europeBankAccount']);
70
+ } else if (isset($response['usBankAccount'])) {
71
+ return UsBankAccount::factory($response['usBankAccount']);
72
+ } else if (isset($response['venmoAccount'])) {
73
+ return VenmoAccount::factory($response['venmoAccount']);
74
+ } else if (isset($response['visaCheckoutCard'])) {
75
+ return VisaCheckoutCard::factory($response['visaCheckoutCard']);
76
+ } else if (isset($response['masterpassCard'])) {
77
+ return MasterpassCard::factory($response['masterpassCard']);
78
+ } else if (is_array($response)) {
79
+ return UnknownPaymentMethod::factory($response);
80
+ }
81
+ } catch (Exception\NotFound $e) {
82
+ throw new Exception\NotFound(
83
+ 'payment method with token ' . $token . ' not found'
84
+ );
85
+ }
86
+ }
87
+
88
+ public function update($token, $attribs)
89
+ {
90
+ Util::verifyKeys(self::updateSignature(), $attribs);
91
+ return $this->_doUpdate('/payment_methods/any/' . $token, ['payment_method' => $attribs]);
92
+ }
93
+
94
+ public function delete($token, $options=[])
95
+ {
96
+ Util::verifyKeys(self::deleteSignature(), $options);
97
+ $this->_validateId($token);
98
+ $queryString = "";
99
+ if (!empty($options)) {
100
+ $queryString = "?" . http_build_query(Util::camelCaseToDelimiterArray($options, '_'));
101
+ }
102
+ return $this->_doDelete('/payment_methods/any/' . $token . $queryString);
103
+ }
104
+
105
+ public function grant($sharedPaymentMethodToken, $attribs=[])
106
+ {
107
+ if (is_bool($attribs) === true) {
108
+ $attribs = ['allow_vaulting' => $attribs];
109
+ }
110
+ $options = [ 'shared_payment_method_token' => $sharedPaymentMethodToken ];
111
+
112
+ return $this->_doCreate(
113
+ '/payment_methods/grant',
114
+ [
115
+ 'payment_method' => array_merge($attribs, $options)
116
+ ]
117
+ );
118
+ }
119
+
120
+ public function revoke($sharedPaymentMethodToken)
121
+ {
122
+ return $this->_doCreate(
123
+ '/payment_methods/revoke',
124
+ [
125
+ 'payment_method' => [
126
+ 'shared_payment_method_token' => $sharedPaymentMethodToken
127
+ ]
128
+ ]
129
+ );
130
+ }
131
+
132
+ private static function baseSignature()
133
+ {
134
+ $billingAddressSignature = AddressGateway::createSignature();
135
+ $optionsSignature = [
136
+ 'failOnDuplicatePaymentMethod',
137
+ 'makeDefault',
138
+ 'verificationMerchantAccountId',
139
+ 'verifyCard',
140
+ 'verificationAmount',
141
+ ['paypal' => [
142
+ 'payee_email',
143
+ 'order_id',
144
+ 'custom_field',
145
+ 'description',
146
+ 'amount',
147
+ ]],
148
+ ];
149
+ return [
150
+ 'billingAddressId',
151
+ 'cardholderName',
152
+ 'cvv',
153
+ 'deviceData',
154
+ 'expirationDate',
155
+ 'expirationMonth',
156
+ 'expirationYear',
157
+ 'number',
158
+ 'paymentMethodNonce',
159
+ 'token',
160
+ ['options' => $optionsSignature],
161
+ ['billingAddress' => $billingAddressSignature]
162
+ ];
163
+ }
164
+
165
+ public static function createSignature()
166
+ {
167
+ $signature = array_merge(self::baseSignature(), ['customerId']);
168
+ return $signature;
169
+ }
170
+
171
+ public static function updateSignature()
172
+ {
173
+ $billingAddressSignature = AddressGateway::updateSignature();
174
+ array_push($billingAddressSignature, [
175
+ 'options' => [
176
+ 'updateExisting'
177
+ ]
178
+ ]);
179
+ $signature = array_merge(self::baseSignature(), [
180
+ 'deviceSessionId',
181
+ 'venmoSdkPaymentMethodCode',
182
+ 'fraudMerchantId',
183
+ ['billingAddress' => $billingAddressSignature]
184
+ ]);
185
+ return $signature;
186
+ }
187
+
188
+ private static function deleteSignature()
189
+ {
190
+ return ['revokeAllGrants'];
191
+ }
192
+
193
+ /**
194
+ * sends the create request to the gateway
195
+ *
196
+ * @ignore
197
+ * @param string $subPath
198
+ * @param array $params
199
+ * @return mixed
200
+ */
201
+ public function _doCreate($subPath, $params)
202
+ {
203
+ $fullPath = $this->_config->merchantPath() . $subPath;
204
+ $response = $this->_http->post($fullPath, $params);
205
+
206
+ return $this->_verifyGatewayResponse($response);
207
+ }
208
+
209
+ /**
210
+ * sends the update request to the gateway
211
+ *
212
+ * @ignore
213
+ * @param string $subPath
214
+ * @param array $params
215
+ * @return mixed
216
+ */
217
+ public function _doUpdate($subPath, $params)
218
+ {
219
+ $fullPath = $this->_config->merchantPath() . $subPath;
220
+ $response = $this->_http->put($fullPath, $params);
221
+
222
+ return $this->_verifyGatewayResponse($response);
223
+ }
224
+
225
+
226
+ /**
227
+ * sends the delete request to the gateway
228
+ *
229
+ * @ignore
230
+ * @param string $subPath
231
+ * @return mixed
232
+ */
233
+ public function _doDelete($subPath)
234
+ {
235
+ $fullPath = $this->_config->merchantPath() . $subPath;
236
+ $this->_http->delete($fullPath);
237
+ return new Result\Successful();
238
+ }
239
+
240
+ /**
241
+ * generic method for validating incoming gateway responses
242
+ *
243
+ * creates a new CreditCard or PayPalAccount object
244
+ * and encapsulates it inside a Result\Successful object, or
245
+ * encapsulates a Errors object inside a Result\Error
246
+ * alternatively, throws an Unexpected exception if the response is invalid.
247
+ *
248
+ * @ignore
249
+ * @param array $response gateway response values
250
+ * @return Result\Successful|Result\Error
251
+ * @throws Exception\Unexpected
252
+ */
253
+ private function _verifyGatewayResponse($response)
254
+ {
255
+ if (isset($response['creditCard'])) {
256
+ return new Result\Successful(
257
+ CreditCard::factory($response['creditCard']),
258
+ 'paymentMethod'
259
+ );
260
+ } else if (isset($response['paypalAccount'])) {
261
+ return new Result\Successful(
262
+ PayPalAccount::factory($response['paypalAccount']),
263
+ "paymentMethod"
264
+ );
265
+ } else if (isset($response['coinbaseAccount'])) {
266
+ return new Result\Successful(
267
+ CoinbaseAccount::factory($response['coinbaseAccount']),
268
+ "paymentMethod"
269
+ );
270
+ } else if (isset($response['applePayCard'])) {
271
+ return new Result\Successful(
272
+ ApplePayCard::factory($response['applePayCard']),
273
+ "paymentMethod"
274
+ );
275
+ } else if (isset($response['androidPayCard'])) {
276
+ return new Result\Successful(
277
+ AndroidPayCard::factory($response['androidPayCard']),
278
+ "paymentMethod"
279
+ );
280
+ } else if (isset($response['amexExpressCheckoutCard'])) {
281
+ return new Result\Successful(
282
+ AmexExpressCheckoutCard::factory($response['amexExpressCheckoutCard']),
283
+ "paymentMethod"
284
+ );
285
+ } else if (isset($response['europeBankAccount'])) {
286
+ return new Result\Successful(
287
+ EuropeBankAccount::factory($response['europeBankAccount']),
288
+ "paymentMethod"
289
+ );
290
+ } else if (isset($response['usBankAccount'])) {
291
+ return new Result\Successful(
292
+ UsBankAccount::factory($response['usBankAccount']),
293
+ "paymentMethod"
294
+ );
295
+ } else if (isset($response['venmoAccount'])) {
296
+ return new Result\Successful(
297
+ VenmoAccount::factory($response['venmoAccount']),
298
+ "paymentMethod"
299
+ );
300
+ } else if (isset($response['visaCheckoutCard'])) {
301
+ return new Result\Successful(
302
+ VisaCheckoutCard::factory($response['visaCheckoutCard']),
303
+ "paymentMethod"
304
+ );
305
+ } else if (isset($response['masterpassCard'])) {
306
+ return new Result\Successful(
307
+ MasterpassCard::factory($response['masterpassCard']),
308
+ "paymentMethod"
309
+ );
310
+ } else if (isset($response['paymentMethodNonce'])) {
311
+ return new Result\Successful(
312
+ PaymentMethodNonce::factory($response['paymentMethodNonce']),
313
+ "paymentMethodNonce"
314
+ );
315
+ } else if (isset($response['apiErrorResponse'])) {
316
+ return new Result\Error($response['apiErrorResponse']);
317
+ } else if (is_array($response)) {
318
+ return new Result\Successful(
319
+ UnknownPaymentMethod::factory($response),
320
+ "paymentMethod"
321
+ );
322
+ } else {
323
+ throw new Exception\Unexpected(
324
+ 'Expected payment method or apiErrorResponse'
325
+ );
326
+ }
327
+ }
328
+
329
+ /**
330
+ * verifies that a valid payment method identifier is being used
331
+ * @ignore
332
+ * @param string $identifier
333
+ * @param Optional $string $identifierType type of identifier supplied, default 'token'
334
+ * @throws InvalidArgumentException
335
+ */
336
+ private function _validateId($identifier = null, $identifierType = 'token')
337
+ {
338
+ if (empty($identifier)) {
339
+ throw new InvalidArgumentException(
340
+ 'expected payment method id to be set'
341
+ );
342
+ }
343
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $identifier)) {
344
+ throw new InvalidArgumentException(
345
+ $identifier . ' is an invalid payment method ' . $identifierType . '.'
346
+ );
347
+ }
348
+ }
349
+ }
350
+ class_alias('Braintree\PaymentMethodGateway', 'Braintree_PaymentMethodGateway');
lib/Jmango360/Braintree/lib/Braintree/PaymentMethodNonce.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree PaymentMethodNonce module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Creates and manages Braintree PaymentMethodNonces
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ */
20
+ class PaymentMethodNonce extends Base
21
+ {
22
+ // static methods redirecting to gateway
23
+
24
+ public static function create($token)
25
+ {
26
+ return Configuration::gateway()->paymentMethodNonce()->create($token);
27
+ }
28
+
29
+ public static function find($nonce)
30
+ {
31
+ return Configuration::gateway()->paymentMethodNonce()->find($nonce);
32
+ }
33
+
34
+ public static function factory($attributes)
35
+ {
36
+ $instance = new self();
37
+ $instance->_initialize($attributes);
38
+ return $instance;
39
+ }
40
+
41
+ protected function _initialize($nonceAttributes)
42
+ {
43
+ $this->_attributes = $nonceAttributes;
44
+ $this->_set('nonce', $nonceAttributes['nonce']);
45
+ $this->_set('type', $nonceAttributes['type']);
46
+
47
+ if(isset($nonceAttributes['threeDSecureInfo'])) {
48
+ $this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($nonceAttributes['threeDSecureInfo']));
49
+ }
50
+ }
51
+ }
52
+ class_alias('Braintree\PaymentMethodNonce', 'Braintree_PaymentMethodNonce');
lib/Jmango360/Braintree/lib/Braintree/PaymentMethodNonceGateway.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree PaymentMethodNonceGateway module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Creates and manages Braintree PaymentMethodNonces
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ */
20
+ class PaymentMethodNonceGateway
21
+ {
22
+ private $_gateway;
23
+ private $_config;
24
+ private $_http;
25
+
26
+ public function __construct($gateway)
27
+ {
28
+ $this->_gateway = $gateway;
29
+ $this->_config = $gateway->config;
30
+ $this->_http = new Http($gateway->config);
31
+ }
32
+
33
+
34
+ public function create($token)
35
+ {
36
+ $subPath = '/payment_methods/' . $token . '/nonces';
37
+ $fullPath = $this->_config->merchantPath() . $subPath;
38
+ $response = $this->_http->post($fullPath);
39
+
40
+ return new Result\Successful(
41
+ PaymentMethodNonce::factory($response['paymentMethodNonce']),
42
+ "paymentMethodNonce"
43
+ );
44
+ }
45
+
46
+ /**
47
+ * @access public
48
+ *
49
+ */
50
+ public function find($nonce)
51
+ {
52
+ try {
53
+ $path = $this->_config->merchantPath() . '/payment_method_nonces/' . $nonce;
54
+ $response = $this->_http->get($path);
55
+ return PaymentMethodNonce::factory($response['paymentMethodNonce']);
56
+ } catch (Exception\NotFound $e) {
57
+ throw new Exception\NotFound(
58
+ 'payment method nonce with id ' . $nonce . ' not found'
59
+ );
60
+ }
61
+
62
+ }
63
+ }
64
+ class_alias('Braintree\PaymentMethodNonceGateway', 'Braintree_PaymentMethodNonceGateway');
lib/Jmango360/Braintree/lib/Braintree/Plan.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class Plan extends Base
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self();
9
+ $instance->_initialize($attributes);
10
+
11
+ return $instance;
12
+ }
13
+
14
+ protected function _initialize($attributes)
15
+ {
16
+ $this->_attributes = $attributes;
17
+
18
+ $addOnArray = [];
19
+ if (isset($attributes['addOns'])) {
20
+ foreach ($attributes['addOns'] AS $addOn) {
21
+ $addOnArray[] = AddOn::factory($addOn);
22
+ }
23
+ }
24
+ $this->_attributes['addOns'] = $addOnArray;
25
+
26
+ $discountArray = [];
27
+ if (isset($attributes['discounts'])) {
28
+ foreach ($attributes['discounts'] AS $discount) {
29
+ $discountArray[] = Discount::factory($discount);
30
+ }
31
+ }
32
+ $this->_attributes['discounts'] = $discountArray;
33
+
34
+ $planArray = [];
35
+ if (isset($attributes['plans'])) {
36
+ foreach ($attributes['plans'] AS $plan) {
37
+ $planArray[] = self::factory($plan);
38
+ }
39
+ }
40
+ $this->_attributes['plans'] = $planArray;
41
+ }
42
+
43
+
44
+ // static methods redirecting to gateway
45
+
46
+ public static function all()
47
+ {
48
+ return Configuration::gateway()->plan()->all();
49
+ }
50
+ }
51
+ class_alias('Braintree\Plan', 'Braintree_Plan');
lib/Jmango360/Braintree/lib/Braintree/PlanGateway.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class PlanGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_config->assertHasAccessTokenOrKeys();
15
+ $this->_http = new Http($gateway->config);
16
+ }
17
+
18
+ public function all()
19
+ {
20
+ $path = $this->_config->merchantPath() . '/plans';
21
+ $response = $this->_http->get($path);
22
+ if (key_exists('plans', $response)){
23
+ $plans = ["plan" => $response['plans']];
24
+ } else {
25
+ $plans = ["plan" => []];
26
+ }
27
+
28
+ return Util::extractAttributeAsArray(
29
+ $plans,
30
+ 'plan'
31
+ );
32
+ }
33
+ }
34
+ class_alias('Braintree\PlanGateway', 'Braintree_PlanGateway');
lib/Jmango360/Braintree/lib/Braintree/RangeNode.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class RangeNode
5
+ {
6
+ public function __construct($name)
7
+ {
8
+ $this->name = $name;
9
+ $this->searchTerms = [];
10
+ }
11
+
12
+ public function greaterThanOrEqualTo($value)
13
+ {
14
+ $this->searchTerms['min'] = $value;
15
+ return $this;
16
+ }
17
+
18
+ public function lessThanOrEqualTo($value)
19
+ {
20
+ $this->searchTerms['max'] = $value;
21
+ return $this;
22
+ }
23
+
24
+ public function is($value)
25
+ {
26
+ $this->searchTerms['is'] = $value;
27
+ return $this;
28
+ }
29
+
30
+ public function between($min, $max)
31
+ {
32
+ return $this->greaterThanOrEqualTo($min)->lessThanOrEqualTo($max);
33
+ }
34
+
35
+ public function toParam()
36
+ {
37
+ return $this->searchTerms;
38
+ }
39
+ }
40
+ class_alias('Braintree\RangeNode', 'Braintree_RangeNode');
lib/Jmango360/Braintree/lib/Braintree/ResourceCollection.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use Iterator;
5
+
6
+ /**
7
+ * Braintree ResourceCollection
8
+ * ResourceCollection is a container object for result data
9
+ *
10
+ * stores and retrieves search results and aggregate data
11
+ *
12
+ * example:
13
+ * <code>
14
+ * $result = Customer::all();
15
+ *
16
+ * foreach($result as $transaction) {
17
+ * print_r($transaction->id);
18
+ * }
19
+ * </code>
20
+ *
21
+ * @package Braintree
22
+ * @subpackage Utility
23
+ */
24
+ class ResourceCollection implements Iterator
25
+ {
26
+ private $_batchIndex;
27
+ private $_ids;
28
+ private $_index;
29
+ private $_items;
30
+ private $_pageSize;
31
+ private $_pager;
32
+
33
+ /**
34
+ * set up the resource collection
35
+ *
36
+ * expects an array of attributes with literal keys
37
+ *
38
+ * @param array $response
39
+ * @param array $pager
40
+ */
41
+ public function __construct($response, $pager)
42
+ {
43
+ $this->_pageSize = $response["searchResults"]["pageSize"];
44
+ $this->_ids = $response["searchResults"]["ids"];
45
+ $this->_pager = $pager;
46
+ }
47
+
48
+ /**
49
+ * returns the current item when iterating with foreach
50
+ */
51
+ public function current()
52
+ {
53
+ return $this->_items[$this->_index];
54
+ }
55
+
56
+ /**
57
+ * returns the first item in the collection
58
+ *
59
+ * @return mixed
60
+ */
61
+ public function firstItem()
62
+ {
63
+ $ids = $this->_ids;
64
+ $page = $this->_getPage([$ids[0]]);
65
+ return $page[0];
66
+ }
67
+
68
+ public function key()
69
+ {
70
+ return null;
71
+ }
72
+
73
+ /**
74
+ * advances to the next item in the collection when iterating with foreach
75
+ */
76
+ public function next()
77
+ {
78
+ ++$this->_index;
79
+ }
80
+
81
+ /**
82
+ * rewinds the testIterateOverResults collection to the first item when iterating with foreach
83
+ */
84
+ public function rewind()
85
+ {
86
+ $this->_batchIndex = 0;
87
+ $this->_getNextPage();
88
+ }
89
+
90
+ /**
91
+ * returns whether the current item is valid when iterating with foreach
92
+ */
93
+ public function valid()
94
+ {
95
+ if ($this->_index == count($this->_items) && $this->_batchIndex < count($this->_ids)) {
96
+ $this->_getNextPage();
97
+ }
98
+
99
+ if ($this->_index < count($this->_items)) {
100
+ return true;
101
+ } else {
102
+ return false;
103
+ }
104
+ }
105
+
106
+ public function maximumCount()
107
+ {
108
+ return count($this->_ids);
109
+ }
110
+
111
+ private function _getNextPage()
112
+ {
113
+ if (empty($this->_ids))
114
+ {
115
+ $this->_items = [];
116
+ }
117
+ else
118
+ {
119
+ $this->_items = $this->_getPage(array_slice($this->_ids, $this->_batchIndex, $this->_pageSize));
120
+ $this->_batchIndex += $this->_pageSize;
121
+ $this->_index = 0;
122
+ }
123
+ }
124
+
125
+ /**
126
+ * requests the next page of results for the collection
127
+ *
128
+ * @return void
129
+ */
130
+ private function _getPage($ids)
131
+ {
132
+ $object = $this->_pager['object'];
133
+ $method = $this->_pager['method'];
134
+ $methodArgs = [];
135
+ foreach ($this->_pager['methodArgs'] as $arg) {
136
+ array_push($methodArgs, $arg);
137
+ }
138
+ array_push($methodArgs, $ids);
139
+
140
+ return call_user_func_array(
141
+ [$object, $method],
142
+ $methodArgs
143
+ );
144
+ }
145
+
146
+ /**
147
+ * returns all IDs in the collection
148
+ *
149
+ * @return array
150
+ */
151
+ public function getIds()
152
+ {
153
+ return $this->_ids;
154
+ }
155
+ }
156
+ class_alias('Braintree\ResourceCollection', 'Braintree_ResourceCollection');
lib/Jmango360/Braintree/lib/Braintree/Result/CreditCardVerification.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Result;
3
+
4
+ use Braintree\RiskData;
5
+ use Braintree\Util;
6
+
7
+ /**
8
+ * Braintree Credit Card Verification Result
9
+ *
10
+ * This object is returned as part of an Error Result; it provides
11
+ * access to the credit card verification data from the gateway
12
+ *
13
+ *
14
+ * @package Braintree
15
+ * @subpackage Result
16
+ *
17
+ * @property-read string $avsErrorResponseCode
18
+ * @property-read string $avsPostalCodeResponseCode
19
+ * @property-read string $avsStreetAddressResponseCode
20
+ * @property-read string $cvvResponseCode
21
+ * @property-read string $status
22
+ *
23
+ */
24
+ class CreditCardVerification
25
+ {
26
+ // Status
27
+ const FAILED = 'failed';
28
+ const GATEWAY_REJECTED = 'gateway_rejected';
29
+ const PROCESSOR_DECLINED = 'processor_declined';
30
+ const VERIFIED = 'verified';
31
+
32
+ private $_attributes;
33
+ private $_amount;
34
+ private $_avsErrorResponseCode;
35
+ private $_avsPostalCodeResponseCode;
36
+ private $_avsStreetAddressResponseCode;
37
+ private $_currencyIsoCode;
38
+ private $_cvvResponseCode;
39
+ private $_gatewayRejectionReason;
40
+ private $_status;
41
+
42
+ /**
43
+ * @ignore
44
+ */
45
+ public function __construct($attributes)
46
+ {
47
+ $this->_initializeFromArray($attributes);
48
+ }
49
+
50
+ /**
51
+ * initializes instance properties from the keys/values of an array
52
+ * @ignore
53
+ * @access protected
54
+ * @param <type> $aAttribs array of properties to set - single level
55
+ * @return void
56
+ */
57
+ private function _initializeFromArray($attributes)
58
+ {
59
+ if(isset($attributes['riskData']))
60
+ {
61
+ $attributes['riskData'] = RiskData::factory($attributes['riskData']);
62
+ }
63
+
64
+ $this->_attributes = $attributes;
65
+ foreach($attributes AS $name => $value) {
66
+ $varName = "_$name";
67
+ $this->$varName = $value;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * @ignore
73
+ */
74
+ public function __get($name)
75
+ {
76
+ $varName = "_$name";
77
+ return isset($this->$varName) ? $this->$varName : null;
78
+ }
79
+
80
+ /**
81
+ * returns a string representation of the customer
82
+ * @return string
83
+ */
84
+ public function __toString()
85
+ {
86
+ return __CLASS__ . '[' .
87
+ Util::attributesToString($this->_attributes) . ']';
88
+ }
89
+
90
+ public static function allStatuses()
91
+ {
92
+ return [
93
+ CreditCardVerification::FAILED,
94
+ CreditCardVerification::GATEWAY_REJECTED,
95
+ CreditCardVerification::PROCESSOR_DECLINED,
96
+ CreditCardVerification::VERIFIED
97
+ ];
98
+ }
99
+ }
100
+ class_alias('Braintree\Result\CreditCardVerification', 'Braintree_Result_CreditCardVerification');
lib/Jmango360/Braintree/lib/Braintree/Result/Error.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Result;
3
+
4
+ use Braintree\Base;
5
+ use Braintree\Transaction;
6
+ use Braintree\Subscription;
7
+ use Braintree\MerchantAccount;
8
+ use Braintree\Util;
9
+ use Braintree\Error\ErrorCollection;
10
+
11
+ /**
12
+ * Braintree Error Result
13
+ *
14
+ * An Error Result will be returned from gateway methods when
15
+ * the gateway responds with an error. It will provide access
16
+ * to the original request.
17
+ * For example, when voiding a transaction, Error Result will
18
+ * respond to the void request if it failed:
19
+ *
20
+ * <code>
21
+ * $result = Transaction::void('abc123');
22
+ * if ($result->success) {
23
+ * // Successful Result
24
+ * } else {
25
+ * // Result\Error
26
+ * }
27
+ * </code>
28
+ *
29
+ * @package Braintree
30
+ * @subpackage Result
31
+ *
32
+ * @property-read array $params original passed params
33
+ * @property-read \Braintree\Error\ErrorCollection $errors
34
+ * @property-read \Braintree\Result\CreditCardVerification $creditCardVerification credit card verification data
35
+ */
36
+ class Error extends Base
37
+ {
38
+ /**
39
+ * @var bool always false
40
+ */
41
+ public $success = false;
42
+
43
+ /**
44
+ * return original value for a field
45
+ * For example, if a user tried to submit 'invalid-email' in the html field transaction[customer][email],
46
+ * $result->valueForHtmlField("transaction[customer][email]") would yield "invalid-email"
47
+ *
48
+ * @param string $field
49
+ * @return string
50
+ */
51
+ public function valueForHtmlField($field)
52
+ {
53
+ $pieces = preg_split("/[\[\]]+/", $field, 0, PREG_SPLIT_NO_EMPTY);
54
+ $params = $this->params;
55
+ foreach(array_slice($pieces, 0, -1) as $key) {
56
+ $params = $params[Util::delimiterToCamelCase($key)];
57
+ }
58
+ if ($key != 'custom_fields') {
59
+ $finalKey = Util::delimiterToCamelCase(end($pieces));
60
+ } else {
61
+ $finalKey = end($pieces);
62
+ }
63
+ $fieldValue = isset($params[$finalKey]) ? $params[$finalKey] : null;
64
+ return $fieldValue;
65
+ }
66
+
67
+ /**
68
+ * overrides default constructor
69
+ * @ignore
70
+ * @param array $response gateway response array
71
+ */
72
+ public function __construct($response)
73
+ {
74
+ $this->_attributes = $response;
75
+ $this->_set('errors', new ErrorCollection($response['errors']));
76
+
77
+ if(isset($response['verification'])) {
78
+ $this->_set('creditCardVerification', new CreditCardVerification($response['verification']));
79
+ } else {
80
+ $this->_set('creditCardVerification', null);
81
+ }
82
+
83
+ if(isset($response['transaction'])) {
84
+ $this->_set('transaction', Transaction::factory($response['transaction']));
85
+ } else {
86
+ $this->_set('transaction', null);
87
+ }
88
+
89
+ if(isset($response['subscription'])) {
90
+ $this->_set('subscription', Subscription::factory($response['subscription']));
91
+ } else {
92
+ $this->_set('subscription', null);
93
+ }
94
+
95
+ if(isset($response['merchantAccount'])) {
96
+ $this->_set('merchantAccount', MerchantAccount::factory($response['merchantAccount']));
97
+ } else {
98
+ $this->_set('merchantAccount', null);
99
+ }
100
+
101
+ if(isset($response['verification'])) {
102
+ $this->_set('verification', new CreditCardVerification($response['verification']));
103
+ } else {
104
+ $this->_set('verification', null);
105
+ }
106
+ }
107
+
108
+ /**
109
+ * create a printable representation of the object as:
110
+ * ClassName[property=value, property=value]
111
+ * @ignore
112
+ * @return string
113
+ */
114
+ public function __toString()
115
+ {
116
+ $output = Util::attributesToString($this->_attributes);
117
+ if (isset($this->_creditCardVerification)) {
118
+ $output .= sprintf('%s', $this->_creditCardVerification);
119
+ }
120
+ return __CLASS__ .'[' . $output . ']';
121
+ }
122
+ }
123
+ class_alias('Braintree\Result\Error', 'Braintree_Result_Error');
lib/Jmango360/Braintree/lib/Braintree/Result/Successful.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Result;
3
+
4
+ use Braintree\Instance;
5
+ use Braintree\Util;
6
+
7
+ /**
8
+ * Braintree Successful Result
9
+ *
10
+ * A Successful Result will be returned from gateway methods when
11
+ * validations pass. It will provide access to the created resource.
12
+ *
13
+ * For example, when creating a customer, Successful will
14
+ * respond to <b>customer</b> like so:
15
+ *
16
+ * <code>
17
+ * $result = Customer::create(array('first_name' => "John"));
18
+ * if ($result->success) {
19
+ * // Successful
20
+ * echo "Created customer {$result->customer->id}";
21
+ * } else {
22
+ * // Error
23
+ * }
24
+ * </code>
25
+ *
26
+ *
27
+ * @package Braintree
28
+ * @subpackage Result
29
+ */
30
+ class Successful extends Instance
31
+ {
32
+ /**
33
+ *
34
+ * @var boolean always true
35
+ */
36
+ public $success = true;
37
+ /**
38
+ *
39
+ * @var string stores the internal name of the object providing access to
40
+ */
41
+ private $_returnObjectNames;
42
+
43
+ /**
44
+ * @ignore
45
+ * @param array|null $objsToReturn
46
+ * @param array|null $propertyNames
47
+ */
48
+ public function __construct($objsToReturn = [], $propertyNames = [])
49
+ {
50
+ // Sanitize arguments (preserves backwards compatibility)
51
+ if (!is_array($objsToReturn)) { $objsToReturn = [$objsToReturn]; }
52
+ if (!is_array($propertyNames)) { $propertyNames = [$propertyNames]; }
53
+
54
+ $objects = $this->_mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn);
55
+ $this->_attributes = [];
56
+ $this->_returnObjectNames = [];
57
+
58
+ foreach ($objects as $propertyName => $objToReturn) {
59
+
60
+ // save the name for indirect access
61
+ array_push($this->_returnObjectNames, $propertyName);
62
+
63
+ // create the property!
64
+ $this->$propertyName = $objToReturn;
65
+ }
66
+ }
67
+
68
+ /**
69
+ *
70
+ * @ignore
71
+ * @return string string representation of the object's structure
72
+ */
73
+ public function __toString()
74
+ {
75
+ $objects = [];
76
+ foreach ($this->_returnObjectNames as $returnObjectName) {
77
+ array_push($objects, $this->$returnObjectName);
78
+ }
79
+ return __CLASS__ . '[' . implode(', ', $objects) . ']';
80
+ }
81
+
82
+ private function _mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn) {
83
+ if(count($objsToReturn) != count($propertyNames)) {
84
+ $propertyNames = [];
85
+ foreach ($objsToReturn as $obj) {
86
+ array_push($propertyNames, Util::cleanClassName(get_class($obj)));
87
+ }
88
+ }
89
+ return array_combine($propertyNames, $objsToReturn);
90
+ }
91
+ }
92
+ class_alias('Braintree\Result\Successful', 'Braintree_Result_Successful');
lib/Jmango360/Braintree/lib/Braintree/RiskData.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class RiskData extends Base
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self();
9
+ $instance->_initialize($attributes);
10
+
11
+ return $instance;
12
+ }
13
+
14
+ protected function _initialize($attributes)
15
+ {
16
+ $this->_attributes = $attributes;
17
+ }
18
+
19
+ /**
20
+ * returns a string representation of the risk data
21
+ * @return string
22
+ */
23
+ public function __toString()
24
+ {
25
+ return __CLASS__ . '[' .
26
+ Util::attributesToString($this->_attributes) .']';
27
+ }
28
+
29
+ }
30
+ class_alias('Braintree\RiskData', 'Braintree_RiskData');
lib/Jmango360/Braintree/lib/Braintree/SettlementBatchSummary.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class SettlementBatchSummary extends Base
5
+ {
6
+ /**
7
+ *
8
+ * @param array $attributes
9
+ * @return SettlementBatchSummary
10
+ */
11
+ public static function factory($attributes)
12
+ {
13
+ $instance = new self();
14
+ $instance->_initialize($attributes);
15
+ return $instance;
16
+ }
17
+
18
+ /**
19
+ * @ignore
20
+ * @param array $attributes
21
+ */
22
+ protected function _initialize($attributes)
23
+ {
24
+ $this->_attributes = $attributes;
25
+ }
26
+
27
+ public function records()
28
+ {
29
+ return $this->_attributes['records'];
30
+ }
31
+
32
+
33
+ /**
34
+ * static method redirecting to gateway
35
+ *
36
+ * @param string $settlement_date Date YYYY-MM-DD
37
+ * @param string $groupByCustomField
38
+ * @return Result\Successful|Result\Error
39
+ */
40
+ public static function generate($settlement_date, $groupByCustomField = NULL)
41
+ {
42
+ return Configuration::gateway()->settlementBatchSummary()->generate($settlement_date, $groupByCustomField);
43
+ }
44
+ }
45
+ class_alias('Braintree\SettlementBatchSummary', 'Braintree_SettlementBatchSummary');
lib/Jmango360/Braintree/lib/Braintree/SettlementBatchSummaryGateway.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class SettlementBatchSummaryGateway
5
+ {
6
+ /**
7
+ *
8
+ * @var Gateway
9
+ */
10
+ private $_gateway;
11
+
12
+ /**
13
+ *
14
+ * @var Configuration
15
+ */
16
+ private $_config;
17
+
18
+ /**
19
+ *
20
+ * @var Http
21
+ */
22
+ private $_http;
23
+
24
+ /**
25
+ *
26
+ * @param Gateway $gateway
27
+ */
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @param string $settlement_date
39
+ * @param string $groupByCustomField
40
+ * @return SettlementBatchSummary|Result\Error
41
+ */
42
+ public function generate($settlement_date, $groupByCustomField = NULL)
43
+ {
44
+ $criteria = ['settlement_date' => $settlement_date];
45
+ if (isset($groupByCustomField))
46
+ {
47
+ $criteria['group_by_custom_field'] = $groupByCustomField;
48
+ }
49
+ $params = ['settlement_batch_summary' => $criteria];
50
+ $path = $this->_config->merchantPath() . '/settlement_batch_summary';
51
+ $response = $this->_http->post($path, $params);
52
+
53
+ if (isset($groupByCustomField))
54
+ {
55
+ $response['settlementBatchSummary']['records'] = $this->_underscoreCustomField(
56
+ $groupByCustomField,
57
+ $response['settlementBatchSummary']['records']
58
+ );
59
+ }
60
+
61
+ return $this->_verifyGatewayResponse($response);
62
+ }
63
+
64
+ /**
65
+ *
66
+ * @param string $groupByCustomField
67
+ * @param array $records
68
+ * @return array
69
+ */
70
+ private function _underscoreCustomField($groupByCustomField, $records)
71
+ {
72
+ $updatedRecords = [];
73
+
74
+ foreach ($records as $record)
75
+ {
76
+ $camelized = Util::delimiterToCamelCase($groupByCustomField);
77
+ $record[$groupByCustomField] = $record[$camelized];
78
+ unset($record[$camelized]);
79
+ $updatedRecords[] = $record;
80
+ }
81
+
82
+ return $updatedRecords;
83
+ }
84
+
85
+ /**
86
+ *
87
+ * @param array $response
88
+ * @return Result\Successful|Result\Error
89
+ * @throws Exception\Unexpected
90
+ */
91
+ private function _verifyGatewayResponse($response)
92
+ {
93
+ if (isset($response['settlementBatchSummary'])) {
94
+ return new Result\Successful(
95
+ SettlementBatchSummary::factory($response['settlementBatchSummary'])
96
+ );
97
+ } else if (isset($response['apiErrorResponse'])) {
98
+ return new Result\Error($response['apiErrorResponse']);
99
+ } else {
100
+ throw new Exception\Unexpected(
101
+ "Expected settlementBatchSummary or apiErrorResponse"
102
+ );
103
+ }
104
+ }
105
+ }
106
+ class_alias('Braintree\SettlementBatchSummaryGateway', 'Braintree_SettlementBatchSummaryGateway');
lib/Jmango360/Braintree/lib/Braintree/SignatureService.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class SignatureService
5
+ {
6
+
7
+ public function __construct($key, $digest)
8
+ {
9
+ $this->key = $key;
10
+ $this->digest = $digest;
11
+ }
12
+
13
+ public function sign($payload)
14
+ {
15
+ return $this->hash($payload) . "|" . $payload;
16
+ }
17
+
18
+ public function hash($data)
19
+ {
20
+ return call_user_func($this->digest, $this->key, $data);
21
+ }
22
+
23
+ }
24
+ class_alias('Braintree\SignatureService', 'Braintree_SignatureService');
lib/Jmango360/Braintree/lib/Braintree/Subscription.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Subscription module
6
+ *
7
+ * <b>== More information ==</b>
8
+ *
9
+ * For more detailed information on Subscriptions, see {@link http://www.braintreepayments.com/gateway/subscription-api http://www.braintreepaymentsolutions.com/gateway/subscription-api}
10
+ *
11
+ * PHP Version 5
12
+ *
13
+ * @package Braintree
14
+ */
15
+ class Subscription extends Base
16
+ {
17
+ const ACTIVE = 'Active';
18
+ const CANCELED = 'Canceled';
19
+ const EXPIRED = 'Expired';
20
+ const PAST_DUE = 'Past Due';
21
+ const PENDING = 'Pending';
22
+
23
+ // Subscription Sources
24
+ const API = 'api';
25
+ const CONTROL_PANEL = 'control_panel';
26
+ const RECURRING = 'recurring';
27
+
28
+ /**
29
+ * @ignore
30
+ */
31
+ public static function factory($attributes)
32
+ {
33
+ $instance = new self();
34
+ $instance->_initialize($attributes);
35
+
36
+ return $instance;
37
+ }
38
+
39
+ /**
40
+ * @ignore
41
+ */
42
+ protected function _initialize($attributes)
43
+ {
44
+ $this->_attributes = $attributes;
45
+
46
+ $addOnArray = [];
47
+ if (isset($attributes['addOns'])) {
48
+ foreach ($attributes['addOns'] AS $addOn) {
49
+ $addOnArray[] = AddOn::factory($addOn);
50
+ }
51
+ }
52
+ $this->_attributes['addOns'] = $addOnArray;
53
+
54
+ $discountArray = [];
55
+ if (isset($attributes['discounts'])) {
56
+ foreach ($attributes['discounts'] AS $discount) {
57
+ $discountArray[] = Discount::factory($discount);
58
+ }
59
+ }
60
+ $this->_attributes['discounts'] = $discountArray;
61
+
62
+ if (isset($attributes['descriptor'])) {
63
+ $this->_set('descriptor', new Descriptor($attributes['descriptor']));
64
+ }
65
+
66
+ $statusHistory = [];
67
+ if (isset($attributes['statusHistory'])) {
68
+ foreach ($attributes['statusHistory'] AS $history) {
69
+ $statusHistory[] = new Subscription\StatusDetails($history);
70
+ }
71
+ }
72
+ $this->_attributes['statusHistory'] = $statusHistory;
73
+
74
+ $transactionArray = [];
75
+ if (isset($attributes['transactions'])) {
76
+ foreach ($attributes['transactions'] AS $transaction) {
77
+ $transactionArray[] = Transaction::factory($transaction);
78
+ }
79
+ }
80
+ $this->_attributes['transactions'] = $transactionArray;
81
+ }
82
+
83
+ /**
84
+ * returns a string representation of the customer
85
+ * @return string
86
+ */
87
+ public function __toString()
88
+ {
89
+ $excludedAttributes = ['statusHistory'];
90
+
91
+ $displayAttributes = [];
92
+ foreach($this->_attributes as $key => $val) {
93
+ if (!in_array($key, $excludedAttributes)) {
94
+ $displayAttributes[$key] = $val;
95
+ }
96
+ }
97
+
98
+ return __CLASS__ . '[' .
99
+ Util::attributesToString($displayAttributes) .']';
100
+ }
101
+
102
+
103
+ // static methods redirecting to gateway
104
+
105
+ public static function create($attributes)
106
+ {
107
+ return Configuration::gateway()->subscription()->create($attributes);
108
+ }
109
+
110
+ public static function find($id)
111
+ {
112
+ return Configuration::gateway()->subscription()->find($id);
113
+ }
114
+
115
+ public static function search($query)
116
+ {
117
+ return Configuration::gateway()->subscription()->search($query);
118
+ }
119
+
120
+ public static function fetch($query, $ids)
121
+ {
122
+ return Configuration::gateway()->subscription()->fetch($query, $ids);
123
+ }
124
+
125
+ public static function update($subscriptionId, $attributes)
126
+ {
127
+ return Configuration::gateway()->subscription()->update($subscriptionId, $attributes);
128
+ }
129
+
130
+ public static function retryCharge($subscriptionId, $amount = null)
131
+ {
132
+ return Configuration::gateway()->subscription()->retryCharge($subscriptionId, $amount);
133
+ }
134
+
135
+ public static function cancel($subscriptionId)
136
+ {
137
+ return Configuration::gateway()->subscription()->cancel($subscriptionId);
138
+ }
139
+ }
140
+ class_alias('Braintree\Subscription', 'Braintree_Subscription');
lib/Jmango360/Braintree/lib/Braintree/Subscription/StatusDetails.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Subscription;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Status details from a subscription
8
+ * Creates an instance of StatusDetails, as part of a subscription response
9
+ *
10
+ * @package Braintree
11
+ *
12
+ * @property-read string $price
13
+ * @property-read string $currencyIsoCode
14
+ * @property-read string $planId
15
+ * @property-read string $balance
16
+ * @property-read string $status
17
+ * @property-read string $timestamp
18
+ * @property-read string $subscriptionSource
19
+ * @property-read string $user
20
+ */
21
+ class StatusDetails extends Instance
22
+ {
23
+ }
24
+ class_alias('Braintree\Subscription\StatusDetails', 'Braintree_Subscription_StatusDetails');
lib/Jmango360/Braintree/lib/Braintree/SubscriptionGateway.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree SubscriptionGateway module
8
+ *
9
+ * <b>== More information ==</b>
10
+ *
11
+ * For more detailed information on Subscriptions, see {@link http://www.braintreepayments.com/gateway/subscription-api http://www.braintreepaymentsolutions.com/gateway/subscription-api}
12
+ *
13
+ * PHP Version 5
14
+ *
15
+ * @package Braintree
16
+ */
17
+ class SubscriptionGateway
18
+ {
19
+ private $_gateway;
20
+ private $_config;
21
+ private $_http;
22
+
23
+ public function __construct($gateway)
24
+ {
25
+ $this->_gateway = $gateway;
26
+ $this->_config = $gateway->config;
27
+ $this->_config->assertHasAccessTokenOrKeys();
28
+ $this->_http = new Http($gateway->config);
29
+ }
30
+
31
+ public function create($attributes)
32
+ {
33
+ Util::verifyKeys(self::_createSignature(), $attributes);
34
+ $path = $this->_config->merchantPath() . '/subscriptions';
35
+ $response = $this->_http->post($path, ['subscription' => $attributes]);
36
+ return $this->_verifyGatewayResponse($response);
37
+ }
38
+
39
+ public function find($id)
40
+ {
41
+ $this->_validateId($id);
42
+
43
+ try {
44
+ $path = $this->_config->merchantPath() . '/subscriptions/' . $id;
45
+ $response = $this->_http->get($path);
46
+ return Subscription::factory($response['subscription']);
47
+ } catch (Exception\NotFound $e) {
48
+ throw new Exception\NotFound('subscription with id ' . $id . ' not found');
49
+ }
50
+
51
+ }
52
+
53
+ public function search($query)
54
+ {
55
+ $criteria = [];
56
+ foreach ($query as $term) {
57
+ $criteria[$term->name] = $term->toparam();
58
+ }
59
+
60
+
61
+ $path = $this->_config->merchantPath() . '/subscriptions/advanced_search_ids';
62
+ $response = $this->_http->post($path, ['search' => $criteria]);
63
+ $pager = [
64
+ 'object' => $this,
65
+ 'method' => 'fetch',
66
+ 'methodArgs' => [$query]
67
+ ];
68
+
69
+ return new ResourceCollection($response, $pager);
70
+ }
71
+
72
+ public function fetch($query, $ids)
73
+ {
74
+ $criteria = [];
75
+ foreach ($query as $term) {
76
+ $criteria[$term->name] = $term->toparam();
77
+ }
78
+ $criteria["ids"] = SubscriptionSearch::ids()->in($ids)->toparam();
79
+ $path = $this->_config->merchantPath() . '/subscriptions/advanced_search';
80
+ $response = $this->_http->post($path, ['search' => $criteria]);
81
+
82
+ return Util::extractAttributeAsArray(
83
+ $response['subscriptions'],
84
+ 'subscription'
85
+ );
86
+ }
87
+
88
+ public function update($subscriptionId, $attributes)
89
+ {
90
+ Util::verifyKeys(self::_updateSignature(), $attributes);
91
+ $path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId;
92
+ $response = $this->_http->put($path, ['subscription' => $attributes]);
93
+ return $this->_verifyGatewayResponse($response);
94
+ }
95
+
96
+ public function retryCharge($subscriptionId, $amount = null)
97
+ {
98
+ $transaction_params = ['type' => Transaction::SALE,
99
+ 'subscriptionId' => $subscriptionId];
100
+ if (isset($amount)) {
101
+ $transaction_params['amount'] = $amount;
102
+ }
103
+
104
+ $path = $this->_config->merchantPath() . '/transactions';
105
+ $response = $this->_http->post($path, ['transaction' => $transaction_params]);
106
+ return $this->_verifyGatewayResponse($response);
107
+ }
108
+
109
+ public function cancel($subscriptionId)
110
+ {
111
+ $path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId . '/cancel';
112
+ $response = $this->_http->put($path);
113
+ return $this->_verifyGatewayResponse($response);
114
+ }
115
+
116
+ private static function _createSignature()
117
+ {
118
+ return array_merge(
119
+ [
120
+ 'billingDayOfMonth',
121
+ 'firstBillingDate',
122
+ 'createdAt',
123
+ 'updatedAt',
124
+ 'id',
125
+ 'merchantAccountId',
126
+ 'neverExpires',
127
+ 'numberOfBillingCycles',
128
+ 'paymentMethodToken',
129
+ 'paymentMethodNonce',
130
+ 'planId',
131
+ 'price',
132
+ 'trialDuration',
133
+ 'trialDurationUnit',
134
+ 'trialPeriod',
135
+ ['descriptor' => ['name', 'phone', 'url']],
136
+ ['options' => ['doNotInheritAddOnsOrDiscounts', 'startImmediately']],
137
+ ],
138
+ self::_addOnDiscountSignature()
139
+ );
140
+ }
141
+
142
+ private static function _updateSignature()
143
+ {
144
+ return array_merge(
145
+ [
146
+ 'merchantAccountId', 'numberOfBillingCycles', 'paymentMethodToken', 'planId',
147
+ 'paymentMethodNonce', 'id', 'neverExpires', 'price',
148
+ ['descriptor' => ['name', 'phone', 'url']],
149
+ ['options' => ['prorateCharges', 'replaceAllAddOnsAndDiscounts', 'revertSubscriptionOnProrationFailure']],
150
+ ],
151
+ self::_addOnDiscountSignature()
152
+ );
153
+ }
154
+
155
+ private static function _addOnDiscountSignature()
156
+ {
157
+ return [
158
+ [
159
+ 'addOns' => [
160
+ ['add' => ['amount', 'inheritedFromId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
161
+ ['update' => ['amount', 'existingId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
162
+ ['remove' => ['_anyKey_']],
163
+ ]
164
+ ],
165
+ [
166
+ 'discounts' => [
167
+ ['add' => ['amount', 'inheritedFromId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
168
+ ['update' => ['amount', 'existingId', 'neverExpires', 'numberOfBillingCycles', 'quantity']],
169
+ ['remove' => ['_anyKey_']],
170
+ ]
171
+ ]
172
+ ];
173
+ }
174
+
175
+ /**
176
+ * @ignore
177
+ */
178
+ private function _validateId($id = null) {
179
+ if (empty($id)) {
180
+ throw new InvalidArgumentException(
181
+ 'expected subscription id to be set'
182
+ );
183
+ }
184
+ if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
185
+ throw new InvalidArgumentException(
186
+ $id . ' is an invalid subscription id.'
187
+ );
188
+ }
189
+ }
190
+
191
+ /**
192
+ * @ignore
193
+ */
194
+ private function _verifyGatewayResponse($response)
195
+ {
196
+ if (isset($response['subscription'])) {
197
+ return new Result\Successful(
198
+ Subscription::factory($response['subscription'])
199
+ );
200
+ } else if (isset($response['transaction'])) {
201
+ // return a populated instance of Transaction, for subscription retryCharge
202
+ return new Result\Successful(
203
+ Transaction::factory($response['transaction'])
204
+ );
205
+ } else if (isset($response['apiErrorResponse'])) {
206
+ return new Result\Error($response['apiErrorResponse']);
207
+ } else {
208
+ throw new Exception\Unexpected(
209
+ "Expected subscription, transaction, or apiErrorResponse"
210
+ );
211
+ }
212
+ }
213
+ }
214
+ class_alias('Braintree\SubscriptionGateway', 'Braintree_SubscriptionGateway');
lib/Jmango360/Braintree/lib/Braintree/SubscriptionSearch.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class SubscriptionSearch
5
+ {
6
+ public static function billingCyclesRemaining()
7
+ {
8
+ return new RangeNode('billing_cycles_remaining');
9
+ }
10
+
11
+ public static function daysPastDue()
12
+ {
13
+ return new RangeNode('days_past_due');
14
+ }
15
+
16
+ public static function id()
17
+ {
18
+ return new TextNode('id');
19
+ }
20
+
21
+ public static function inTrialPeriod()
22
+ {
23
+ return new MultipleValueNode('in_trial_period', [true, false]);
24
+ }
25
+
26
+ public static function merchantAccountId()
27
+ {
28
+ return new MultipleValueNode('merchant_account_id');
29
+ }
30
+
31
+ public static function nextBillingDate()
32
+ {
33
+ return new RangeNode('next_billing_date');
34
+ }
35
+
36
+ public static function planId()
37
+ {
38
+ return new MultipleValueOrTextNode('plan_id');
39
+ }
40
+
41
+ public static function price()
42
+ {
43
+ return new RangeNode('price');
44
+ }
45
+
46
+ public static function status()
47
+ {
48
+ return new MultipleValueNode('status', [
49
+ Subscription::ACTIVE,
50
+ Subscription::CANCELED,
51
+ Subscription::EXPIRED,
52
+ Subscription::PAST_DUE,
53
+ Subscription::PENDING,
54
+ ]);
55
+ }
56
+
57
+ public static function transactionId()
58
+ {
59
+ return new TextNode('transaction_id');
60
+ }
61
+
62
+ public static function ids()
63
+ {
64
+ return new MultipleValueNode('ids');
65
+ }
66
+
67
+ public static function createdAt()
68
+ {
69
+ return new RangeNode('created_at');
70
+ }
71
+ }
72
+ class_alias('Braintree\SubscriptionSearch', 'Braintree_SubscriptionSearch');
lib/Jmango360/Braintree/lib/Braintree/Test/CreditCardNumbers.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ /**
5
+ * Credit card information used for testing purposes
6
+ *
7
+ * The constants contained in the Test\CreditCardNumbers class provide
8
+ * credit card numbers that should be used when working in the sandbox environment.
9
+ * The sandbox will not accept any credit card numbers other than the ones listed below.
10
+ *
11
+ * @package Braintree
12
+ * @subpackage Test
13
+ */
14
+ class CreditCardNumbers
15
+ {
16
+ public static $amExes = [
17
+ '378282246310005',
18
+ '371449635398431',
19
+ '378734493671000',
20
+ ];
21
+ public static $carteBlanches = ['30569309025904',];
22
+ public static $dinersClubs = ['38520000023237',];
23
+ public static $discoverCards = [
24
+ '6011111111111117',
25
+ '6011000990139424',
26
+ ];
27
+ public static $JCBs = [
28
+ '3530111333300000',
29
+ '3566002020360505',
30
+ ];
31
+
32
+ public static $masterCard = '5555555555554444';
33
+ public static $masterCardInternational = '5105105105105100';
34
+ public static $masterCards = [
35
+ '5105105105105100',
36
+ '5555555555554444',
37
+ ];
38
+
39
+ public static $visa = '4012888888881881';
40
+ public static $visaInternational = '4009348888881881';
41
+ public static $visas = [
42
+ '4009348888881881',
43
+ '4012888888881881',
44
+ '4111111111111111',
45
+ '4000111111111115',
46
+ ];
47
+
48
+ public static $unknowns = [
49
+ '1000000000000008',
50
+ ];
51
+
52
+ public static $failsSandboxVerification = [
53
+ 'AmEx' => '378734493671000',
54
+ 'Discover' => '6011000990139424',
55
+ 'MasterCard' => '5105105105105100',
56
+ 'Visa' => '4000111111111115',
57
+ ];
58
+
59
+ public static $amexPayWithPoints = [
60
+ 'Success' => "371260714673002",
61
+ 'IneligibleCard' => "378267515471109",
62
+ 'InsufficientPoints' => "371544868764018",
63
+ ];
64
+
65
+ public static function getAll()
66
+ {
67
+ return array_merge(
68
+ self::$amExes,
69
+ self::$discoverCards,
70
+ self::$masterCards,
71
+ self::$visas
72
+ );
73
+ }
74
+ }
75
+ class_alias('Braintree\Test\CreditCardNumbers', 'Braintree_Test_CreditCardNumbers');
lib/Jmango360/Braintree/lib/Braintree/Test/MerchantAccount.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ /**
5
+ * Merchant Account constants used for testing purposes
6
+ *
7
+ * @package Braintree
8
+ * @subpackage Test
9
+ */
10
+ class MerchantAccount
11
+ {
12
+ public static $approve = "approve_me";
13
+
14
+ public static $insufficientFundsContactUs = "insufficient_funds__contact";
15
+ public static $accountNotAuthorizedContactUs = "account_not_authorized__contact";
16
+ public static $bankRejectedUpdateFundingInformation = "bank_rejected__update";
17
+ public static $bankRejectedNone = "bank_rejected__none";
18
+
19
+
20
+ }
21
+ class_alias('Braintree\Test\MerchantAccount', 'Braintree_Test_MerchantAccount');
lib/Jmango360/Braintree/lib/Braintree/Test/Nonces.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ /**
5
+ * Nonces used for testing purposes
6
+ *
7
+ * @package Braintree
8
+ * @subpackage Test
9
+ */
10
+
11
+ /**
12
+ * Nonces used for testing purposes
13
+ *
14
+ * The constants in this class can be used to perform nonce operations
15
+ * with the desired status in the sandbox environment.
16
+ *
17
+ * @package Braintree
18
+ * @subpackage Test
19
+ */
20
+ class Nonces
21
+ {
22
+ public static $transactable = "fake-valid-nonce";
23
+ public static $consumed = "fake-consumed-nonce";
24
+ public static $paypalOneTimePayment = "fake-paypal-one-time-nonce";
25
+ public static $paypalFuturePayment = "fake-paypal-future-nonce";
26
+ public static $paypalBillingAgreement = "fake-paypal-billing-agreement-nonce";
27
+ public static $applePayVisa = "fake-apple-pay-visa-nonce";
28
+ public static $applePayMasterCard = "fake-apple-pay-visa-nonce";
29
+ public static $applePayAmEx = "fake-apple-pay-amex-nonce";
30
+ public static $androidPay = "fake-android-pay-nonce";
31
+ public static $androidPayDiscover = "fake-android-pay-discover-nonce";
32
+ public static $androidPayVisa = "fake-android-pay-visa-nonce";
33
+ public static $androidPayMasterCard = "fake-android-pay-mastercard-nonce";
34
+ public static $androidPayAmEx = "fake-android-pay-amex-nonce";
35
+ public static $amexExpressCheckout = "fake-amex-express-checkout-nonce";
36
+ public static $abstractTransactable = "fake-abstract-transactable-nonce";
37
+ public static $europe = "fake-europe-bank-account-nonce";
38
+ public static $coinbase = "fake-coinbase-nonce";
39
+ public static $transactableVisa = "fake-valid-visa-nonce";
40
+ public static $transactableAmEx = "fake-valid-amex-nonce";
41
+ public static $transactableMasterCard = "fake-valid-mastercard-nonce";
42
+ public static $transactableDiscover = "fake-valid-discover-nonce";
43
+ public static $transactableJCB = "fake-valid-jcb-nonce";
44
+ public static $transactableMaestro = "fake-valid-maestro-nonce";
45
+ public static $transactableDinersClub = "fake-valid-dinersclub-nonce";
46
+ public static $transactablePrepaid = "fake-valid-prepaid-nonce";
47
+ public static $transactableCommercial = "fake-valid-commercial-nonce";
48
+ public static $transactableDurbinRegulated = "fake-valid-durbin-regulated-nonce";
49
+ public static $transactableHealthcare = "fake-valid-healthcare-nonce";
50
+ public static $transactableDebit = "fake-valid-debit-nonce";
51
+ public static $transactablePayroll = "fake-valid-payroll-nonce";
52
+ public static $transactableNoIndicators = "fake-valid-no-indicators-nonce";
53
+ public static $transactableUnknownIndicators = "fake-valid-unknown-indicators-nonce";
54
+ public static $transactableCountryOfIssuanceUSA = "fake-valid-country-of-issuance-usa-nonce";
55
+ public static $transactableCountryOfIssuanceCAD = "fake-valid-country-of-issuance-cad-nonce";
56
+ public static $transactableIssuingBankNetworkOnly = "fake-valid-issuing-bank-network-only-nonce";
57
+ public static $processorDeclinedVisa = "fake-processor-declined-visa-nonce";
58
+ public static $processorDeclinedMasterCard = "fake-processor-declined-mastercard-nonce";
59
+ public static $processorDeclinedAmEx = "fake-processor-declined-amex-nonce";
60
+ public static $processorDeclinedDiscover = "fake-processor-declined-discover-nonce";
61
+ public static $processorFailureJCB = "fake-processor-failure-jcb-nonce";
62
+ public static $luhnInvalid = "fake-luhn-invalid-nonce";
63
+ public static $paypalFuturePaymentRefreshToken = "fake-paypal-future-refresh-token-nonce";
64
+ public static $sepa = "fake-sepa-bank-account-nonce";
65
+ public static $gatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce";
66
+ public static $venmoAccount = "fake-venmo-account-nonce";
67
+ public static $visaCheckoutAmEx = "fake-visa-checkout-amex-nonce";
68
+ public static $visaCheckoutDiscover = "fake-visa-checkout-discover-nonce";
69
+ public static $visaCheckoutMasterCard = "fake-visa-checkout-mastercard-nonce";
70
+ public static $visaCheckoutVisa = "fake-visa-checkout-visa-nonce";
71
+ public static $masterpassAmEx = "fake-masterpass-amex-nonce";
72
+ public static $masterpassDiscover = "fake-masterpass-discover-nonce";
73
+ public static $masterpassMasterCard = "fake-masterpass-mastercard-nonce";
74
+ public static $masterpassVisa = "fake-masterpass-visa-nonce";
75
+ }
76
+ class_alias('Braintree\Test\Nonces', 'Braintree_Test_Nonces');
lib/Jmango360/Braintree/lib/Braintree/Test/Transaction.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ use Braintree\Configuration;
5
+
6
+ /**
7
+ * Transaction amounts used for testing purposes
8
+ *
9
+ * The constants in this class can be used to create transactions with
10
+ * the desired status in the sandbox environment.
11
+ */
12
+ class Transaction
13
+ {
14
+ /**
15
+ * settle a transaction by id in sandbox
16
+ *
17
+ * @param string $id transaction id
18
+ * @param Configuration $config gateway config
19
+ * @return Transaction
20
+ */
21
+ public static function settle($transactionId)
22
+ {
23
+ return Configuration::gateway()->testing()->settle($transactionId);
24
+ }
25
+
26
+ /**
27
+ * settlement confirm a transaction by id in sandbox
28
+ *
29
+ * @param string $id transaction id
30
+ * @param Configuration $config gateway config
31
+ * @return Transaction
32
+ */
33
+ public static function settlementConfirm($transactionId)
34
+ {
35
+ return Configuration::gateway()->testing()->settlementConfirm($transactionId);
36
+ }
37
+
38
+ /**
39
+ * settlement decline a transaction by id in sandbox
40
+ *
41
+ * @param string $id transaction id
42
+ * @param Configuration $config gateway config
43
+ * @return Transaction
44
+ */
45
+ public static function settlementDecline($transactionId)
46
+ {
47
+ return Configuration::gateway()->testing()->settlementDecline($transactionId);
48
+ }
49
+
50
+ /**
51
+ * settlement pending a transaction by id in sandbox
52
+ *
53
+ * @param string $id transaction id
54
+ * @param Configuration $config gateway config
55
+ * @return Transaction
56
+ */
57
+ public static function settlementPending($transactionId)
58
+ {
59
+ return Configuration::gateway()->testing()->settlementPending($transactionId);
60
+ }
61
+ }
62
+ class_alias('Braintree\Test\Transaction', 'Braintree_Test_Transaction');
lib/Jmango360/Braintree/lib/Braintree/Test/TransactionAmounts.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ /**
5
+ * Transaction amounts used for testing purposes
6
+ *
7
+ * The constants in this class can be used to create transactions with
8
+ * the desired status in the sandbox environment.
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Test
12
+ */
13
+ class TransactionAmounts
14
+ {
15
+ public static $authorize = '1000.00';
16
+ public static $decline = '2000.00';
17
+ }
18
+ class_alias('Braintree\Test\TransactionAmounts', 'Braintree_Test_TransactionAmounts');
lib/Jmango360/Braintree/lib/Braintree/Test/VenmoSdk.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Test;
3
+
4
+ /**
5
+ * VenmoSdk payment method codes used for testing purposes
6
+ *
7
+ * @package Braintree
8
+ * @subpackage Test
9
+ */
10
+ class VenmoSdk
11
+ {
12
+ public static $visaPaymentMethodCode = "stub-4111111111111111";
13
+
14
+ public static function generateTestPaymentMethodCode($number) {
15
+ return "stub-" . $number;
16
+ }
17
+
18
+ public static function getInvalidPaymentMethodCode() {
19
+ return "stub-invalid-payment-method-code";
20
+ }
21
+
22
+ public static function getTestSession() {
23
+ return "stub-session";
24
+ }
25
+
26
+ public static function getInvalidTestSession() {
27
+ return "stub-invalid-session";
28
+ }
29
+ }
30
+ class_alias('Braintree\Test\VenmoSdk', 'Braintree_Test_VenmoSdk');
lib/Jmango360/Braintree/lib/Braintree/TestingGateway.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class TestingGateway
5
+ {
6
+ private $_gateway;
7
+ private $_config;
8
+ private $_http;
9
+
10
+ public function __construct($gateway)
11
+ {
12
+ $this->_gateway = $gateway;
13
+ $this->_config = $gateway->config;
14
+ $this->_http = new Http($this->_config);
15
+ }
16
+
17
+ public function settle($transactionId)
18
+ {
19
+ return self::_doTestRequest('/settle', $transactionId);
20
+ }
21
+
22
+ public function settlementPending($transactionId)
23
+ {
24
+ return self::_doTestRequest('/settlement_pending', $transactionId);
25
+ }
26
+
27
+ public function settlementConfirm($transactionId)
28
+ {
29
+ return self::_doTestRequest('/settlement_confirm', $transactionId);
30
+ }
31
+
32
+ public function settlementDecline($transactionId)
33
+ {
34
+ return self::_doTestRequest('/settlement_decline', $transactionId);
35
+ }
36
+
37
+ private function _doTestRequest($testPath, $transactionId)
38
+ {
39
+ self::_checkEnvironment();
40
+ $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . $testPath;
41
+ $response = $this->_http->put($path);
42
+ return Transaction::factory($response['transaction']);
43
+ }
44
+
45
+ private function _checkEnvironment()
46
+ {
47
+ if (Configuration::$global->getEnvironment() === 'production') {
48
+ throw new Exception\TestOperationPerformedInProduction();
49
+ }
50
+ }
51
+ }
52
+ class_alias('Braintree\TestingGateway', 'Braintree_TestingGateway');
lib/Jmango360/Braintree/lib/Braintree/TextNode.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class TextNode extends PartialMatchNode
5
+ {
6
+ public function contains($value)
7
+ {
8
+ $this->searchTerms["contains"] = strval($value);
9
+ return $this;
10
+ }
11
+ }
12
+ class_alias('Braintree\TextNode', 'Braintree_TextNode');
lib/Jmango360/Braintree/lib/Braintree/ThreeDSecureInfo.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class ThreeDSecureInfo extends Base
5
+ {
6
+ public static function factory($attributes)
7
+ {
8
+ $instance = new self();
9
+ $instance->_initialize($attributes);
10
+
11
+ return $instance;
12
+ }
13
+
14
+ protected function _initialize($attributes)
15
+ {
16
+ $this->_attributes = $attributes;
17
+ }
18
+
19
+ /**
20
+ * returns a string representation of the three d secure info
21
+ * @return string
22
+ */
23
+ public function __toString()
24
+ {
25
+ return __CLASS__ . '[' .
26
+ Util::attributesToString($this->_attributes) .']';
27
+ }
28
+
29
+ }
30
+ class_alias('Braintree\ThreeDSecureInfo', 'Braintree_ThreeDSecureInfo');
lib/Jmango360/Braintree/lib/Braintree/Transaction.php ADDED
@@ -0,0 +1,596 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Transaction processor
6
+ * Creates and manages transactions
7
+ *
8
+ * At minimum, an amount, credit card number, and
9
+ * credit card expiration date are required.
10
+ *
11
+ * <b>Minimalistic example:</b>
12
+ * <code>
13
+ * Transaction::saleNoValidate(array(
14
+ * 'amount' => '100.00',
15
+ * 'creditCard' => array(
16
+ * 'number' => '5105105105105100',
17
+ * 'expirationDate' => '05/12',
18
+ * ),
19
+ * ));
20
+ * </code>
21
+ *
22
+ * <b>Full example:</b>
23
+ * <code>
24
+ * Transaction::saleNoValidate(array(
25
+ * 'amount' => '100.00',
26
+ * 'orderId' => '123',
27
+ * 'channel' => 'MyShoppingCardProvider',
28
+ * 'creditCard' => array(
29
+ * // if token is omitted, the gateway will generate a token
30
+ * 'token' => 'credit_card_123',
31
+ * 'number' => '5105105105105100',
32
+ * 'expirationDate' => '05/2011',
33
+ * 'cvv' => '123',
34
+ * ),
35
+ * 'customer' => array(
36
+ * // if id is omitted, the gateway will generate an id
37
+ * 'id' => 'customer_123',
38
+ * 'firstName' => 'Dan',
39
+ * 'lastName' => 'Smith',
40
+ * 'company' => 'Braintree',
41
+ * 'email' => 'dan@example.com',
42
+ * 'phone' => '419-555-1234',
43
+ * 'fax' => '419-555-1235',
44
+ * 'website' => 'http://braintreepayments.com'
45
+ * ),
46
+ * 'billing' => array(
47
+ * 'firstName' => 'Carl',
48
+ * 'lastName' => 'Jones',
49
+ * 'company' => 'Braintree',
50
+ * 'streetAddress' => '123 E Main St',
51
+ * 'extendedAddress' => 'Suite 403',
52
+ * 'locality' => 'Chicago',
53
+ * 'region' => 'IL',
54
+ * 'postalCode' => '60622',
55
+ * 'countryName' => 'United States of America'
56
+ * ),
57
+ * 'shipping' => array(
58
+ * 'firstName' => 'Andrew',
59
+ * 'lastName' => 'Mason',
60
+ * 'company' => 'Braintree',
61
+ * 'streetAddress' => '456 W Main St',
62
+ * 'extendedAddress' => 'Apt 2F',
63
+ * 'locality' => 'Bartlett',
64
+ * 'region' => 'IL',
65
+ * 'postalCode' => '60103',
66
+ * 'countryName' => 'United States of America'
67
+ * ),
68
+ * 'customFields' => array(
69
+ * 'birthdate' => '11/13/1954'
70
+ * )
71
+ * )
72
+ * </code>
73
+ *
74
+ * <b>== Storing in the Vault ==</b>
75
+ *
76
+ * The customer and credit card information used for
77
+ * a transaction can be stored in the vault by setting
78
+ * <i>transaction[options][storeInVault]</i> to true.
79
+ * <code>
80
+ * $transaction = Transaction::saleNoValidate(array(
81
+ * 'customer' => array(
82
+ * 'firstName' => 'Adam',
83
+ * 'lastName' => 'Williams'
84
+ * ),
85
+ * 'creditCard' => array(
86
+ * 'number' => '5105105105105100',
87
+ * 'expirationDate' => '05/2012'
88
+ * ),
89
+ * 'options' => array(
90
+ * 'storeInVault' => true
91
+ * )
92
+ * ));
93
+ *
94
+ * echo $transaction->customerDetails->id
95
+ * // '865534'
96
+ * echo $transaction->creditCardDetails->token
97
+ * // '6b6m'
98
+ * </code>
99
+ *
100
+ * To also store the billing address in the vault, pass the
101
+ * <b>addBillingAddressToPaymentMethod</b> option.
102
+ * <code>
103
+ * Transaction.saleNoValidate(array(
104
+ * ...
105
+ * 'options' => array(
106
+ * 'storeInVault' => true
107
+ * 'addBillingAddressToPaymentMethod' => true
108
+ * )
109
+ * ));
110
+ * </code>
111
+ *
112
+ * <b>== Submitting for Settlement==</b>
113
+ *
114
+ * This can only be done when the transction's
115
+ * status is <b>authorized</b>. If <b>amount</b> is not specified,
116
+ * the full authorized amount will be settled. If you would like to settle
117
+ * less than the full authorized amount, pass the desired amount.
118
+ * You cannot settle more than the authorized amount.
119
+ *
120
+ * A transaction can be submitted for settlement when created by setting
121
+ * $transaction[options][submitForSettlement] to true.
122
+ *
123
+ * <code>
124
+ * $transaction = Transaction::saleNoValidate(array(
125
+ * 'amount' => '100.00',
126
+ * 'creditCard' => array(
127
+ * 'number' => '5105105105105100',
128
+ * 'expirationDate' => '05/2012'
129
+ * ),
130
+ * 'options' => array(
131
+ * 'submitForSettlement' => true
132
+ * )
133
+ * ));
134
+ * </code>
135
+ *
136
+ * <b>== More information ==</b>
137
+ *
138
+ * For more detailed information on Transactions, see {@link http://www.braintreepayments.com/gateway/transaction-api http://www.braintreepaymentsolutions.com/gateway/transaction-api}
139
+ *
140
+ * @package Braintree
141
+ * @category Resources
142
+ *
143
+ *
144
+ * @property-read string $avsErrorResponseCode
145
+ * @property-read string $avsPostalCodeResponseCode
146
+ * @property-read string $avsStreetAddressResponseCode
147
+ * @property-read string $cvvResponseCode
148
+ * @property-read string $id transaction id
149
+ * @property-read string $amount transaction amount
150
+ * @property-read Braintree\Transaction\AddressDetails $billingDetails transaction billing address
151
+ * @property-read \DateTime $createdAt transaction created DateTime
152
+ * @property-read Braintree\ApplePayCardDetails $applePayCardDetails transaction Apple Pay card info
153
+ * @property-read Braintree\AndroidPayCardDetails $androidPayCardDetails transaction Android Pay card info
154
+ * @property-read Braintree\AmexExpressCheckoutCardDetails $amexExpressCheckoutCardDetails transaction Amex Express Checkout card info
155
+ * @property-read Braintree\CreditCardDetails $creditCardDetails transaction credit card info
156
+ * @property-read Braintree\CoinbaseDetails $coinbaseDetails transaction Coinbase account info
157
+ * @property-read Braintree\MasterpassCardDetails $masterpassCardDetails transaction Masterpass card info
158
+ * @property-read Braintree\PayPalDetails $paypalDetails transaction paypal account info
159
+ * @property-read Braintree\Transaction\CustomerDetails $customerDetails transaction customer info
160
+ * @property-read Braintree\VenmoAccount $venmoAccountDetails transaction Venmo Account info
161
+ * @property-read Braintree\IdealPayment $idealPaymentDetails transaction Ideal Payment info
162
+ * @property-read Braintree\VisaCheckoutCardDetails $visaCheckoutCardDetails transaction Visa Checkout card info
163
+ * @property-read array $customFields custom fields passed with the request
164
+ * @property-read string $processorResponseCode gateway response code
165
+ * @property-read string $additionalProcessorResponse raw response from processor
166
+ * @property-read Braintree\Transaction\AddressDetails $shippingDetails transaction shipping address
167
+ * @property-read string $status transaction status
168
+ * @property-read array $statusHistory array of StatusDetails objects
169
+ * @property-read string $type transaction type
170
+ * @property-read \DateTime $updatedAt transaction updated DateTime
171
+ * @property-read Braintree\Disbursement $disbursementDetails populated when transaction is disbursed
172
+ * @property-read Braintree\Dispute $disputes populated when transaction is disputed
173
+ *
174
+ */
175
+
176
+ class Transaction extends Base
177
+ {
178
+ // Transaction Status
179
+ const AUTHORIZATION_EXPIRED = 'authorization_expired';
180
+ const AUTHORIZING = 'authorizing';
181
+ const AUTHORIZED = 'authorized';
182
+ const GATEWAY_REJECTED = 'gateway_rejected';
183
+ const FAILED = 'failed';
184
+ const PROCESSOR_DECLINED = 'processor_declined';
185
+ const SETTLED = 'settled';
186
+ const SETTLING = 'settling';
187
+ const SUBMITTED_FOR_SETTLEMENT = 'submitted_for_settlement';
188
+ const VOIDED = 'voided';
189
+ const UNRECOGNIZED = 'unrecognized';
190
+ const SETTLEMENT_DECLINED = 'settlement_declined';
191
+ const SETTLEMENT_PENDING = 'settlement_pending';
192
+ const SETTLEMENT_CONFIRMED = 'settlement_confirmed';
193
+
194
+ // Transaction Escrow Status
195
+ const ESCROW_HOLD_PENDING = 'hold_pending';
196
+ const ESCROW_HELD = 'held';
197
+ const ESCROW_RELEASE_PENDING = 'release_pending';
198
+ const ESCROW_RELEASED = 'released';
199
+ const ESCROW_REFUNDED = 'refunded';
200
+
201
+ // Transaction Types
202
+ const SALE = 'sale';
203
+ const CREDIT = 'credit';
204
+
205
+ // Transaction Created Using
206
+ const FULL_INFORMATION = 'full_information';
207
+ const TOKEN = 'token';
208
+
209
+ // Transaction Sources
210
+ const API = 'api';
211
+ const CONTROL_PANEL = 'control_panel';
212
+ const RECURRING = 'recurring';
213
+
214
+ // Gateway Rejection Reason
215
+ const AVS = 'avs';
216
+ const AVS_AND_CVV = 'avs_and_cvv';
217
+ const CVV = 'cvv';
218
+ const DUPLICATE = 'duplicate';
219
+ const FRAUD = 'fraud';
220
+ const THREE_D_SECURE = 'three_d_secure';
221
+ const APPLICATION_INCOMPLETE = 'application_incomplete';
222
+
223
+ // Industry Types
224
+ const LODGING_INDUSTRY = 'lodging';
225
+ const TRAVEL_AND_CRUISE_INDUSTRY = 'travel_cruise';
226
+
227
+ /**
228
+ * sets instance properties from an array of values
229
+ *
230
+ * @ignore
231
+ * @access protected
232
+ * @param array $transactionAttribs array of transaction data
233
+ * @return void
234
+ */
235
+ protected function _initialize($transactionAttribs)
236
+ {
237
+ $this->_attributes = $transactionAttribs;
238
+
239
+ if (isset($transactionAttribs['applePay'])) {
240
+ $this->_set('applePayCardDetails',
241
+ new Transaction\ApplePayCardDetails(
242
+ $transactionAttribs['applePay']
243
+ )
244
+ );
245
+ }
246
+
247
+ if (isset($transactionAttribs['androidPayCard'])) {
248
+ $this->_set('androidPayCardDetails',
249
+ new Transaction\AndroidPayCardDetails(
250
+ $transactionAttribs['androidPayCard']
251
+ )
252
+ );
253
+ }
254
+
255
+ if (isset($transactionAttribs['masterpassCard'])) {
256
+ $this->_set('masterpassCardDetails',
257
+ new Transaction\MasterpassCardDetails(
258
+ $transactionAttribs['masterpassCard']
259
+ )
260
+ );
261
+ }
262
+
263
+ if (isset($transactionAttribs['visaCheckoutCard'])) {
264
+ $this->_set('visaCheckoutCardDetails',
265
+ new Transaction\VisaCheckoutCardDetails(
266
+ $transactionAttribs['visaCheckoutCard']
267
+ )
268
+ );
269
+ }
270
+
271
+ if (isset($transactionAttribs['amexExpressCheckoutCard'])) {
272
+ $this->_set('amexExpressCheckoutCardDetails',
273
+ new Transaction\AmexExpressCheckoutCardDetails(
274
+ $transactionAttribs['amexExpressCheckoutCard']
275
+ )
276
+ );
277
+ }
278
+
279
+ if (isset($transactionAttribs['venmoAccount'])) {
280
+ $this->_set('venmoAccountDetails',
281
+ new Transaction\VenmoAccountDetails(
282
+ $transactionAttribs['venmoAccount']
283
+ )
284
+ );
285
+ }
286
+
287
+ if (isset($transactionAttribs['creditCard'])) {
288
+ $this->_set('creditCardDetails',
289
+ new Transaction\CreditCardDetails(
290
+ $transactionAttribs['creditCard']
291
+ )
292
+ );
293
+ }
294
+
295
+ if (isset($transactionAttribs['coinbaseAccount'])) {
296
+ $this->_set('coinbaseDetails',
297
+ new Transaction\CoinbaseDetails(
298
+ $transactionAttribs['coinbaseAccount']
299
+ )
300
+ );
301
+ }
302
+
303
+ if (isset($transactionAttribs['europeBankAccount'])) {
304
+ $this->_set('europeBankAccount',
305
+ new Transaction\EuropeBankAccountDetails(
306
+ $transactionAttribs['europeBankAccount']
307
+ )
308
+ );
309
+ }
310
+
311
+ if (isset($transactionAttribs['usBankAccount'])) {
312
+ $this->_set('usBankAccount',
313
+ new Transaction\UsBankAccountDetails(
314
+ $transactionAttribs['usBankAccount']
315
+ )
316
+ );
317
+ }
318
+
319
+ if (isset($transactionAttribs['idealPayment'])) {
320
+ $this->_set('idealPayment',
321
+ new Transaction\IdealPaymentDetails(
322
+ $transactionAttribs['idealPayment']
323
+ )
324
+ );
325
+ }
326
+
327
+ if (isset($transactionAttribs['paypal'])) {
328
+ $this->_set('paypalDetails',
329
+ new Transaction\PayPalDetails(
330
+ $transactionAttribs['paypal']
331
+ )
332
+ );
333
+ }
334
+
335
+ if (isset($transactionAttribs['customer'])) {
336
+ $this->_set('customerDetails',
337
+ new Transaction\CustomerDetails(
338
+ $transactionAttribs['customer']
339
+ )
340
+ );
341
+ }
342
+
343
+ if (isset($transactionAttribs['billing'])) {
344
+ $this->_set('billingDetails',
345
+ new Transaction\AddressDetails(
346
+ $transactionAttribs['billing']
347
+ )
348
+ );
349
+ }
350
+
351
+ if (isset($transactionAttribs['shipping'])) {
352
+ $this->_set('shippingDetails',
353
+ new Transaction\AddressDetails(
354
+ $transactionAttribs['shipping']
355
+ )
356
+ );
357
+ }
358
+
359
+ if (isset($transactionAttribs['subscription'])) {
360
+ $this->_set('subscriptionDetails',
361
+ new Transaction\SubscriptionDetails(
362
+ $transactionAttribs['subscription']
363
+ )
364
+ );
365
+ }
366
+
367
+ if (isset($transactionAttribs['descriptor'])) {
368
+ $this->_set('descriptor',
369
+ new Descriptor(
370
+ $transactionAttribs['descriptor']
371
+ )
372
+ );
373
+ }
374
+
375
+ if (isset($transactionAttribs['disbursementDetails'])) {
376
+ $this->_set('disbursementDetails',
377
+ new DisbursementDetails($transactionAttribs['disbursementDetails'])
378
+ );
379
+ }
380
+
381
+ $disputes = [];
382
+ if (isset($transactionAttribs['disputes'])) {
383
+ foreach ($transactionAttribs['disputes'] AS $dispute) {
384
+ $disputes[] = Dispute::factory($dispute);
385
+ }
386
+ }
387
+
388
+ $this->_set('disputes', $disputes);
389
+
390
+ $statusHistory = [];
391
+ if (isset($transactionAttribs['statusHistory'])) {
392
+ foreach ($transactionAttribs['statusHistory'] AS $history) {
393
+ $statusHistory[] = new Transaction\StatusDetails($history);
394
+ }
395
+ }
396
+
397
+ $this->_set('statusHistory', $statusHistory);
398
+
399
+ $addOnArray = [];
400
+ if (isset($transactionAttribs['addOns'])) {
401
+ foreach ($transactionAttribs['addOns'] AS $addOn) {
402
+ $addOnArray[] = AddOn::factory($addOn);
403
+ }
404
+ }
405
+ $this->_set('addOns', $addOnArray);
406
+
407
+ $discountArray = [];
408
+ if (isset($transactionAttribs['discounts'])) {
409
+ foreach ($transactionAttribs['discounts'] AS $discount) {
410
+ $discountArray[] = Discount::factory($discount);
411
+ }
412
+ }
413
+ $this->_set('discounts', $discountArray);
414
+
415
+ if(isset($transactionAttribs['riskData'])) {
416
+ $this->_set('riskData', RiskData::factory($transactionAttribs['riskData']));
417
+ }
418
+ if(isset($transactionAttribs['threeDSecureInfo'])) {
419
+ $this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($transactionAttribs['threeDSecureInfo']));
420
+ }
421
+ if(isset($transactionAttribs['facilitatorDetails'])) {
422
+ $this->_set('facilitatorDetails', FacilitatorDetails::factory($transactionAttribs['facilitatorDetails']));
423
+ }
424
+ }
425
+
426
+ /**
427
+ * returns a string representation of the transaction
428
+ * @return string
429
+ */
430
+ public function __toString()
431
+ {
432
+ // array of attributes to print
433
+ $display = [
434
+ 'id', 'type', 'amount', 'status',
435
+ 'createdAt', 'creditCardDetails', 'customerDetails'
436
+ ];
437
+
438
+ $displayAttributes = [];
439
+ foreach ($display AS $attrib) {
440
+ $displayAttributes[$attrib] = $this->$attrib;
441
+ }
442
+ return __CLASS__ . '[' .
443
+ Util::attributesToString($displayAttributes) .']';
444
+ }
445
+
446
+ public function isEqual($otherTx)
447
+ {
448
+ return $this->id === $otherTx->id;
449
+ }
450
+
451
+ public function vaultCreditCard()
452
+ {
453
+ $token = $this->creditCardDetails->token;
454
+ if (empty($token)) {
455
+ return null;
456
+ }
457
+ else {
458
+ return CreditCard::find($token);
459
+ }
460
+ }
461
+
462
+ /** @return void|Braintree\Customer */
463
+ public function vaultCustomer()
464
+ {
465
+ $customerId = $this->customerDetails->id;
466
+ if (empty($customerId)) {
467
+ return null;
468
+ }
469
+ else {
470
+ return Customer::find($customerId);
471
+ }
472
+ }
473
+
474
+ /** @return bool */
475
+ public function isDisbursed() {
476
+ return $this->disbursementDetails->isValid();
477
+ }
478
+
479
+ /**
480
+ * factory method: returns an instance of Transaction
481
+ * to the requesting method, with populated properties
482
+ *
483
+ * @ignore
484
+ * @return Transaction
485
+ */
486
+ public static function factory($attributes)
487
+ {
488
+ $instance = new self();
489
+ $instance->_initialize($attributes);
490
+ return $instance;
491
+ }
492
+
493
+
494
+ // static methods redirecting to gateway
495
+
496
+ public static function cloneTransaction($transactionId, $attribs)
497
+ {
498
+ return Configuration::gateway()->transaction()->cloneTransaction($transactionId, $attribs);
499
+ }
500
+
501
+ public static function createFromTransparentRedirect($queryString)
502
+ {
503
+ return Configuration::gateway()->transaction()->createFromTransparentRedirect($queryString);
504
+ }
505
+
506
+ public static function createTransactionUrl()
507
+ {
508
+ return Configuration::gateway()->transaction()->createTransactionUrl();
509
+ }
510
+
511
+ public static function credit($attribs)
512
+ {
513
+ return Configuration::gateway()->transaction()->credit($attribs);
514
+ }
515
+
516
+ public static function creditNoValidate($attribs)
517
+ {
518
+ return Configuration::gateway()->transaction()->creditNoValidate($attribs);
519
+ }
520
+
521
+ public static function find($id)
522
+ {
523
+ return Configuration::gateway()->transaction()->find($id);
524
+ }
525
+
526
+ public static function sale($attribs)
527
+ {
528
+ return Configuration::gateway()->transaction()->sale($attribs);
529
+ }
530
+
531
+ public static function saleNoValidate($attribs)
532
+ {
533
+ return Configuration::gateway()->transaction()->saleNoValidate($attribs);
534
+ }
535
+
536
+ public static function search($query)
537
+ {
538
+ return Configuration::gateway()->transaction()->search($query);
539
+ }
540
+
541
+ public static function fetch($query, $ids)
542
+ {
543
+ return Configuration::gateway()->transaction()->fetch($query, $ids);
544
+ }
545
+
546
+ public static function void($transactionId)
547
+ {
548
+ return Configuration::gateway()->transaction()->void($transactionId);
549
+ }
550
+
551
+ public static function voidNoValidate($transactionId)
552
+ {
553
+ return Configuration::gateway()->transaction()->voidNoValidate($transactionId);
554
+ }
555
+
556
+ public static function submitForSettlement($transactionId, $amount = null, $attribs = [])
557
+ {
558
+ return Configuration::gateway()->transaction()->submitForSettlement($transactionId, $amount, $attribs);
559
+ }
560
+
561
+ public static function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
562
+ {
563
+ return Configuration::gateway()->transaction()->submitForSettlementNoValidate($transactionId, $amount, $attribs);
564
+ }
565
+
566
+ public static function updateDetails($transactionId, $attribs = [])
567
+ {
568
+ return Configuration::gateway()->transaction()->updateDetails($transactionId, $attribs);
569
+ }
570
+
571
+ public static function submitForPartialSettlement($transactionId, $amount, $attribs = [])
572
+ {
573
+ return Configuration::gateway()->transaction()->submitForPartialSettlement($transactionId, $amount, $attribs);
574
+ }
575
+
576
+ public static function holdInEscrow($transactionId)
577
+ {
578
+ return Configuration::gateway()->transaction()->holdInEscrow($transactionId);
579
+ }
580
+
581
+ public static function releaseFromEscrow($transactionId)
582
+ {
583
+ return Configuration::gateway()->transaction()->releaseFromEscrow($transactionId);
584
+ }
585
+
586
+ public static function cancelRelease($transactionId)
587
+ {
588
+ return Configuration::gateway()->transaction()->cancelRelease($transactionId);
589
+ }
590
+
591
+ public static function refund($transactionId, $amount = null)
592
+ {
593
+ return Configuration::gateway()->transaction()->refund($transactionId, $amount);
594
+ }
595
+ }
596
+ class_alias('Braintree\Transaction', 'Braintree_Transaction');
lib/Jmango360/Braintree/lib/Braintree/Transaction/AddressDetails.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Creates an instance of AddressDetails as returned from a transaction
8
+ *
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $firstName
14
+ * @property-read string $lastName
15
+ * @property-read string $company
16
+ * @property-read string $streetAddress
17
+ * @property-read string $extendedAddress
18
+ * @property-read string $locality
19
+ * @property-read string $region
20
+ * @property-read string $postalCode
21
+ * @property-read string $countryName
22
+ */
23
+ class AddressDetails extends Instance
24
+ {
25
+ protected $_attributes = [];
26
+ }
27
+ class_alias('Braintree\Transaction\AddressDetails', 'Braintree_Transaction_AddressDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/AmexExpressCheckoutCardDetails.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+ /**
6
+ * Amex Express Checkout card details from a transaction
7
+ *
8
+ * @package Braintree
9
+ * @subpackage Transaction
10
+ */
11
+
12
+ /**
13
+ * creates an instance of AmexExpressCheckoutCardDetails
14
+ *
15
+ *
16
+ * @package Braintree
17
+ * @subpackage Transaction
18
+ *
19
+ * @property-read string $cardType
20
+ * @property-read string $bin
21
+ * @property-read string $cardMemberExpiryDate
22
+ * @property-read string $cardMemberNumber
23
+ * @property-read string $cardType
24
+ * @property-read string $sourceDescription
25
+ * @property-read string $token
26
+ * @property-read string $imageUrl
27
+ * @property-read string $expirationMonth
28
+ * @property-read string $expirationYear
29
+ * @uses Instance inherits methods
30
+ */
31
+ class AmexExpressCheckoutCardDetails extends Instance
32
+ {
33
+ protected $_attributes = [];
34
+
35
+ /**
36
+ * @ignore
37
+ */
38
+ public function __construct($attributes)
39
+ {
40
+ parent::__construct($attributes);
41
+ }
42
+ }
43
+ class_alias('Braintree\Transaction\AmexExpressCheckoutCardDetails', 'Braintree_Transaction_AmexExpressCheckoutCardDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/AndroidPayCardDetails.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Android Pay card details from a transaction
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Transaction
11
+ */
12
+
13
+ /**
14
+ * creates an instance of AndroidPayCardDetails
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @subpackage Transaction
19
+ *
20
+ * @property-read string $bin
21
+ * @property-read string $default
22
+ * @property-read string $expirationMonth
23
+ * @property-read string $expirationYear
24
+ * @property-read string $googleTransactionId
25
+ * @property-read string $imageUrl
26
+ * @property-read string $sourceCardLast4
27
+ * @property-read string $sourceCardType
28
+ * @property-read string $sourceDescription
29
+ * @property-read string $token
30
+ * @property-read string $virtualCardLast4
31
+ * @property-read string $virtualCardType
32
+ */
33
+ class AndroidPayCardDetails extends Instance
34
+ {
35
+ protected $_attributes = [];
36
+
37
+ /**
38
+ * @ignore
39
+ */
40
+ public function __construct($attributes)
41
+ {
42
+ parent::__construct($attributes);
43
+ $this->_attributes['cardType'] = $this->virtualCardType;
44
+ $this->_attributes['last4'] = $this->virtualCardLast4;
45
+ }
46
+ }
47
+ class_alias('Braintree\Transaction\AndroidPayCardDetails', 'Braintree_Transaction_AndroidPayCardDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/ApplePayCardDetails.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Apple Pay card details from a transaction
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Transaction
11
+ */
12
+
13
+ /**
14
+ * creates an instance of ApplePayCardDetails
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @subpackage Transaction
19
+ *
20
+ * @property-read string $cardType
21
+ * @property-read string $paymentInstrumentName
22
+ * @property-read string $expirationMonth
23
+ * @property-read string $expirationYear
24
+ * @property-read string $cardholderName
25
+ * @property-read string $sourceDescription
26
+ */
27
+ class ApplePayCardDetails extends Instance
28
+ {
29
+ protected $_attributes = [];
30
+
31
+ /**
32
+ * @ignore
33
+ */
34
+ public function __construct($attributes)
35
+ {
36
+ parent::__construct($attributes);
37
+ }
38
+ }
39
+ class_alias('Braintree\Transaction\ApplePayCardDetails', 'Braintree_Transaction_ApplePayCardDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/CoinbaseDetails.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Coinbase details from a transaction
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Transaction
11
+ */
12
+
13
+ /**
14
+ * creates an instance of Coinbase
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @subpackage Transaction
19
+ *
20
+ * @property-read string $token
21
+ * @property-read string $userId
22
+ * @property-read string $userName
23
+ * @property-read string $userEmail
24
+ * @property-read string $imageUrl
25
+ */
26
+ class CoinbaseDetails extends Instance
27
+ {
28
+ protected $_attributes = [];
29
+
30
+ /**
31
+ * @ignore
32
+ */
33
+ public function __construct($attributes)
34
+ {
35
+ parent::__construct($attributes);
36
+ }
37
+ }
38
+ class_alias('Braintree\Transaction\CoinbaseDetails', 'Braintree_Transaction_CoinbaseDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/CreditCardDetails.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * CreditCard details from a transaction
8
+ * creates an instance of CreditCardDetails
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $bin
14
+ * @property-read string $cardType
15
+ * @property-read string $expirationDate
16
+ * @property-read string $expirationMonth
17
+ * @property-read string $expirationYear
18
+ * @property-read string $issuerLocation
19
+ * @property-read string $last4
20
+ * @property-read string $maskedNumber
21
+ * @property-read string $token
22
+ */
23
+ class CreditCardDetails extends Instance
24
+ {
25
+ protected $_attributes = [];
26
+
27
+ /**
28
+ * @ignore
29
+ */
30
+ public function __construct($attributes)
31
+ {
32
+ parent::__construct($attributes);
33
+ $this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
34
+ $this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
35
+
36
+ }
37
+ }
38
+ class_alias('Braintree\Transaction\CreditCardDetails', 'Braintree_Transaction_CreditCardDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/CustomerDetails.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Customer details from a transaction
8
+ * Creates an instance of customer details as returned from a transaction
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $company
14
+ * @property-read string $email
15
+ * @property-read string $fax
16
+ * @property-read string $firstName
17
+ * @property-read string $id
18
+ * @property-read string $lastName
19
+ * @property-read string $phone
20
+ * @property-read string $website
21
+ */
22
+ class CustomerDetails extends Instance
23
+ {
24
+ }
25
+ class_alias('Braintree\Transaction\CustomerDetails', 'Braintree_Transaction_CustomerDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/EuropeBankAccountDetails.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Europe bank account details from a transaction
8
+ * Creates an instance of europe bank account details as returned from a transaction
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $accountHolderName
14
+ * @property-read string $bic
15
+ * @property-read string $imageUrl
16
+ * @property-read string $mandateAcceptedAt
17
+ * @property-read string $mandateReferenceNumber
18
+ * @property-read string $maskedIban
19
+ * @property-read string $token
20
+ */
21
+ class EuropeBankAccountDetails extends Instance
22
+ {
23
+ }
24
+ class_alias('Braintree\Transaction\EuropeBankAccountDetails', 'Braintree_Transaction_EuropeBankAccountDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/IdealPaymentDetails.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * iDEAL payment details from a transaction
8
+ * creates an instance of IdealPaymentDetails
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $idealPaymentId
14
+ * @property-read string $idealTransactionId
15
+ * @property-read string $imageUrl
16
+ * @property-read string $maskedIban
17
+ * @property-read string $bic
18
+ */
19
+ class IdealPaymentDetails extends Instance
20
+ {
21
+ protected $_attributes = [];
22
+ }
23
+ class_alias('Braintree\Transaction\IdealPaymentDetails', 'Braintree_Transaction_IdealPaymentDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/MasterpassCardDetails.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * MasterpassCard details from a transaction
8
+ * creates an instance of MasterpassCardDetails
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $bin
14
+ * @property-read string $callId
15
+ * @property-read string $cardholderName
16
+ * @property-read string $commercial
17
+ * @property-read string $countryOfIssuance
18
+ * @property-read string $customerId
19
+ * @property-read string $customerLocation
20
+ * @property-read string $debit
21
+ * @property-read string $durbinRegulated
22
+ * @property-read string $expirationDate
23
+ * @property-read string $expirationMonth
24
+ * @property-read string $expirationYear
25
+ * @property-read string $healthcare
26
+ * @property-read string $imageUrl
27
+ * @property-read string $issuingBank
28
+ * @property-read string $last4
29
+ * @property-read string $maskedNumber
30
+ * @property-read string $payroll
31
+ * @property-read string $prepaid
32
+ * @property-read string $productId
33
+ * @property-read string $token
34
+ * @property-read string $updatedAt
35
+ */
36
+ class MasterpassCardDetails extends Instance
37
+ {
38
+ protected $_attributes = [];
39
+
40
+ /**
41
+ * @ignore
42
+ */
43
+ public function __construct($attributes)
44
+ {
45
+ parent::__construct($attributes);
46
+ $this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
47
+ $this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
48
+
49
+ }
50
+ }
51
+ class_alias('Braintree\Transaction\MasterpassCardDetails', 'Braintree_Transaction_MasterpassCardDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/PayPalDetails.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * PayPal details from a transaction
8
+ *
9
+ * @package Braintree
10
+ * @subpackage Transaction
11
+ */
12
+
13
+ /**
14
+ * creates an instance of PayPalDetails
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @subpackage Transaction
19
+ *
20
+ * @property-read string $payerEmail
21
+ * @property-read string $paymentId
22
+ * @property-read string $authorizationId
23
+ * @property-read string $token
24
+ * @property-read string $imageUrl
25
+ * @property-read string $transactionFeeAmount
26
+ * @property-read string $transactionFeeCurrencyIsoCode
27
+ * @property-read string $description
28
+ */
29
+ class PayPalDetails extends Instance
30
+ {
31
+ protected $_attributes = [];
32
+
33
+ /**
34
+ * @ignore
35
+ */
36
+ public function __construct($attributes)
37
+ {
38
+ parent::__construct($attributes);
39
+ }
40
+ }
41
+ class_alias('Braintree\Transaction\PayPalDetails', 'Braintree_Transaction_PayPalDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/StatusDetails.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Status details from a transaction
8
+ * Creates an instance of StatusDetails, as part of a transaction response
9
+ *
10
+ * @package Braintree
11
+ *
12
+ * @property-read string $amount
13
+ * @property-read string $status
14
+ * @property-read string $timestamp
15
+ * @property-read string $transactionSource
16
+ * @property-read string $user
17
+ */
18
+ class StatusDetails extends Instance
19
+ {
20
+ }
21
+ class_alias('Braintree\Transaction\StatusDetails', 'Braintree_Transaction_StatusDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/SubscriptionDetails.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * Customer details from a transaction
8
+ * Creates an instance of customer details as returned from a transaction
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $billing_period_start_date
14
+ * @property-read string $billing_period_end_date
15
+ */
16
+ class SubscriptionDetails extends Instance
17
+ {
18
+ }
19
+ class_alias('Braintree\Transaction\SubscriptionDetails', 'Braintree_Transaction_SubscriptionDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/UsBankAccountDetails.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+ use Braintree\AchMandate;
6
+
7
+ /**
8
+ * US Bank Account details from a transaction
9
+ * creates an instance of UsbankAccountDetails
10
+ *
11
+ * @package Braintree
12
+ * @subpackage Transaction
13
+ *
14
+ * @property-read string $token
15
+ * @property-read string $imageUrl
16
+ * @property-read string $routingNumber
17
+ * @property-read string $accountType
18
+ * @property-read string $accountHolderName
19
+ * @property-read string $last4
20
+ * @property-read string $bankName
21
+ * @property-read string $achMandate
22
+ */
23
+ class UsBankAccountDetails extends Instance
24
+ {
25
+ protected $_attributes = [];
26
+
27
+ /**
28
+ * @ignore
29
+ */
30
+ public function __construct($attributes)
31
+ {
32
+ parent::__construct($attributes);
33
+
34
+ $achMandate = isset($attributes['achMandate']) ?
35
+ AchMandate::factory($attributes['achMandate']) :
36
+ null;
37
+ $this->achMandate = $achMandate;
38
+ }
39
+ }
40
+ class_alias('Braintree\Transaction\UsBankAccountDetails', 'Braintree_Transaction_UsBankAccountDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/VenmoAccountDetails.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+ /**
6
+ * Venmo account details from a transaction
7
+ *
8
+ * @package Braintree
9
+ * @subpackage Transaction
10
+ */
11
+
12
+ /**
13
+ * creates an instance of VenmoAccountDetails
14
+ *
15
+ *
16
+ * @package Braintree
17
+ * @subpackage Transaction
18
+ *
19
+ * @property-read string $sourceDescription
20
+ * @property-read string $token
21
+ * @property-read string $imageUrl
22
+ * @property-read string $username
23
+ * @property-read string $venmo_user_id
24
+ * @uses Instance inherits methods
25
+ */
26
+ class VenmoAccountDetails extends Instance
27
+ {
28
+ protected $_attributes = array();
29
+
30
+ /**
31
+ * @ignore
32
+ */
33
+ public function __construct($attributes)
34
+ {
35
+ parent::__construct($attributes);
36
+ }
37
+ }
38
+ class_alias('Braintree\Transaction\VenmoAccountDetails', 'Braintree_Transaction_VenmoAccountDetails');
lib/Jmango360/Braintree/lib/Braintree/Transaction/VisaCheckoutCardDetails.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Transaction;
3
+
4
+ use Braintree\Instance;
5
+
6
+ /**
7
+ * VisaCheckoutCard details from a transaction
8
+ * creates an instance of VisaCheckoutCardDetails
9
+ *
10
+ * @package Braintree
11
+ * @subpackage Transaction
12
+ *
13
+ * @property-read string $bin
14
+ * @property-read string $callId
15
+ * @property-read string $cardType
16
+ * @property-read string $cardholderName
17
+ * @property-read string $commercial
18
+ * @property-read string $countryOfIssuance
19
+ * @property-read string $customerId
20
+ * @property-read string $customerLocation
21
+ * @property-read string $debit
22
+ * @property-read string $durbinRegulated
23
+ * @property-read string $expirationDate
24
+ * @property-read string $expirationMonth
25
+ * @property-read string $expirationYear
26
+ * @property-read string $healthcare
27
+ * @property-read string $imageUrl
28
+ * @property-read string $issuingBank
29
+ * @property-read string $last4
30
+ * @property-read string $maskedNumber
31
+ * @property-read string $payroll
32
+ * @property-read string $prepaid
33
+ * @property-read string $productId
34
+ * @property-read string $token
35
+ * @property-read string $updatedAt
36
+ */
37
+ class VisaCheckoutCardDetails extends Instance
38
+ {
39
+ protected $_attributes = [];
40
+
41
+ /**
42
+ * @ignore
43
+ */
44
+ public function __construct($attributes)
45
+ {
46
+ parent::__construct($attributes);
47
+ $this->_attributes['expirationDate'] = $this->expirationMonth . '/' . $this->expirationYear;
48
+ $this->_attributes['maskedNumber'] = $this->bin . '******' . $this->last4;
49
+
50
+ }
51
+ }
52
+ class_alias('Braintree\Transaction\VisaCheckoutCardDetails', 'Braintree_Transaction_VisaCheckoutCardDetails');
lib/Jmango360/Braintree/lib/Braintree/TransactionGateway.php ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree TransactionGateway processor
8
+ * Creates and manages transactions
9
+ *
10
+ *
11
+ * <b>== More information ==</b>
12
+ *
13
+ * For more detailed information on Transactions, see {@link http://www.braintreepayments.com/gateway/transaction-api http://www.braintreepaymentsolutions.com/gateway/transaction-api}
14
+ *
15
+ * @package Braintree
16
+ * @category Resources
17
+ */
18
+
19
+ class TransactionGateway
20
+ {
21
+ private $_gateway;
22
+ private $_config;
23
+ private $_http;
24
+
25
+ public function __construct($gateway)
26
+ {
27
+ $this->_gateway = $gateway;
28
+ $this->_config = $gateway->config;
29
+ $this->_config->assertHasAccessTokenOrKeys();
30
+ $this->_http = new Http($gateway->config);
31
+ }
32
+
33
+ public function cloneTransaction($transactionId, $attribs)
34
+ {
35
+ Util::verifyKeys(self::cloneSignature(), $attribs);
36
+ return $this->_doCreate('/transactions/' . $transactionId . '/clone', ['transactionClone' => $attribs]);
37
+ }
38
+
39
+ /**
40
+ * @ignore
41
+ * @access private
42
+ * @param array $attribs
43
+ * @return object
44
+ */
45
+ private function create($attribs)
46
+ {
47
+ Util::verifyKeys(self::createSignature(), $attribs);
48
+ return $this->_doCreate('/transactions', ['transaction' => $attribs]);
49
+ }
50
+
51
+ /**
52
+ * @ignore
53
+ * @access private
54
+ * @param array $attribs
55
+ * @return object
56
+ * @throws Exception\ValidationError
57
+ */
58
+ private function createNoValidate($attribs)
59
+ {
60
+ $result = $this->create($attribs);
61
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
62
+ }
63
+ /**
64
+ *
65
+ * @deprecated since version 2.3.0
66
+ * @access public
67
+ * @param array $attribs
68
+ * @return object
69
+ */
70
+ public function createFromTransparentRedirect($queryString)
71
+ {
72
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::confirm", E_USER_NOTICE);
73
+ $params = TransparentRedirect::parseAndValidateQueryString(
74
+ $queryString
75
+ );
76
+ return $this->_doCreate(
77
+ '/transactions/all/confirm_transparent_redirect_request',
78
+ ['id' => $params['id']]
79
+ );
80
+ }
81
+ /**
82
+ *
83
+ * @deprecated since version 2.3.0
84
+ * @access public
85
+ * @param none
86
+ * @return string
87
+ */
88
+ public function createTransactionUrl()
89
+ {
90
+ trigger_error("DEPRECATED: Please use TransparentRedirectRequest::url", E_USER_NOTICE);
91
+ return $this->_config->baseUrl() . $this->_config->merchantPath() .
92
+ '/transactions/all/create_via_transparent_redirect_request';
93
+ }
94
+
95
+ public static function cloneSignature()
96
+ {
97
+ return ['amount', 'channel', ['options' => ['submitForSettlement']]];
98
+ }
99
+
100
+ /**
101
+ * creates a full array signature of a valid gateway request
102
+ * @return array gateway request signature format
103
+ */
104
+ public static function createSignature()
105
+ {
106
+ return [
107
+ 'amount',
108
+ 'billingAddressId',
109
+ 'channel',
110
+ 'customerId',
111
+ 'deviceData',
112
+ 'deviceSessionId',
113
+ 'fraudMerchantId',
114
+ 'merchantAccountId',
115
+ 'orderId',
116
+ 'paymentMethodNonce',
117
+ 'paymentMethodToken',
118
+ 'purchaseOrderNumber',
119
+ 'recurring',
120
+ 'serviceFeeAmount',
121
+ 'sharedPaymentMethodToken',
122
+ 'sharedCustomerId',
123
+ 'sharedShippingAddressId',
124
+ 'sharedBillingAddressId',
125
+ 'shippingAddressId',
126
+ 'taxAmount',
127
+ 'taxExempt',
128
+ 'threeDSecureToken',
129
+ 'transactionSource',
130
+ 'type',
131
+ 'venmoSdkPaymentMethodCode',
132
+ ['riskData' =>
133
+ ['customerBrowser', 'customerIp', 'customer_browser', 'customer_ip']
134
+ ],
135
+ ['creditCard' =>
136
+ ['token', 'cardholderName', 'cvv', 'expirationDate', 'expirationMonth', 'expirationYear', 'number'],
137
+ ],
138
+ ['customer' =>
139
+ [
140
+ 'id', 'company', 'email', 'fax', 'firstName',
141
+ 'lastName', 'phone', 'website'],
142
+ ],
143
+ ['billing' =>
144
+ [
145
+ 'firstName', 'lastName', 'company', 'countryName',
146
+ 'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
147
+ 'extendedAddress', 'locality', 'postalCode', 'region',
148
+ 'streetAddress'],
149
+ ],
150
+ ['shipping' =>
151
+ [
152
+ 'firstName', 'lastName', 'company', 'countryName',
153
+ 'countryCodeAlpha2', 'countryCodeAlpha3', 'countryCodeNumeric',
154
+ 'extendedAddress', 'locality', 'postalCode', 'region',
155
+ 'streetAddress'],
156
+ ],
157
+ ['threeDSecurePassThru' =>
158
+ [
159
+ 'eciFlag',
160
+ 'cavv',
161
+ 'xid'],
162
+ ],
163
+ ['options' =>
164
+ [
165
+ 'holdInEscrow',
166
+ 'storeInVault',
167
+ 'storeInVaultOnSuccess',
168
+ 'submitForSettlement',
169
+ 'addBillingAddressToPaymentMethod',
170
+ 'venmoSdkSession',
171
+ 'storeShippingAddressInVault',
172
+ 'payeeEmail',
173
+ 'skipAdvancedFraudChecking',
174
+ 'skipAvs',
175
+ 'skipCvv',
176
+ ['threeDSecure' =>
177
+ ['required']
178
+ ],
179
+ # Included for backwards compatiblity. Remove in the next major version
180
+ ['three_d_secure' =>
181
+ ['required']
182
+ ],
183
+ ['paypal' =>
184
+ [
185
+ 'payeeEmail',
186
+ 'customField',
187
+ 'description',
188
+ ['supplementaryData' => ['_anyKey_']],
189
+ ]
190
+ ],
191
+ ['amexRewards' =>
192
+ [
193
+ 'requestId',
194
+ 'points',
195
+ 'currencyAmount',
196
+ 'currencyIsoCode'
197
+ ]
198
+ ]
199
+ ],
200
+ ],
201
+ ['customFields' => ['_anyKey_']],
202
+ ['descriptor' => ['name', 'phone', 'url']],
203
+ ['paypalAccount' => ['payeeEmail']],
204
+ ['apple_pay_card' => ['number', 'cardholder_name', 'cryptogram', 'expiration_month', 'expiration_year']], #backwards compatibility
205
+ ['applePayCard' => ['number', 'cardholderName', 'cryptogram', 'expirationMonth', 'expirationYear']],
206
+ ['industry' =>
207
+ ['industryType',
208
+ ['data' =>
209
+ [
210
+ 'folioNumber',
211
+ 'checkInDate',
212
+ 'checkOutDate',
213
+ 'travelPackage',
214
+ 'departureDate',
215
+ 'lodgingCheckInDate',
216
+ 'lodgingCheckOutDate',
217
+ 'lodgingName',
218
+ 'roomRate'
219
+ ]
220
+ ]
221
+ ]
222
+ ]
223
+ ];
224
+ }
225
+
226
+ public static function submitForSettlementSignature()
227
+ {
228
+ return ['orderId', ['descriptor' => ['name', 'phone', 'url']]];
229
+ }
230
+
231
+ public static function updateDetailsSignature()
232
+ {
233
+ return ['amount', 'orderId', ['descriptor' => ['name', 'phone', 'url']]];
234
+ }
235
+
236
+ public static function refundSignature()
237
+ {
238
+ return ['amount', 'orderId'];
239
+ }
240
+
241
+ /**
242
+ *
243
+ * @access public
244
+ * @param array $attribs
245
+ * @return Result\Successful|Result\Error
246
+ */
247
+ public function credit($attribs)
248
+ {
249
+ return $this->create(array_merge($attribs, ['type' => Transaction::CREDIT]));
250
+ }
251
+
252
+ /**
253
+ *
254
+ * @access public
255
+ * @param array $attribs
256
+ * @return Result\Successful|Result\Error
257
+ * @throws Exception\ValidationError
258
+ */
259
+ public function creditNoValidate($attribs)
260
+ {
261
+ $result = $this->credit($attribs);
262
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
263
+ }
264
+
265
+ /**
266
+ * @access public
267
+ * @param string id
268
+ * @return Transaction
269
+ */
270
+ public function find($id)
271
+ {
272
+ $this->_validateId($id);
273
+ try {
274
+ $path = $this->_config->merchantPath() . '/transactions/' . $id;
275
+ $response = $this->_http->get($path);
276
+ return Transaction::factory($response['transaction']);
277
+ } catch (Exception\NotFound $e) {
278
+ throw new Exception\NotFound(
279
+ 'transaction with id ' . $id . ' not found'
280
+ );
281
+ }
282
+ }
283
+ /**
284
+ * new sale
285
+ * @param array $attribs
286
+ * @return array
287
+ */
288
+ public function sale($attribs)
289
+ {
290
+ return $this->create(array_merge(['type' => Transaction::SALE], $attribs));
291
+ }
292
+
293
+ /**
294
+ * roughly equivalent to the ruby bang method
295
+ * @access public
296
+ * @param array $attribs
297
+ * @return array
298
+ * @throws Exception\ValidationsFailed
299
+ */
300
+ public function saleNoValidate($attribs)
301
+ {
302
+ $result = $this->sale($attribs);
303
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
304
+ }
305
+
306
+ /**
307
+ * Returns a ResourceCollection of transactions matching the search query.
308
+ *
309
+ * If <b>query</b> is a string, the search will be a basic search.
310
+ * If <b>query</b> is a hash, the search will be an advanced search.
311
+ * For more detailed information and examples, see {@link http://www.braintreepayments.com/gateway/transaction-api#searching http://www.braintreepaymentsolutions.com/gateway/transaction-api}
312
+ *
313
+ * @param mixed $query search query
314
+ * @param array $options options such as page number
315
+ * @return ResourceCollection
316
+ * @throws InvalidArgumentException
317
+ */
318
+ public function search($query)
319
+ {
320
+ $criteria = [];
321
+ foreach ($query as $term) {
322
+ $criteria[$term->name] = $term->toparam();
323
+ }
324
+
325
+ $path = $this->_config->merchantPath() . '/transactions/advanced_search_ids';
326
+ $response = $this->_http->post($path, ['search' => $criteria]);
327
+ if (array_key_exists('searchResults', $response)) {
328
+ $pager = [
329
+ 'object' => $this,
330
+ 'method' => 'fetch',
331
+ 'methodArgs' => [$query]
332
+ ];
333
+
334
+ return new ResourceCollection($response, $pager);
335
+ } else {
336
+ throw new Exception\DownForMaintenance();
337
+ }
338
+ }
339
+
340
+ public function fetch($query, $ids)
341
+ {
342
+ $criteria = [];
343
+ foreach ($query as $term) {
344
+ $criteria[$term->name] = $term->toparam();
345
+ }
346
+ $criteria["ids"] = TransactionSearch::ids()->in($ids)->toparam();
347
+ $path = $this->_config->merchantPath() . '/transactions/advanced_search';
348
+ $response = $this->_http->post($path, ['search' => $criteria]);
349
+
350
+ if (array_key_exists('creditCardTransactions', $response)) {
351
+ return Util::extractattributeasarray(
352
+ $response['creditCardTransactions'],
353
+ 'transaction'
354
+ );
355
+ } else {
356
+ throw new Exception\DownForMaintenance();
357
+ }
358
+ }
359
+
360
+ /**
361
+ * void a transaction by id
362
+ *
363
+ * @param string $id transaction id
364
+ * @return Result\Successful|Result\Error
365
+ */
366
+ public function void($transactionId)
367
+ {
368
+ $this->_validateId($transactionId);
369
+
370
+ $path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/void';
371
+ $response = $this->_http->put($path);
372
+ return $this->_verifyGatewayResponse($response);
373
+ }
374
+ /**
375
+ *
376
+ */
377
+ public function voidNoValidate($transactionId)
378
+ {
379
+ $result = $this->void($transactionId);
380
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
381
+ }
382
+
383
+ public function submitForSettlement($transactionId, $amount = null, $attribs = [])
384
+ {
385
+ $this->_validateId($transactionId);
386
+ Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
387
+ $attribs['amount'] = $amount;
388
+
389
+ $path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/submit_for_settlement';
390
+ $response = $this->_http->put($path, ['transaction' => $attribs]);
391
+ return $this->_verifyGatewayResponse($response);
392
+ }
393
+
394
+ public function submitForSettlementNoValidate($transactionId, $amount = null, $attribs = [])
395
+ {
396
+ $result = $this->submitForSettlement($transactionId, $amount, $attribs);
397
+ return Util::returnObjectOrThrowException(__CLASS__, $result);
398
+ }
399
+
400
+ public function updateDetails($transactionId, $attribs = [])
401
+ {
402
+ $this->_validateId($transactionId);
403
+ Util::verifyKeys(self::updateDetailsSignature(), $attribs);
404
+
405
+ $path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/update_details';
406
+ $response = $this->_http->put($path, ['transaction' => $attribs]);
407
+ return $this->_verifyGatewayResponse($response);
408
+ }
409
+
410
+ public function submitForPartialSettlement($transactionId, $amount, $attribs = [])
411
+ {
412
+ $this->_validateId($transactionId);
413
+ Util::verifyKeys(self::submitForSettlementSignature(), $attribs);
414
+ $attribs['amount'] = $amount;
415
+
416
+ $path = $this->_config->merchantPath() . '/transactions/'. $transactionId . '/submit_for_partial_settlement';
417
+ $response = $this->_http->post($path, ['transaction' => $attribs]);
418
+ return $this->_verifyGatewayResponse($response);
419
+ }
420
+
421
+ public function holdInEscrow($transactionId)
422
+ {
423
+ $this->_validateId($transactionId);
424
+
425
+ $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/hold_in_escrow';
426
+ $response = $this->_http->put($path, []);
427
+ return $this->_verifyGatewayResponse($response);
428
+ }
429
+
430
+ public function releaseFromEscrow($transactionId)
431
+ {
432
+ $this->_validateId($transactionId);
433
+
434
+ $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/release_from_escrow';
435
+ $response = $this->_http->put($path, []);
436
+ return $this->_verifyGatewayResponse($response);
437
+ }
438
+
439
+ public function cancelRelease($transactionId)
440
+ {
441
+ $this->_validateId($transactionId);
442
+
443
+ $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/cancel_release';
444
+ $response = $this->_http->put($path, []);
445
+ return $this->_verifyGatewayResponse($response);
446
+ }
447
+
448
+ public function refund($transactionId, $amount_or_options = null)
449
+ {
450
+ self::_validateId($transactionId);
451
+
452
+ if(gettype($amount_or_options) == "array") {
453
+ $options = $amount_or_options;
454
+ } else {
455
+ $options = [
456
+ "amount" => $amount_or_options
457
+ ];
458
+ }
459
+ Util::verifyKeys(self::refundSignature(), $options);
460
+
461
+ $params = ['transaction' => $options];
462
+ $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . '/refund';
463
+ $response = $this->_http->post($path, $params);
464
+ return $this->_verifyGatewayResponse($response);
465
+ }
466
+
467
+ /**
468
+ * sends the create request to the gateway
469
+ *
470
+ * @ignore
471
+ * @param var $subPath
472
+ * @param array $params
473
+ * @return mixed
474
+ */
475
+ public function _doCreate($subPath, $params)
476
+ {
477
+ $fullPath = $this->_config->merchantPath() . $subPath;
478
+ $response = $this->_http->post($fullPath, $params);
479
+
480
+ return $this->_verifyGatewayResponse($response);
481
+ }
482
+
483
+ /**
484
+ * verifies that a valid transaction id is being used
485
+ * @ignore
486
+ * @param string transaction id
487
+ * @throws InvalidArgumentException
488
+ */
489
+ private function _validateId($id = null) {
490
+ if (empty($id)) {
491
+ throw new InvalidArgumentException(
492
+ 'expected transaction id to be set'
493
+ );
494
+ }
495
+ if (!preg_match('/^[0-9a-z]+$/', $id)) {
496
+ throw new InvalidArgumentException(
497
+ $id . ' is an invalid transaction id.'
498
+ );
499
+ }
500
+ }
501
+
502
+ /**
503
+ * generic method for validating incoming gateway responses
504
+ *
505
+ * creates a new Transaction object and encapsulates
506
+ * it inside a Result\Successful object, or
507
+ * encapsulates a Errors object inside a Result\Error
508
+ * alternatively, throws an Unexpected exception if the response is invalid.
509
+ *
510
+ * @ignore
511
+ * @param array $response gateway response values
512
+ * @return Result\Successful|Result\Error
513
+ * @throws Exception\Unexpected
514
+ */
515
+ private function _verifyGatewayResponse($response)
516
+ {
517
+ if (isset($response['transaction'])) {
518
+ // return a populated instance of Transaction
519
+ return new Result\Successful(
520
+ Transaction::factory($response['transaction'])
521
+ );
522
+ } else if (isset($response['apiErrorResponse'])) {
523
+ return new Result\Error($response['apiErrorResponse']);
524
+ } else {
525
+ throw new Exception\Unexpected(
526
+ "Expected transaction or apiErrorResponse"
527
+ );
528
+ }
529
+ }
530
+ }
531
+ class_alias('Braintree\TransactionGateway', 'Braintree_TransactionGateway');
lib/Jmango360/Braintree/lib/Braintree/TransactionSearch.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class TransactionSearch
5
+ {
6
+ public static function amount() { return new RangeNode("amount"); }
7
+ public static function authorizationExpiredAt() { return new RangeNode("authorizationExpiredAt"); }
8
+ public static function authorizedAt() { return new RangeNode("authorizedAt"); }
9
+ public static function billingCompany() { return new TextNode('billing_company'); }
10
+ public static function billingCountryName() { return new TextNode('billing_country_name'); }
11
+ public static function billingExtendedAddress() { return new TextNode('billing_extended_address'); }
12
+ public static function billingFirstName() { return new TextNode('billing_first_name'); }
13
+ public static function billingLastName() { return new TextNode('billing_last_name'); }
14
+ public static function billingLocality() { return new TextNode('billing_locality'); }
15
+ public static function billingPostalCode() { return new TextNode('billing_postal_code'); }
16
+ public static function billingRegion() { return new TextNode('billing_region'); }
17
+ public static function billingStreetAddress() { return new TextNode('billing_street_address'); }
18
+ public static function createdAt() { return new RangeNode("createdAt"); }
19
+ public static function creditCardCardholderName() { return new TextNode('credit_card_cardholderName'); }
20
+ public static function creditCardExpirationDate() { return new EqualityNode('credit_card_expiration_date'); }
21
+ public static function creditCardNumber() { return new PartialMatchNode('credit_card_number'); }
22
+ public static function creditCardUniqueIdentifier() { return new TextNode('credit_card_unique_identifier'); }
23
+ public static function currency() { return new TextNode('currency'); }
24
+ public static function customerCompany() { return new TextNode('customer_company'); }
25
+ public static function customerEmail() { return new TextNode('customer_email'); }
26
+ public static function customerFax() { return new TextNode('customer_fax'); }
27
+ public static function customerFirstName() { return new TextNode('customer_first_name'); }
28
+ public static function customerId() { return new TextNode('customer_id'); }
29
+ public static function customerLastName() { return new TextNode('customer_last_name'); }
30
+ public static function customerPhone() { return new TextNode('customer_phone'); }
31
+ public static function customerWebsite() { return new TextNode('customer_website'); }
32
+ public static function disbursementDate() { return new RangeNode("disbursementDate"); }
33
+ public static function disputeDate() { return new RangeNode("disputeDate"); }
34
+ public static function europeBankAccountIban() { return new TextNode("europeBankAccountIban"); }
35
+ public static function failedAt() { return new RangeNode("failedAt"); }
36
+ public static function gatewayRejectedAt() { return new RangeNode("gatewayRejectedAt"); }
37
+ public static function id() { return new TextNode('id'); }
38
+ public static function ids() { return new MultipleValueNode('ids'); }
39
+ public static function merchantAccountId() { return new MultipleValueNode("merchant_account_id"); }
40
+ public static function orderId() { return new TextNode('order_id'); }
41
+ public static function paymentInstrumentType() { return new MultipleValueNode('paymentInstrumentType'); }
42
+ public static function paymentMethodToken() { return new TextNode('payment_method_token'); }
43
+ public static function paypalAuthorizationId() { return new TextNode('paypal_authorization_id'); }
44
+ public static function paypalPayerEmail() { return new TextNode('paypal_payer_email'); }
45
+ public static function paypalPaymentId() { return new TextNode('paypal_payment_id'); }
46
+ public static function processorAuthorizationCode() { return new TextNode('processor_authorization_code'); }
47
+ public static function processorDeclinedAt() { return new RangeNode("processorDeclinedAt"); }
48
+ public static function refund() { return new KeyValueNode("refund"); }
49
+ public static function settledAt() { return new RangeNode("settledAt"); }
50
+ public static function settlementBatchId() { return new TextNode('settlement_batch_id'); }
51
+ public static function shippingCompany() { return new TextNode('shipping_company'); }
52
+ public static function shippingCountryName() { return new TextNode('shipping_country_name'); }
53
+ public static function shippingExtendedAddress() { return new TextNode('shipping_extended_address'); }
54
+ public static function shippingFirstName() { return new TextNode('shipping_first_name'); }
55
+ public static function shippingLastName() { return new TextNode('shipping_last_name'); }
56
+ public static function shippingLocality() { return new TextNode('shipping_locality'); }
57
+ public static function shippingPostalCode() { return new TextNode('shipping_postal_code'); }
58
+ public static function shippingRegion() { return new TextNode('shipping_region'); }
59
+ public static function shippingStreetAddress() { return new TextNode('shipping_street_address'); }
60
+ public static function submittedForSettlementAt() { return new RangeNode("submittedForSettlementAt"); }
61
+ public static function user() { return new MultipleValueNode('user'); }
62
+ public static function voidedAt() { return new RangeNode("voidedAt"); }
63
+
64
+ public static function createdUsing()
65
+ {
66
+ return new MultipleValueNode('created_using', [
67
+ Transaction::FULL_INFORMATION,
68
+ Transaction::TOKEN
69
+ ]);
70
+ }
71
+
72
+ public static function creditCardCardType()
73
+ {
74
+ return new MultipleValueNode('credit_card_card_type', [
75
+ CreditCard::AMEX,
76
+ CreditCard::CARTE_BLANCHE,
77
+ CreditCard::CHINA_UNION_PAY,
78
+ CreditCard::DINERS_CLUB_INTERNATIONAL,
79
+ CreditCard::DISCOVER,
80
+ CreditCard::JCB,
81
+ CreditCard::LASER,
82
+ CreditCard::MAESTRO,
83
+ CreditCard::MASTER_CARD,
84
+ CreditCard::SOLO,
85
+ CreditCard::SWITCH_TYPE,
86
+ CreditCard::VISA,
87
+ CreditCard::UNKNOWN
88
+ ]);
89
+ }
90
+
91
+ public static function creditCardCustomerLocation()
92
+ {
93
+ return new MultipleValueNode('credit_card_customer_location', [
94
+ CreditCard::INTERNATIONAL,
95
+ CreditCard::US
96
+ ]);
97
+ }
98
+
99
+ public static function source()
100
+ {
101
+ return new MultipleValueNode('source', []);
102
+ }
103
+
104
+ public static function status()
105
+ {
106
+ return new MultipleValueNode('status', [
107
+ Transaction::AUTHORIZATION_EXPIRED,
108
+ Transaction::AUTHORIZING,
109
+ Transaction::AUTHORIZED,
110
+ Transaction::GATEWAY_REJECTED,
111
+ Transaction::FAILED,
112
+ Transaction::PROCESSOR_DECLINED,
113
+ Transaction::SETTLED,
114
+ Transaction::SETTLING,
115
+ Transaction::SUBMITTED_FOR_SETTLEMENT,
116
+ Transaction::VOIDED,
117
+ Transaction::SETTLEMENT_DECLINED,
118
+ Transaction::SETTLEMENT_PENDING
119
+ ]);
120
+ }
121
+
122
+ public static function type()
123
+ {
124
+ return new MultipleValueNode('type', [
125
+ Transaction::SALE,
126
+ Transaction::CREDIT
127
+ ]);
128
+ }
129
+ }
130
+ class_alias('Braintree\TransactionSearch', 'Braintree_TransactionSearch');
lib/Jmango360/Braintree/lib/Braintree/TransparentRedirect.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Transparent Redirect module
6
+ * Static class providing methods to build Transparent Redirect urls.
7
+ *
8
+ * The TransparentRedirect module provides methods to build the tr_data param
9
+ * that must be submitted when using the transparent redirect API.
10
+ * For more information
11
+ * about transparent redirect, see (TODO).
12
+ *
13
+ * You must provide a redirectUrl to which the gateway will redirect the
14
+ * user the action is complete.
15
+ *
16
+ * <code>
17
+ * $trData = TransparentRedirect::createCustomerData(array(
18
+ * 'redirectUrl => 'http://example.com/redirect_back_to_merchant_site',
19
+ * ));
20
+ * </code>
21
+ *
22
+ * In addition to the redirectUrl, any data that needs to be protected
23
+ * from user tampering should be included in the trData.
24
+ * For example, to prevent the user from tampering with the transaction
25
+ * amount, include the amount in the trData.
26
+ *
27
+ * <code>
28
+ * $trData = TransparentRedirect::transactionData(array(
29
+ * 'redirectUrl' => 'http://example.com/complete_transaction',
30
+ * 'transaction' => array('amount' => '100.00'),
31
+ * ));
32
+ *
33
+ * </code>
34
+ *
35
+ * @package Braintree
36
+ * @category Resources
37
+ */
38
+ class TransparentRedirect
39
+ {
40
+ // Request Kinds
41
+ const CREATE_TRANSACTION = 'create_transaction';
42
+ const CREATE_PAYMENT_METHOD = 'create_payment_method';
43
+ const UPDATE_PAYMENT_METHOD = 'update_payment_method';
44
+ const CREATE_CUSTOMER = 'create_customer';
45
+ const UPDATE_CUSTOMER = 'update_customer';
46
+
47
+ /**
48
+ * @ignore
49
+ * don't permit an explicit call of the constructor!
50
+ * (like $t = new TransparentRedirect())
51
+ */
52
+ protected function __construct()
53
+ {
54
+
55
+ }
56
+
57
+
58
+ // static methods redirecting to gateway
59
+
60
+ public static function confirm($queryString)
61
+ {
62
+ return Configuration::gateway()->transparentRedirect()->confirm($queryString);
63
+ }
64
+
65
+ public static function createCreditCardData($params)
66
+ {
67
+ return Configuration::gateway()->transparentRedirect()->createCreditCardData($params);
68
+ }
69
+
70
+ public static function createCustomerData($params)
71
+ {
72
+ return Configuration::gateway()->transparentRedirect()->createCustomerData($params);
73
+ }
74
+
75
+ public static function url()
76
+ {
77
+ return Configuration::gateway()->transparentRedirect()->url();
78
+ }
79
+
80
+ public static function transactionData($params)
81
+ {
82
+ return Configuration::gateway()->transparentRedirect()->transactionData($params);
83
+ }
84
+
85
+ public static function updateCreditCardData($params)
86
+ {
87
+ return Configuration::gateway()->transparentRedirect()->updateCreditCardData($params);
88
+ }
89
+
90
+ public static function updateCustomerData($params)
91
+ {
92
+ return Configuration::gateway()->transparentRedirect()->updateCustomerData($params);
93
+ }
94
+
95
+ public static function parseAndValidateQueryString($queryString)
96
+ {
97
+ return Configuration::gateway()->transparentRedirect()->parseAndValidateQueryString($queryString);
98
+ }
99
+ }
100
+ class_alias('Braintree\TransparentRedirect', 'Braintree_TransparentRedirect');
lib/Jmango360/Braintree/lib/Braintree/TransparentRedirectGateway.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+ use DateTime;
6
+ use DateTimeZone;
7
+
8
+ /**
9
+ * Braintree Transparent Redirect Gateway module
10
+ * Static class providing methods to build Transparent Redirect urls
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ */
15
+ class TransparentRedirectGateway
16
+ {
17
+ private $_gateway;
18
+ private $_config;
19
+
20
+ public function __construct($gateway)
21
+ {
22
+ $this->_gateway = $gateway;
23
+ $this->_config = $gateway->config;
24
+ $this->_config->assertHasAccessTokenOrKeys();
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @ignore
30
+ */
31
+ private static $_transparentRedirectKeys = 'redirectUrl';
32
+ private static $_createCustomerSignature;
33
+ private static $_updateCustomerSignature;
34
+ private static $_transactionSignature;
35
+ private static $_createCreditCardSignature;
36
+ private static $_updateCreditCardSignature;
37
+
38
+ /**
39
+ * create signatures for different call types
40
+ * @ignore
41
+ */
42
+ public static function init()
43
+ {
44
+
45
+ self::$_createCustomerSignature = [
46
+ self::$_transparentRedirectKeys,
47
+ ['customer' => CustomerGateway::createSignature()],
48
+ ];
49
+ self::$_updateCustomerSignature = [
50
+ self::$_transparentRedirectKeys,
51
+ 'customerId',
52
+ ['customer' => CustomerGateway::updateSignature()],
53
+ ];
54
+ self::$_transactionSignature = [
55
+ self::$_transparentRedirectKeys,
56
+ ['transaction' => TransactionGateway::createSignature()],
57
+ ];
58
+ self::$_createCreditCardSignature = [
59
+ self::$_transparentRedirectKeys,
60
+ ['creditCard' => CreditCardGateway::createSignature()],
61
+ ];
62
+ self::$_updateCreditCardSignature = [
63
+ self::$_transparentRedirectKeys,
64
+ 'paymentMethodToken',
65
+ ['creditCard' => CreditCardGateway::updateSignature()],
66
+ ];
67
+ }
68
+
69
+ public function confirm($queryString)
70
+ {
71
+ $params = TransparentRedirect::parseAndValidateQueryString(
72
+ $queryString
73
+ );
74
+ $confirmationKlasses = [
75
+ TransparentRedirect::CREATE_TRANSACTION => 'Braintree\TransactionGateway',
76
+ TransparentRedirect::CREATE_CUSTOMER => 'Braintree\CustomerGateway',
77
+ TransparentRedirect::UPDATE_CUSTOMER => 'Braintree\CustomerGateway',
78
+ TransparentRedirect::CREATE_PAYMENT_METHOD => 'Braintree\CreditCardGateway',
79
+ TransparentRedirect::UPDATE_PAYMENT_METHOD => 'Braintree\CreditCardGateway',
80
+ ];
81
+ $confirmationGateway = new $confirmationKlasses[$params["kind"]]($this->_gateway);
82
+ return $confirmationGateway->_doCreate('/transparent_redirect_requests/' . $params['id'] . '/confirm', []);
83
+ }
84
+
85
+ /**
86
+ * returns the trData string for creating a credit card,
87
+ * @param array $params
88
+ * @return string
89
+ */
90
+ public function createCreditCardData($params)
91
+ {
92
+ Util::verifyKeys(
93
+ self::$_createCreditCardSignature,
94
+ $params
95
+ );
96
+ $params["kind"] = TransparentRedirect::CREATE_PAYMENT_METHOD;
97
+ return $this->_data($params);
98
+ }
99
+
100
+ /**
101
+ * returns the trData string for creating a customer.
102
+ * @param array $params
103
+ * @return string
104
+ */
105
+ public function createCustomerData($params)
106
+ {
107
+ Util::verifyKeys(
108
+ self::$_createCustomerSignature,
109
+ $params
110
+ );
111
+ $params["kind"] = TransparentRedirect::CREATE_CUSTOMER;
112
+ return $this->_data($params);
113
+
114
+ }
115
+
116
+ public function url()
117
+ {
118
+ return $this->_config->baseUrl() . $this->_config->merchantPath() . '/transparent_redirect_requests';
119
+ }
120
+
121
+ /**
122
+ * returns the trData string for creating a transaction
123
+ * @param array $params
124
+ * @return string
125
+ */
126
+ public function transactionData($params)
127
+ {
128
+ Util::verifyKeys(
129
+ self::$_transactionSignature,
130
+ $params
131
+ );
132
+ $params["kind"] = TransparentRedirect::CREATE_TRANSACTION;
133
+ $transactionType = isset($params['transaction']['type']) ?
134
+ $params['transaction']['type'] :
135
+ null;
136
+ if ($transactionType != Transaction::SALE && $transactionType != Transaction::CREDIT) {
137
+ throw new InvalidArgumentException(
138
+ 'expected transaction[type] of sale or credit, was: ' .
139
+ $transactionType
140
+ );
141
+ }
142
+
143
+ return $this->_data($params);
144
+ }
145
+
146
+ /**
147
+ * Returns the trData string for updating a credit card.
148
+ *
149
+ * The paymentMethodToken of the credit card to update is required.
150
+ *
151
+ * <code>
152
+ * $trData = TransparentRedirect::updateCreditCardData(array(
153
+ * 'redirectUrl' => 'http://example.com/redirect_here',
154
+ * 'paymentMethodToken' => 'token123',
155
+ * ));
156
+ * </code>
157
+ *
158
+ * @param array $params
159
+ * @return string
160
+ */
161
+ public function updateCreditCardData($params)
162
+ {
163
+ Util::verifyKeys(
164
+ self::$_updateCreditCardSignature,
165
+ $params
166
+ );
167
+ if (!isset($params['paymentMethodToken'])) {
168
+ throw new InvalidArgumentException(
169
+ 'expected params to contain paymentMethodToken.'
170
+ );
171
+ }
172
+ $params["kind"] = TransparentRedirect::UPDATE_PAYMENT_METHOD;
173
+ return $this->_data($params);
174
+ }
175
+
176
+ /**
177
+ * Returns the trData string for updating a customer.
178
+ *
179
+ * The customerId of the customer to update is required.
180
+ *
181
+ * <code>
182
+ * $trData = TransparentRedirect::updateCustomerData(array(
183
+ * 'redirectUrl' => 'http://example.com/redirect_here',
184
+ * 'customerId' => 'customer123',
185
+ * ));
186
+ * </code>
187
+ *
188
+ * @param array $params
189
+ * @return string
190
+ */
191
+ public function updateCustomerData($params)
192
+ {
193
+ Util::verifyKeys(
194
+ self::$_updateCustomerSignature,
195
+ $params
196
+ );
197
+ if (!isset($params['customerId'])) {
198
+ throw new InvalidArgumentException(
199
+ 'expected params to contain customerId of customer to update'
200
+ );
201
+ }
202
+ $params["kind"] = TransparentRedirect::UPDATE_CUSTOMER;
203
+ return $this->_data($params);
204
+ }
205
+
206
+ public function parseAndValidateQueryString($queryString)
207
+ {
208
+ // parse the params into an array
209
+ parse_str($queryString, $params);
210
+ // remove the hash
211
+ $queryStringWithoutHash = null;
212
+ if (preg_match('/^(.*)&hash=[a-f0-9]+$/', $queryString, $match)) {
213
+ $queryStringWithoutHash = $match[1];
214
+ }
215
+
216
+ if($params['http_status'] != '200') {
217
+ $message = null;
218
+ if(array_key_exists('bt_message', $params)) {
219
+ $message = $params['bt_message'];
220
+ }
221
+ Util::throwStatusCodeException(isset($params['http_status']) ? $params['http_status'] : null, $message);
222
+ }
223
+
224
+ // recreate the hash and compare it
225
+ if ($this->_hash($queryStringWithoutHash) == $params['hash']) {
226
+ return $params;
227
+ } else {
228
+ throw new Exception\ForgedQueryString();
229
+ }
230
+ }
231
+
232
+
233
+ /**
234
+ *
235
+ * @ignore
236
+ */
237
+ private function _data($params)
238
+ {
239
+ if (!isset($params['redirectUrl'])) {
240
+ throw new InvalidArgumentException(
241
+ 'expected params to contain redirectUrl'
242
+ );
243
+ }
244
+ $params = $this->_underscoreKeys($params);
245
+ $now = new DateTime('now', new DateTimeZone('UTC'));
246
+ $trDataParams = array_merge($params,
247
+ [
248
+ 'api_version' => Configuration::API_VERSION,
249
+ 'public_key' => $this->_config->publicKey(),
250
+ 'time' => $now->format('YmdHis'),
251
+ ]
252
+ );
253
+ ksort($trDataParams);
254
+ $urlEncodedData = http_build_query($trDataParams, null, "&");
255
+ $signatureService = new SignatureService(
256
+ $this->_config->privateKey(),
257
+ "Braintree\Digest::hexDigestSha1"
258
+ );
259
+ return $signatureService->sign($urlEncodedData);
260
+ }
261
+
262
+ private function _underscoreKeys($array)
263
+ {
264
+ foreach($array as $key=>$value)
265
+ {
266
+ $newKey = Util::camelCaseToDelimiter($key, '_');
267
+ unset($array[$key]);
268
+ if (is_array($value))
269
+ {
270
+ $array[$newKey] = $this->_underscoreKeys($value);
271
+ }
272
+ else
273
+ {
274
+ $array[$newKey] = $value;
275
+ }
276
+ }
277
+ return $array;
278
+ }
279
+
280
+ /**
281
+ * @ignore
282
+ */
283
+ private function _hash($string)
284
+ {
285
+ return Digest::hexDigestSha1($this->_config->privateKey(), $string);
286
+ }
287
+ }
288
+ TransparentRedirectGateway::init();
289
+ class_alias('Braintree\TransparentRedirectGateway', 'Braintree_TransparentRedirectGateway');
lib/Jmango360/Braintree/lib/Braintree/UnknownPaymentMethod.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree UnknownPaymentMethod module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Manages Braintree UnknownPaymentMethod
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ *
20
+ * @property-read string $token
21
+ * @property-read string $imageUrl
22
+ */
23
+ class UnknownPaymentMethod extends Base
24
+ {
25
+
26
+
27
+ /**
28
+ * factory method: returns an instance of UnknownPaymentMethod
29
+ * to the requesting method, with populated properties
30
+ *
31
+ * @ignore
32
+ * @return UnknownPaymentMethod
33
+ */
34
+ public static function factory($attributes)
35
+ {
36
+ $instance = new self();
37
+ $values = array_values($attributes);
38
+ $instance->_initialize(array_shift($values));
39
+ return $instance;
40
+ }
41
+
42
+ /* instance methods */
43
+
44
+ /**
45
+ * returns false if default is null or false
46
+ *
47
+ * @return boolean
48
+ */
49
+ public function isDefault()
50
+ {
51
+ return $this->default;
52
+ }
53
+
54
+ /**
55
+ * sets instance properties from an array of values
56
+ *
57
+ * @access protected
58
+ * @param array $unknownPaymentMethodAttribs array of unknownPaymentMethod data
59
+ * @return void
60
+ */
61
+ protected function _initialize($unknownPaymentMethodAttribs)
62
+ {
63
+ // set the attributes
64
+ $this->imageUrl = 'https://assets.braintreegateway.com/payment_method_logo/unknown.png';
65
+ $this->_attributes = $unknownPaymentMethodAttribs;
66
+ }
67
+
68
+ }
69
+ class_alias('Braintree\UnknownPaymentMethod', 'Braintree_UnknownPaymentMethod');
lib/Jmango360/Braintree/lib/Braintree/UsBankAccount.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree UsBankAccount module
6
+ *
7
+ * @package Braintree
8
+ * @category Resources
9
+ */
10
+
11
+ /**
12
+ * Manages Braintree UsBankAccounts
13
+ *
14
+ * <b>== More information ==</b>
15
+ *
16
+ *
17
+ * @package Braintree
18
+ * @category Resources
19
+ *
20
+ * @property-read string $customerId
21
+ * @property-read string $email
22
+ * @property-read string $token
23
+ * @property-read string $imageUrl
24
+ * @property-read string $routingNumber
25
+ * @property-read string $accountType
26
+ * @property-read string $accountHolderName
27
+ * @property-read string $last4
28
+ * @property-read string $bankName
29
+ * @property-read string $achMandate
30
+ * @property-read string $default
31
+ */
32
+ class UsBankAccount extends Base
33
+ {
34
+ /**
35
+ * factory method: returns an instance of UsBankAccount
36
+ * to the requesting method, with populated properties
37
+ *
38
+ * @ignore
39
+ * @return UsBankAccount
40
+ */
41
+ public static function factory($attributes)
42
+ {
43
+ $instance = new self();
44
+ $instance->_initialize($attributes);
45
+ return $instance;
46
+ }
47
+
48
+ /* instance methods */
49
+
50
+ /**
51
+ * sets instance properties from an array of values
52
+ *
53
+ * @access protected
54
+ * @param array $usBankAccountAttribs array of usBankAccount data
55
+ * @return void
56
+ */
57
+ protected function _initialize($usBankAccountAttribs)
58
+ {
59
+ // set the attributes
60
+ $this->_attributes = $usBankAccountAttribs;
61
+
62
+ $achMandate = isset($usBankAccountAttribs['achMandate']) ?
63
+ AchMandate::factory($usBankAccountAttribs['achMandate']) :
64
+ null;
65
+ $this->_set('achMandate', $achMandate);
66
+ }
67
+
68
+ /**
69
+ * create a printable representation of the object as:
70
+ * ClassName[property=value, property=value]
71
+ * @return string
72
+ */
73
+ public function __toString()
74
+ {
75
+ return __CLASS__ . '[' .
76
+ Util::attributesToString($this->_attributes) . ']';
77
+ }
78
+
79
+
80
+ // static methods redirecting to gateway
81
+
82
+ public static function find($token)
83
+ {
84
+ return Configuration::gateway()->usBankAccount()->find($token);
85
+ }
86
+
87
+ public static function sale($token, $transactionAttribs)
88
+ {
89
+ $transactionAttribs['options'] = [
90
+ 'submitForSettlement' => true
91
+ ];
92
+ return Configuration::gateway()->usBankAccount()->sale($token, $transactionAttribs);
93
+ }
94
+ }
95
+ class_alias('Braintree\UsBankAccount', 'Braintree_UsBankAccount');
lib/Jmango360/Braintree/lib/Braintree/UsBankAccountGateway.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use InvalidArgumentException;
5
+
6
+ /**
7
+ * Braintree UsBankAccountGateway module
8
+ *
9
+ * @package Braintree
10
+ * @category Resources
11
+ */
12
+
13
+ /**
14
+ * Manages Braintree UsBankAccounts
15
+ *
16
+ * <b>== More information ==</b>
17
+ *
18
+ *
19
+ * @package Braintree
20
+ * @category Resources
21
+ */
22
+ class UsBankAccountGateway
23
+ {
24
+ private $_gateway;
25
+ private $_config;
26
+ private $_http;
27
+
28
+ public function __construct($gateway)
29
+ {
30
+ $this->_gateway = $gateway;
31
+ $this->_config = $gateway->config;
32
+ $this->_config->assertHasAccessTokenOrKeys();
33
+ $this->_http = new Http($gateway->config);
34
+ }
35
+
36
+
37
+ /**
38
+ * find a usBankAccount by token
39
+ *
40
+ * @access public
41
+ * @param string $token paypal accountunique id
42
+ * @return UsBankAccount
43
+ * @throws Exception\NotFound
44
+ */
45
+ public function find($token)
46
+ {
47
+ try {
48
+ $path = $this->_config->merchantPath() . '/payment_methods/us_bank_account/' . $token;
49
+ $response = $this->_http->get($path);
50
+ return UsBankAccount::factory($response['usBankAccount']);
51
+ } catch (Exception\NotFound $e) {
52
+ throw new Exception\NotFound(
53
+ 'US bank account with token ' . $token . ' not found'
54
+ );
55
+ }
56
+
57
+ }
58
+
59
+ /**
60
+ * create a new sale for the current UsBank account
61
+ *
62
+ * @param string $token
63
+ * @param array $transactionAttribs
64
+ * @return Result\Successful|Result\Error
65
+ * @see Transaction::sale()
66
+ */
67
+ public function sale($token, $transactionAttribs)
68
+ {
69
+ return Transaction::sale(
70
+ array_merge(
71
+ $transactionAttribs,
72
+ ['paymentMethodToken' => $token]
73
+ )
74
+ );
75
+ }
76
+
77
+ /**
78
+ * generic method for validating incoming gateway responses
79
+ *
80
+ * creates a new UsBankAccount object and encapsulates
81
+ * it inside a Result\Successful object, or
82
+ * encapsulates a Errors object inside a Result\Error
83
+ * alternatively, throws an Unexpected exception if the response is invalid.
84
+ *
85
+ * @ignore
86
+ * @param array $response gateway response values
87
+ * @return Result\Successful|Result\Error
88
+ * @throws Exception\Unexpected
89
+ */
90
+ private function _verifyGatewayResponse($response)
91
+ {
92
+ if (isset($response['usBankAccount'])) {
93
+ // return a populated instance of UsBankAccount
94
+ return new Result\Successful(
95
+ UsBankAccount::factory($response['usBankAccount'])
96
+ );
97
+ } else if (isset($response['apiErrorResponse'])) {
98
+ return new Result\Error($response['apiErrorResponse']);
99
+ } else {
100
+ throw new Exception\Unexpected(
101
+ 'Expected US bank account or apiErrorResponse'
102
+ );
103
+ }
104
+ }
105
+ }
106
+ class_alias('Braintree\UsBankAccountGateway', 'Braintree_UsBankAccountGateway');
lib/Jmango360/Braintree/lib/Braintree/Util.php ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ use DateTime;
5
+ use InvalidArgumentException;
6
+
7
+ /**
8
+ * Braintree Utility methods
9
+ * PHP version 5
10
+ */
11
+
12
+ class Util
13
+ {
14
+ /**
15
+ * extracts an attribute and returns an array of objects
16
+ *
17
+ * extracts the requested element from an array, and converts the contents
18
+ * of its child arrays to objects of type $attributeName, or returns
19
+ * an array with a single element containing the value of that array element
20
+ *
21
+ * @param array $attribArray attributes from a search response
22
+ * @param string $attributeName indicates which element of the passed array to extract
23
+ * @return array array of $attributeName objects, or a single element array
24
+ */
25
+ public static function extractAttributeAsArray(&$attribArray, $attributeName)
26
+ {
27
+ if(!isset($attribArray[$attributeName])):
28
+ return [];
29
+ endif;
30
+
31
+ // get what should be an array from the passed array
32
+ $data = $attribArray[$attributeName];
33
+ // set up the class that will be used to convert each array element
34
+ $classFactory = self::buildClassName($attributeName) . '::factory';
35
+ if(is_array($data)):
36
+ // create an object from the data in each element
37
+ $objectArray = array_map($classFactory, $data);
38
+ else:
39
+ return [$data];
40
+ endif;
41
+
42
+ unset($attribArray[$attributeName]);
43
+ return $objectArray;
44
+ }
45
+ /**
46
+ * throws an exception based on the type of error
47
+ * @param string $statusCode HTTP status code to throw exception from
48
+ * @param null|string $message
49
+ * @throws Exception multiple types depending on the error
50
+ * @return void
51
+ */
52
+ public static function throwStatusCodeException($statusCode, $message=null)
53
+ {
54
+ switch($statusCode) {
55
+ case 401:
56
+ throw new Exception\Authentication();
57
+ break;
58
+ case 403:
59
+ throw new Exception\Authorization($message);
60
+ break;
61
+ case 404:
62
+ throw new Exception\NotFound();
63
+ break;
64
+ case 426:
65
+ throw new Exception\UpgradeRequired();
66
+ break;
67
+ case 429:
68
+ throw new Exception\TooManyRequests();
69
+ break;
70
+ case 500:
71
+ throw new Exception\ServerError();
72
+ break;
73
+ case 503:
74
+ throw new Exception\DownForMaintenance();
75
+ break;
76
+ default:
77
+ throw new Exception\Unexpected('Unexpected HTTP_RESPONSE #' . $statusCode);
78
+ break;
79
+ }
80
+ }
81
+
82
+ /**
83
+ *
84
+ * @param string $className
85
+ * @param object $resultObj
86
+ * @return object returns the passed object if successful
87
+ * @throws Exception\ValidationsFailed
88
+ */
89
+ public static function returnObjectOrThrowException($className, $resultObj)
90
+ {
91
+ $resultObjName = self::cleanClassName($className);
92
+ if ($resultObj->success) {
93
+ return $resultObj->$resultObjName;
94
+ } else {
95
+ throw new Exception\ValidationsFailed();
96
+ }
97
+ }
98
+
99
+ /**
100
+ * removes the header from a classname
101
+ *
102
+ * @param string $name ClassName
103
+ * @return camelCased classname minus header
104
+ */
105
+ public static function cleanClassName($name)
106
+ {
107
+ $classNamesToResponseKeys = [
108
+ 'Braintree\CreditCard' => 'creditCard',
109
+ 'Braintree_CreditCard' => 'creditCard',
110
+ 'Braintree\CreditCardGateway' => 'creditCard',
111
+ 'Braintree_CreditCardGateway' => 'creditCard',
112
+ 'Braintree\Customer' => 'customer',
113
+ 'Braintree_Customer' => 'customer',
114
+ 'Braintree\CustomerGateway' => 'customer',
115
+ 'Braintree_CustomerGateway' => 'customer',
116
+ 'Braintree\Subscription' => 'subscription',
117
+ 'Braintree_Subscription' => 'subscription',
118
+ 'Braintree\SubscriptionGateway' => 'subscription',
119
+ 'Braintree_SubscriptionGateway' => 'subscription',
120
+ 'Braintree\Transaction' => 'transaction',
121
+ 'Braintree_Transaction' => 'transaction',
122
+ 'Braintree\TransactionGateway' => 'transaction',
123
+ 'Braintree_TransactionGateway' => 'transaction',
124
+ 'Braintree\CreditCardVerification' => 'verification',
125
+ 'Braintree_CreditCardVerification' => 'verification',
126
+ 'Braintree\CreditCardVerificationGateway' => 'verification',
127
+ 'Braintree_CreditCardVerificationGateway' => 'verification',
128
+ 'Braintree\AddOn' => 'addOn',
129
+ 'Braintree_AddOn' => 'addOn',
130
+ 'Braintree\AddOnGateway' => 'addOn',
131
+ 'Braintree_AddOnGateway' => 'addOn',
132
+ 'Braintree\Discount' => 'discount',
133
+ 'Braintree_Discount' => 'discount',
134
+ 'Braintree\DiscountGateway' => 'discount',
135
+ 'Braintree_DiscountGateway' => 'discount',
136
+ 'Braintree\Plan' => 'plan',
137
+ 'Braintree_Plan' => 'plan',
138
+ 'Braintree\PlanGateway' => 'plan',
139
+ 'Braintree_PlanGateway' => 'plan',
140
+ 'Braintree\Address' => 'address',
141
+ 'Braintree_Address' => 'address',
142
+ 'Braintree\AddressGateway' => 'address',
143
+ 'Braintree_AddressGateway' => 'address',
144
+ 'Braintree\SettlementBatchSummary' => 'settlementBatchSummary',
145
+ 'Braintree_SettlementBatchSummary' => 'settlementBatchSummary',
146
+ 'Braintree\SettlementBatchSummaryGateway' => 'settlementBatchSummary',
147
+ 'Braintree_SettlementBatchSummaryGateway' => 'settlementBatchSummary',
148
+ 'Braintree\Merchant' => 'merchant',
149
+ 'Braintree_Merchant' => 'merchant',
150
+ 'Braintree\MerchantGateway' => 'merchant',
151
+ 'Braintree_MerchantGateway' => 'merchant',
152
+ 'Braintree\MerchantAccount' => 'merchantAccount',
153
+ 'Braintree_MerchantAccount' => 'merchantAccount',
154
+ 'Braintree\MerchantAccountGateway' => 'merchantAccount',
155
+ 'Braintree_MerchantAccountGateway' => 'merchantAccount',
156
+ 'Braintree\OAuthCredentials' => 'credentials',
157
+ 'Braintree_OAuthCredentials' => 'credentials',
158
+ 'Braintree\OAuthResult' => 'result',
159
+ 'Braintree_OAuthResult' => 'result',
160
+ 'Braintree\PayPalAccount' => 'paypalAccount',
161
+ 'Braintree_PayPalAccount' => 'paypalAccount',
162
+ 'Braintree\PayPalAccountGateway' => 'paypalAccount',
163
+ 'Braintree_PayPalAccountGateway' => 'paypalAccount',
164
+ ];
165
+
166
+ return $classNamesToResponseKeys[$name];
167
+ }
168
+
169
+ /**
170
+ *
171
+ * @param string $name className
172
+ * @return string ClassName
173
+ */
174
+ public static function buildClassName($name)
175
+ {
176
+ $responseKeysToClassNames = [
177
+ 'creditCard' => 'Braintree\CreditCard',
178
+ 'customer' => 'Braintree\Customer',
179
+ 'subscription' => 'Braintree\Subscription',
180
+ 'transaction' => 'Braintree\Transaction',
181
+ 'verification' => 'Braintree\CreditCardVerification',
182
+ 'addOn' => 'Braintree\AddOn',
183
+ 'discount' => 'Braintree\Discount',
184
+ 'plan' => 'Braintree\Plan',
185
+ 'address' => 'Braintree\Address',
186
+ 'settlementBatchSummary' => 'Braintree\SettlementBatchSummary',
187
+ 'merchantAccount' => 'Braintree\MerchantAccount',
188
+ ];
189
+
190
+ return (string) $responseKeysToClassNames[$name];
191
+ }
192
+
193
+ /**
194
+ * convert alpha-beta-gamma to alphaBetaGamma
195
+ *
196
+ * @access public
197
+ * @param string $string
198
+ * @param null|string $delimiter
199
+ * @return string modified string
200
+ */
201
+ public static function delimiterToCamelCase($string, $delimiter = '[\-\_]')
202
+ {
203
+ // php doesn't garbage collect functions created by create_function()
204
+ // so use a static variable to avoid adding a new function to memory
205
+ // every time this function is called.
206
+ static $callback = null;
207
+ if ($callback === null) {
208
+ $callback = create_function('$matches', 'return strtoupper($matches[1]);');
209
+ }
210
+
211
+ return preg_replace_callback('/' . $delimiter . '(\w)/', $callback, $string);
212
+ }
213
+
214
+ /**
215
+ * convert alpha-beta-gamma to alpha_beta_gamma
216
+ *
217
+ * @access public
218
+ * @param string $string
219
+ * @return string modified string
220
+ */
221
+ public static function delimiterToUnderscore($string)
222
+ {
223
+ return preg_replace('/-/', '_', $string);
224
+ }
225
+
226
+
227
+ /**
228
+ * find capitals and convert to delimiter + lowercase
229
+ *
230
+ * @access public
231
+ * @param string $string
232
+ * @param null|string $delimiter
233
+ * @return string modified string
234
+ */
235
+ public static function camelCaseToDelimiter($string, $delimiter = '-')
236
+ {
237
+ return strtolower(preg_replace('/([A-Z])/', "$delimiter\\1", $string));
238
+ }
239
+
240
+ public static function delimiterToCamelCaseArray($array, $delimiter = '[\-\_]')
241
+ {
242
+ $converted = [];
243
+ foreach ($array as $key => $value) {
244
+ if (is_string($key)) {
245
+ $key = self::delimiterToCamelCase($key, $delimiter);
246
+ }
247
+
248
+ if (is_array($value)) {
249
+ // Make an exception for custom fields, which must be underscore (can't be
250
+ // camelCase).
251
+ if ($key === 'customFields') {
252
+ $value = self::delimiterToUnderscoreArray($value);
253
+ } else {
254
+ $value = self::delimiterToCamelCaseArray($value, $delimiter);
255
+ }
256
+ }
257
+ $converted[$key] = $value;
258
+ }
259
+ return $converted;
260
+ }
261
+
262
+ public static function camelCaseToDelimiterArray($array, $delimiter = '-')
263
+ {
264
+ $converted = [];
265
+ foreach ($array as $key => $value) {
266
+ if (is_string($key)) {
267
+ $key = self::camelCaseToDelimiter($key, $delimiter);
268
+ }
269
+ if (is_array($value)) {
270
+ $value = self::camelCaseToDelimiterArray($value, $delimiter);
271
+ }
272
+ $converted[$key] = $value;
273
+ }
274
+ return $converted;
275
+ }
276
+
277
+ public static function delimiterToUnderscoreArray($array)
278
+ {
279
+ $converted = [];
280
+ foreach ($array as $key => $value) {
281
+ $key = self::delimiterToUnderscore($key);
282
+ $converted[$key] = $value;
283
+ }
284
+ return $converted;
285
+ }
286
+
287
+ /**
288
+ *
289
+ * @param array $array associative array to implode
290
+ * @param string $separator (optional, defaults to =)
291
+ * @param string $glue (optional, defaults to ', ')
292
+ * @return bool
293
+ */
294
+ public static function implodeAssociativeArray($array, $separator = '=', $glue = ', ')
295
+ {
296
+ // build a new array with joined keys and values
297
+ $tmpArray = null;
298
+ foreach ($array AS $key => $value) {
299
+ if ($value instanceof DateTime) {
300
+ $value = $value->format('r');
301
+ }
302
+ $tmpArray[] = $key . $separator . $value;
303
+ }
304
+ // implode and return the new array
305
+ return (is_array($tmpArray)) ? implode($glue, $tmpArray) : false;
306
+ }
307
+
308
+ public static function attributesToString($attributes) {
309
+ $printableAttribs = [];
310
+ foreach ($attributes AS $key => $value) {
311
+ if (is_array($value)) {
312
+ $pAttrib = self::attributesToString($value);
313
+ } else if ($value instanceof DateTime) {
314
+ $pAttrib = $value->format(DateTime::RFC850);
315
+ } else {
316
+ $pAttrib = $value;
317
+ }
318
+ $printableAttribs[$key] = sprintf('%s', $pAttrib);
319
+ }
320
+ return self::implodeAssociativeArray($printableAttribs);
321
+ }
322
+
323
+ /**
324
+ * verify user request structure
325
+ *
326
+ * compares the expected signature of a gateway request
327
+ * against the actual structure sent by the user
328
+ *
329
+ * @param array $signature
330
+ * @param array $attributes
331
+ */
332
+ public static function verifyKeys($signature, $attributes)
333
+ {
334
+ $validKeys = self::_flattenArray($signature);
335
+ $userKeys = self::_flattenUserKeys($attributes);
336
+ $invalidKeys = array_diff($userKeys, $validKeys);
337
+ $invalidKeys = self::_removeWildcardKeys($validKeys, $invalidKeys);
338
+
339
+ if(!empty($invalidKeys)) {
340
+ asort($invalidKeys);
341
+ $sortedList = join(', ', $invalidKeys);
342
+ throw new InvalidArgumentException('invalid keys: ' . $sortedList);
343
+ }
344
+ }
345
+ /**
346
+ * flattens a numerically indexed nested array to a single level
347
+ * @param array $keys
348
+ * @param string $namespace
349
+ * @return array
350
+ */
351
+ private static function _flattenArray($keys, $namespace = null)
352
+ {
353
+ $flattenedArray = [];
354
+ foreach($keys AS $key) {
355
+ if(is_array($key)) {
356
+ $theKeys = array_keys($key);
357
+ $theValues = array_values($key);
358
+ $scope = $theKeys[0];
359
+ $fullKey = empty($namespace) ? $scope : $namespace . '[' . $scope . ']';
360
+ $flattenedArray = array_merge($flattenedArray, self::_flattenArray($theValues[0], $fullKey));
361
+ } else {
362
+ $fullKey = empty($namespace) ? $key : $namespace . '[' . $key . ']';
363
+ $flattenedArray[] = $fullKey;
364
+ }
365
+ }
366
+ sort($flattenedArray);
367
+ return $flattenedArray;
368
+ }
369
+
370
+ private static function _flattenUserKeys($keys, $namespace = null)
371
+ {
372
+ $flattenedArray = [];
373
+
374
+ foreach($keys AS $key => $value) {
375
+ $fullKey = empty($namespace) ? $key : $namespace;
376
+ if (!is_numeric($key) && $namespace != null) {
377
+ $fullKey .= '[' . $key . ']';
378
+ }
379
+ if (is_numeric($key) && is_string($value)) {
380
+ $fullKey .= '[' . $value . ']';
381
+ }
382
+ if(is_array($value)) {
383
+ $more = self::_flattenUserKeys($value, $fullKey);
384
+ $flattenedArray = array_merge($flattenedArray, $more);
385
+ } else {
386
+ $flattenedArray[] = $fullKey;
387
+ }
388
+ }
389
+ sort($flattenedArray);
390
+ return $flattenedArray;
391
+ }
392
+
393
+ /**
394
+ * removes wildcard entries from the invalid keys array
395
+ * @param array $validKeys
396
+ * @param <array $invalidKeys
397
+ * @return array
398
+ */
399
+ private static function _removeWildcardKeys($validKeys, $invalidKeys)
400
+ {
401
+ foreach($validKeys AS $key) {
402
+ if (stristr($key, '[_anyKey_]')) {
403
+ $wildcardKey = str_replace('[_anyKey_]', '', $key);
404
+ foreach ($invalidKeys AS $index => $invalidKey) {
405
+ if (stristr($invalidKey, $wildcardKey)) {
406
+ unset($invalidKeys[$index]);
407
+ }
408
+ }
409
+ }
410
+ }
411
+ return $invalidKeys;
412
+ }
413
+ }
414
+ class_alias('Braintree\Util', 'Braintree_Util');
lib/Jmango360/Braintree/lib/Braintree/VenmoAccount.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree VenmoAccount module
6
+ * Creates and manages Braintree Venmo accounts
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * See {@link https://developers.braintreepayments.com/javascript+php}<br />
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $createdAt
16
+ * @property-read string $default
17
+ * @property-read string $updatedAt
18
+ * @property-read string $customerId
19
+ * @property-read string $sourceDescription
20
+ * @property-read string $token
21
+ * @property-read string $imageUrl
22
+ * @property-read string $username
23
+ * @property-read string $venmoUserId
24
+ */
25
+ class VenmoAccount extends Base
26
+ {
27
+ /* instance methods */
28
+ /**
29
+ * returns false if default is null or false
30
+ *
31
+ * @return boolean
32
+ */
33
+ public function isDefault()
34
+ {
35
+ return $this->default;
36
+ }
37
+
38
+ /**
39
+ * factory method: returns an instance of VenmoAccount
40
+ * to the requesting method, with populated properties
41
+ *
42
+ * @ignore
43
+ * @return VenmoAccount
44
+ */
45
+ public static function factory($attributes)
46
+ {
47
+
48
+ $instance = new self();
49
+ $instance->_initialize($attributes);
50
+ return $instance;
51
+ }
52
+
53
+ /**
54
+ * sets instance properties from an array of values
55
+ *
56
+ * @access protected
57
+ * @param array $venmoAccountAttribs array of Venmo account properties
58
+ * @return void
59
+ */
60
+ protected function _initialize($venmoAccountAttribs)
61
+ {
62
+ $this->_attributes = $venmoAccountAttribs;
63
+
64
+ $subscriptionArray = array();
65
+ if (isset($venmoAccountAttribs['subscriptions'])) {
66
+ foreach ($venmoAccountAttribs['subscriptions'] AS $subscription) {
67
+ $subscriptionArray[] = Subscription::factory($subscription);
68
+ }
69
+ }
70
+
71
+ $this->_set('subscriptions', $subscriptionArray);
72
+ }
73
+ }
74
+ class_alias('Braintree\VenmoAccount', 'Braintree_VenmoAccount');
lib/Jmango360/Braintree/lib/Braintree/Version.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Library Version
6
+ * stores version information about the Braintree library
7
+ */
8
+ class Version
9
+ {
10
+ /**
11
+ * class constants
12
+ */
13
+ const MAJOR = 3;
14
+ const MINOR = 23;
15
+ const TINY = 1;
16
+
17
+ /**
18
+ * @ignore
19
+ * @access protected
20
+ */
21
+ protected function __construct()
22
+ {
23
+ }
24
+
25
+ /**
26
+ *
27
+ * @return string the current library version
28
+ */
29
+ public static function get()
30
+ {
31
+ return self::MAJOR . '.' . self::MINOR . '.' . self::TINY;
32
+ }
33
+ }
34
+ class_alias('Braintree\Version', 'Braintree_Version');
lib/Jmango360/Braintree/lib/Braintree/VisaCheckoutCard.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree VisaCheckoutCard module
6
+ * Creates and manages Braintree VisaCheckoutCards
7
+ *
8
+ * <b>== More information ==</b>
9
+ *
10
+ * For more detailed information on CreditCard verifications, see {@link http://www.braintreepayments.com/gateway/credit-card-verification-api http://www.braintreepaymentsolutions.com/gateway/credit-card-verification-api}
11
+ *
12
+ * @package Braintree
13
+ * @category Resources
14
+ *
15
+ * @property-read string $billingAddress
16
+ * @property-read string $bin
17
+ * @property-read string $callId
18
+ * @property-read string $cardType
19
+ * @property-read string $cardholderName
20
+ * @property-read string $commercial
21
+ * @property-read string $countryOfIssuance
22
+ * @property-read string $createdAt
23
+ * @property-read string $customerId
24
+ * @property-read string $customerLocation
25
+ * @property-read string $debit
26
+ * @property-read string $default
27
+ * @property-read string $durbinRegulated
28
+ * @property-read string $expirationDate
29
+ * @property-read string $expirationMonth
30
+ * @property-read string $expirationYear
31
+ * @property-read string $expired
32
+ * @property-read string $healthcare
33
+ * @property-read string $imageUrl
34
+ * @property-read string $issuingBank
35
+ * @property-read string $last4
36
+ * @property-read string $maskedNumber
37
+ * @property-read string $payroll
38
+ * @property-read string $prepaid
39
+ * @property-read string $productId
40
+ * @property-read string $subscriptions
41
+ * @property-read string $token
42
+ * @property-read string $uniqueNumberIdentifier
43
+ * @property-read string $updatedAt
44
+ */
45
+ class VisaCheckoutCard extends Base
46
+ {
47
+ /* instance methods */
48
+ /**
49
+ * returns false if default is null or false
50
+ *
51
+ * @return boolean
52
+ */
53
+ public function isDefault()
54
+ {
55
+ return $this->default;
56
+ }
57
+
58
+ /**
59
+ * checks whether the card is expired based on the current date
60
+ *
61
+ * @return boolean
62
+ */
63
+ public function isExpired()
64
+ {
65
+ return $this->expired;
66
+ }
67
+
68
+ /**
69
+ * sets instance properties from an array of values
70
+ *
71
+ * @access protected
72
+ * @param array $creditCardAttribs array of creditcard data
73
+ * @return void
74
+ */
75
+ protected function _initialize($creditCardAttribs)
76
+ {
77
+ // set the attributes
78
+ $this->_attributes = $creditCardAttribs;
79
+
80
+ // map each address into its own object
81
+ $billingAddress = isset($creditCardAttribs['billingAddress']) ?
82
+ Address::factory($creditCardAttribs['billingAddress']) :
83
+ null;
84
+
85
+ $subscriptionArray = [];
86
+ if (isset($creditCardAttribs['subscriptions'])) {
87
+ foreach ($creditCardAttribs['subscriptions'] AS $subscription) {
88
+ $subscriptionArray[] = Subscription::factory($subscription);
89
+ }
90
+ }
91
+
92
+ $this->_set('subscriptions', $subscriptionArray);
93
+ $this->_set('billingAddress', $billingAddress);
94
+ $this->_set('expirationDate', $this->expirationMonth . '/' . $this->expirationYear);
95
+ $this->_set('maskedNumber', $this->bin . '******' . $this->last4);
96
+
97
+ if(isset($creditCardAttribs['verifications']) && count($creditCardAttribs['verifications']) > 0) {
98
+ $verifications = $creditCardAttribs['verifications'];
99
+ usort($verifications, [$this, '_compareCreatedAtOnVerifications']);
100
+
101
+ $this->_set('verification', CreditCardVerification::factory($verifications[0]));
102
+ }
103
+ }
104
+
105
+ private function _compareCreatedAtOnVerifications($verificationAttrib1, $verificationAttrib2)
106
+ {
107
+ return ($verificationAttrib2['createdAt'] < $verificationAttrib1['createdAt']) ? -1 : 1;
108
+ }
109
+
110
+ /**
111
+ * returns false if comparing object is not a VisaCheckoutCard,
112
+ * or is a VisaCheckoutCard with a different id
113
+ *
114
+ * @param object $otherVisaCheckoutCard customer to compare against
115
+ * @return boolean
116
+ */
117
+ public function isEqual($otherVisaCheckoutCard)
118
+ {
119
+ return !($otherVisaCheckoutCard instanceof self) ? false : $this->token === $otherVisaCheckoutCard->token;
120
+ }
121
+
122
+ /**
123
+ * create a printable representation of the object as:
124
+ * ClassName[property=value, property=value]
125
+ * @return string
126
+ */
127
+ public function __toString()
128
+ {
129
+ return __CLASS__ . '[' .
130
+ Util::attributesToString($this->_attributes) .']';
131
+ }
132
+
133
+ /**
134
+ * factory method: returns an instance of VisaCheckoutCard
135
+ * to the requesting method, with populated properties
136
+ *
137
+ * @ignore
138
+ * @return VisaCheckoutCard
139
+ */
140
+ public static function factory($attributes)
141
+ {
142
+ $defaultAttributes = [
143
+ 'bin' => '',
144
+ 'expirationMonth' => '',
145
+ 'expirationYear' => '',
146
+ 'last4' => '',
147
+ ];
148
+
149
+ $instance = new self();
150
+ $instance->_initialize(array_merge($defaultAttributes, $attributes));
151
+ return $instance;
152
+ }
153
+ }
154
+ class_alias('Braintree\VisaCheckoutCard', 'Braintree_VisaCheckoutCard');
lib/Jmango360/Braintree/lib/Braintree/WebhookNotification.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class WebhookNotification extends Base
5
+ {
6
+ const SUBSCRIPTION_CANCELED = 'subscription_canceled';
7
+ const SUBSCRIPTION_CHARGED_SUCCESSFULLY = 'subscription_charged_successfully';
8
+ const SUBSCRIPTION_CHARGED_UNSUCCESSFULLY = 'subscription_charged_unsuccessfully';
9
+ const SUBSCRIPTION_EXPIRED = 'subscription_expired';
10
+ const SUBSCRIPTION_TRIAL_ENDED = 'subscription_trial_ended';
11
+ const SUBSCRIPTION_WENT_ACTIVE = 'subscription_went_active';
12
+ const SUBSCRIPTION_WENT_PAST_DUE = 'subscription_went_past_due';
13
+ const SUB_MERCHANT_ACCOUNT_APPROVED = 'sub_merchant_account_approved';
14
+ const SUB_MERCHANT_ACCOUNT_DECLINED = 'sub_merchant_account_declined';
15
+ const TRANSACTION_DISBURSED = 'transaction_disbursed';
16
+ const TRANSACTION_SETTLED = 'transaction_settled';
17
+ const TRANSACTION_SETTLEMENT_DECLINED = 'transaction_settlement_declined';
18
+ const DISBURSEMENT_EXCEPTION = 'disbursement_exception';
19
+ const DISBURSEMENT = 'disbursement';
20
+ const DISPUTE_OPENED = 'dispute_opened';
21
+ const DISPUTE_LOST = 'dispute_lost';
22
+ const DISPUTE_WON = 'dispute_won';
23
+ const PARTNER_MERCHANT_CONNECTED = 'partner_merchant_connected';
24
+ const PARTNER_MERCHANT_DISCONNECTED = 'partner_merchant_disconnected';
25
+ const PARTNER_MERCHANT_DECLINED = 'partner_merchant_declined';
26
+ const CHECK = 'check';
27
+ const ACCOUNT_UPDATER_DAILY_REPORT = 'account_updater_daily_report';
28
+ const CONNECTED_MERCHANT_STATUS_TRANSITIONED = 'connected_merchant_status_transitioned';
29
+ const CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED = 'connected_merchant_paypal_status_changed';
30
+
31
+ public static function parse($signature, $payload) {
32
+ return Configuration::gateway()->webhookNotification()->parse($signature, $payload);
33
+ }
34
+
35
+ public static function verify($challenge) {
36
+ return Configuration::gateway()->webhookNotification()->verify($challenge);
37
+ }
38
+
39
+ public static function factory($attributes)
40
+ {
41
+ $instance = new self();
42
+ $instance->_initialize($attributes);
43
+ return $instance;
44
+ }
45
+
46
+ protected function _initialize($attributes)
47
+ {
48
+ $this->_attributes = $attributes;
49
+
50
+ if (isset($attributes['subject']['apiErrorResponse'])) {
51
+ $wrapperNode = $attributes['subject']['apiErrorResponse'];
52
+ } else {
53
+ $wrapperNode = $attributes['subject'];
54
+ }
55
+
56
+ if (isset($wrapperNode['subscription'])) {
57
+ $this->_set('subscription', Subscription::factory($attributes['subject']['subscription']));
58
+ }
59
+
60
+ if (isset($wrapperNode['merchantAccount'])) {
61
+ $this->_set('merchantAccount', MerchantAccount::factory($wrapperNode['merchantAccount']));
62
+ }
63
+
64
+ if (isset($wrapperNode['transaction'])) {
65
+ $this->_set('transaction', Transaction::factory($wrapperNode['transaction']));
66
+ }
67
+
68
+ if (isset($wrapperNode['disbursement'])) {
69
+ $this->_set('disbursement', Disbursement::factory($wrapperNode['disbursement']));
70
+ }
71
+
72
+ if (isset($wrapperNode['partnerMerchant'])) {
73
+ $this->_set('partnerMerchant', PartnerMerchant::factory($wrapperNode['partnerMerchant']));
74
+ }
75
+
76
+ if (isset($wrapperNode['connectedMerchantStatusTransitioned'])) {
77
+ $this->_set('connectedMerchantStatusTransitioned', ConnectedMerchantStatusTransitioned::factory($wrapperNode['connectedMerchantStatusTransitioned']));
78
+ }
79
+
80
+ if (isset($wrapperNode['connectedMerchantPaypalStatusChanged'])) {
81
+ $this->_set('connectedMerchantPayPalStatusChanged', ConnectedMerchantPayPalStatusChanged::factory($wrapperNode['connectedMerchantPaypalStatusChanged']));
82
+ }
83
+
84
+ if (isset($wrapperNode['dispute'])) {
85
+ $this->_set('dispute', Dispute::factory($wrapperNode['dispute']));
86
+ }
87
+
88
+ if (isset($wrapperNode['accountUpdaterDailyReport'])) {
89
+ $this->_set('accountUpdaterDailyReport', AccountUpdaterDailyReport::factory($wrapperNode['accountUpdaterDailyReport']));
90
+ }
91
+
92
+ if (isset($wrapperNode['errors'])) {
93
+ $this->_set('errors', new Error\ValidationErrorCollection($wrapperNode['errors']));
94
+ $this->_set('message', $wrapperNode['message']);
95
+ }
96
+ }
97
+ }
98
+ class_alias('Braintree\WebhookNotification', 'Braintree_WebhookNotification');
lib/Jmango360/Braintree/lib/Braintree/WebhookNotificationGateway.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class WebhookNotificationGateway
5
+ {
6
+
7
+ public function __construct($gateway)
8
+ {
9
+ $this->config = $gateway->config;
10
+ $this->config->assertHasAccessTokenOrKeys();
11
+ }
12
+
13
+ public function parse($signature, $payload)
14
+ {
15
+ if (preg_match("/[^A-Za-z0-9+=\/\n]/", $payload) === 1) {
16
+ throw new Exception\InvalidSignature("payload contains illegal characters");
17
+ }
18
+
19
+ self::_validateSignature($signature, $payload);
20
+
21
+ $xml = base64_decode($payload);
22
+ $attributes = Xml::buildArrayFromXml($xml);
23
+ return WebhookNotification::factory($attributes['notification']);
24
+ }
25
+
26
+ public function verify($challenge)
27
+ {
28
+ if (!preg_match('/^[a-f0-9]{20,32}$/', $challenge)) {
29
+ throw new Exception\InvalidChallenge("challenge contains non-hex characters");
30
+ }
31
+ $publicKey = $this->config->publicKey();
32
+ $digest = Digest::hexDigestSha1($this->config->privateKey(), $challenge);
33
+ return "{$publicKey}|{$digest}";
34
+ }
35
+
36
+ private function _payloadMatches($signature, $payload)
37
+ {
38
+ $payloadSignature = Digest::hexDigestSha1($this->config->privateKey(), $payload);
39
+ return Digest::secureCompare($signature, $payloadSignature);
40
+ }
41
+
42
+ private function _validateSignature($signatureString, $payload)
43
+ {
44
+ $signaturePairs = preg_split("/&/", $signatureString);
45
+ $signature = self::_matchingSignature($signaturePairs);
46
+ if (!$signature) {
47
+ throw new Exception\InvalidSignature("no matching public key");
48
+ }
49
+
50
+ if (!(self::_payloadMatches($signature, $payload) || self::_payloadMatches($signature, $payload . "\n"))) {
51
+ throw new Exception\InvalidSignature("signature does not match payload - one has been modified");
52
+ }
53
+ }
54
+
55
+ private function _matchingSignature($signaturePairs)
56
+ {
57
+ foreach ($signaturePairs as $pair)
58
+ {
59
+ $components = preg_split("/\|/", $pair);
60
+ if ($components[0] == $this->config->publicKey()) {
61
+ return $components[1];
62
+ }
63
+ }
64
+
65
+ return null;
66
+ }
67
+ }
68
+
69
+ class_alias('Braintree\WebhookNotificationGateway', 'Braintree_WebhookNotificationGateway');
lib/Jmango360/Braintree/lib/Braintree/WebhookTesting.php ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ class WebhookTesting
5
+ {
6
+ public static function sampleNotification($kind, $id)
7
+ {
8
+ $payload = base64_encode(self::_sampleXml($kind, $id)) . "\n";
9
+ $signature = Configuration::publicKey() . "|" . Digest::hexDigestSha1(Configuration::privateKey(), $payload);
10
+
11
+ return [
12
+ 'bt_signature' => $signature,
13
+ 'bt_payload' => $payload
14
+ ];
15
+ }
16
+
17
+ private static function _sampleXml($kind, $id)
18
+ {
19
+ switch ($kind) {
20
+ case WebhookNotification::SUB_MERCHANT_ACCOUNT_APPROVED:
21
+ $subjectXml = self::_merchantAccountApprovedSampleXml($id);
22
+ break;
23
+ case WebhookNotification::SUB_MERCHANT_ACCOUNT_DECLINED:
24
+ $subjectXml = self::_merchantAccountDeclinedSampleXml($id);
25
+ break;
26
+ case WebhookNotification::TRANSACTION_DISBURSED:
27
+ $subjectXml = self::_transactionDisbursedSampleXml($id);
28
+ break;
29
+ case WebhookNotification::TRANSACTION_SETTLED:
30
+ $subjectXml = self::_transactionSettledSampleXml($id);
31
+ break;
32
+ case WebhookNotification::TRANSACTION_SETTLEMENT_DECLINED:
33
+ $subjectXml = self::_transactionSettlementDeclinedSampleXml($id);
34
+ break;
35
+ case WebhookNotification::DISBURSEMENT_EXCEPTION:
36
+ $subjectXml = self::_disbursementExceptionSampleXml($id);
37
+ break;
38
+ case WebhookNotification::DISBURSEMENT:
39
+ $subjectXml = self::_disbursementSampleXml($id);
40
+ break;
41
+ case WebhookNotification::PARTNER_MERCHANT_CONNECTED:
42
+ $subjectXml = self::_partnerMerchantConnectedSampleXml($id);
43
+ break;
44
+ case WebhookNotification::PARTNER_MERCHANT_DISCONNECTED:
45
+ $subjectXml = self::_partnerMerchantDisconnectedSampleXml($id);
46
+ break;
47
+ case WebhookNotification::PARTNER_MERCHANT_DECLINED:
48
+ $subjectXml = self::_partnerMerchantDeclinedSampleXml($id);
49
+ break;
50
+ case WebhookNotification::CONNECTED_MERCHANT_STATUS_TRANSITIONED:
51
+ $subjectXml = self::_connectedMerchantStatusTransitionedSampleXml($id);
52
+ break;
53
+ case WebhookNotification::CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED:
54
+ $subjectXml = self::_connectedMerchantPayPalStatusChangedSampleXml($id);
55
+ break;
56
+ case WebhookNotification::DISPUTE_OPENED:
57
+ $subjectXml = self::_disputeOpenedSampleXml($id);
58
+ break;
59
+ case WebhookNotification::DISPUTE_LOST:
60
+ $subjectXml = self::_disputeLostSampleXml($id);
61
+ break;
62
+ case WebhookNotification::DISPUTE_WON:
63
+ $subjectXml = self::_disputeWonSampleXml($id);
64
+ break;
65
+ case WebhookNotification::SUBSCRIPTION_CHARGED_SUCCESSFULLY:
66
+ $subjectXml = self::_subscriptionChargedSuccessfullySampleXml($id);
67
+ break;
68
+ case WebhookNotification::CHECK:
69
+ $subjectXml = self::_checkSampleXml();
70
+ break;
71
+ case WebhookNotification::ACCOUNT_UPDATER_DAILY_REPORT:
72
+ $subjectXml = self::_accountUpdaterDailyReportSampleXml($id);
73
+ break;
74
+ default:
75
+ $subjectXml = self::_subscriptionSampleXml($id);
76
+ break;
77
+ }
78
+ $timestamp = self::_timestamp();
79
+ return "
80
+ <notification>
81
+ <timestamp type=\"datetime\">{$timestamp}</timestamp>
82
+ <kind>{$kind}</kind>
83
+ <subject>{$subjectXml}</subject>
84
+ </notification>
85
+ ";
86
+ }
87
+
88
+ private static function _merchantAccountApprovedSampleXml($id)
89
+ {
90
+ return "
91
+ <merchant_account>
92
+ <id>{$id}</id>
93
+ <master_merchant_account>
94
+ <id>master_ma_for_{$id}</id>
95
+ <status>active</status>
96
+ </master_merchant_account>
97
+ <status>active</status>
98
+ </merchant_account>
99
+ ";
100
+ }
101
+
102
+ private static function _merchantAccountDeclinedSampleXml($id)
103
+ {
104
+ return "
105
+ <api-error-response>
106
+ <message>Credit score is too low</message>
107
+ <errors>
108
+ <errors type=\"array\"/>
109
+ <merchant-account>
110
+ <errors type=\"array\">
111
+ <error>
112
+ <code>82621</code>
113
+ <message>Credit score is too low</message>
114
+ <attribute type=\"symbol\">base</attribute>
115
+ </error>
116
+ </errors>
117
+ </merchant-account>
118
+ </errors>
119
+ <merchant-account>
120
+ <id>{$id}</id>
121
+ <status>suspended</status>
122
+ <master-merchant-account>
123
+ <id>master_ma_for_{$id}</id>
124
+ <status>suspended</status>
125
+ </master-merchant-account>
126
+ </merchant-account>
127
+ </api-error-response>
128
+ ";
129
+ }
130
+
131
+ private static function _transactionDisbursedSampleXml($id)
132
+ {
133
+ return "
134
+ <transaction>
135
+ <id>${id}</id>
136
+ <amount>100</amount>
137
+ <disbursement-details>
138
+ <disbursement-date type=\"date\">2013-07-09</disbursement-date>
139
+ </disbursement-details>
140
+ </transaction>
141
+ ";
142
+ }
143
+
144
+ private static function _transactionSettledSampleXml($id)
145
+ {
146
+ return "
147
+ <transaction>
148
+ <id>${id}</id>
149
+ <status>settled</status>
150
+ <type>sale</type>
151
+ <currency-iso-code>USD</currency-iso-code>
152
+ <amount>100.00</amount>
153
+ <merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
154
+ <payment-instrument-type>us_bank_account</payment-instrument-type>
155
+ <us-bank-account>
156
+ <routing-number>123456789</routing-number>
157
+ <last-4>1234</last-4>
158
+ <account-type>checking</account-type>
159
+ <account-holder-name>Dan Schulman</account-holder-name>
160
+ </us-bank-account>
161
+ </transaction>
162
+ ";
163
+ }
164
+
165
+ private static function _transactionSettlementDeclinedSampleXml($id)
166
+ {
167
+ return "
168
+ <transaction>
169
+ <id>${id}</id>
170
+ <status>settlement_declined</status>
171
+ <type>sale</type>
172
+ <currency-iso-code>USD</currency-iso-code>
173
+ <amount>100.00</amount>
174
+ <merchant-account-id>ogaotkivejpfayqfeaimuktty</merchant-account-id>
175
+ <payment-instrument-type>us_bank_account</payment-instrument-type>
176
+ <us-bank-account>
177
+ <routing-number>123456789</routing-number>
178
+ <last-4>1234</last-4>
179
+ <account-type>checking</account-type>
180
+ <account-holder-name>Dan Schulman</account-holder-name>
181
+ </us-bank-account>
182
+ </transaction>
183
+ ";
184
+ }
185
+
186
+ private static function _disbursementExceptionSampleXml($id)
187
+ {
188
+ return "
189
+ <disbursement>
190
+ <id>${id}</id>
191
+ <transaction-ids type=\"array\">
192
+ <item>asdfg</item>
193
+ <item>qwert</item>
194
+ </transaction-ids>
195
+ <success type=\"boolean\">false</success>
196
+ <retry type=\"boolean\">false</retry>
197
+ <merchant-account>
198
+ <id>merchant_account_token</id>
199
+ <currency-iso-code>USD</currency-iso-code>
200
+ <sub-merchant-account type=\"boolean\">false</sub-merchant-account>
201
+ <status>active</status>
202
+ </merchant-account>
203
+ <amount>100.00</amount>
204
+ <disbursement-date type=\"date\">2014-02-10</disbursement-date>
205
+ <exception-message>bank_rejected</exception-message>
206
+ <follow-up-action>update_funding_information</follow-up-action>
207
+ </disbursement>
208
+ ";
209
+ }
210
+
211
+ private static function _disbursementSampleXml($id)
212
+ {
213
+ return "
214
+ <disbursement>
215
+ <id>${id}</id>
216
+ <transaction-ids type=\"array\">
217
+ <item>asdfg</item>
218
+ <item>qwert</item>
219
+ </transaction-ids>
220
+ <success type=\"boolean\">true</success>
221
+ <retry type=\"boolean\">false</retry>
222
+ <merchant-account>
223
+ <id>merchant_account_token</id>
224
+ <currency-iso-code>USD</currency-iso-code>
225
+ <sub-merchant-account type=\"boolean\">false</sub-merchant-account>
226
+ <status>active</status>
227
+ </merchant-account>
228
+ <amount>100.00</amount>
229
+ <disbursement-date type=\"date\">2014-02-10</disbursement-date>
230
+ <exception-message nil=\"true\"/>
231
+ <follow-up-action nil=\"true\"/>
232
+ </disbursement>
233
+ ";
234
+ }
235
+
236
+ private static function _disputeOpenedSampleXml($id)
237
+ {
238
+ return "
239
+ <dispute>
240
+ <amount>250.00</amount>
241
+ <currency-iso-code>USD</currency-iso-code>
242
+ <received-date type=\"date\">2014-03-01</received-date>
243
+ <reply-by-date type=\"date\">2014-03-21</reply-by-date>
244
+ <kind>chargeback</kind>
245
+ <status>open</status>
246
+ <reason>fraud</reason>
247
+ <id>${id}</id>
248
+ <transaction>
249
+ <id>${id}</id>
250
+ <amount>250.00</amount>
251
+ </transaction>
252
+ <date-opened type=\"date\">2014-03-21</date-opened>
253
+ </dispute>
254
+ ";
255
+ }
256
+
257
+ private static function _disputeLostSampleXml($id)
258
+ {
259
+ return "
260
+ <dispute>
261
+ <amount>250.00</amount>
262
+ <currency-iso-code>USD</currency-iso-code>
263
+ <received-date type=\"date\">2014-03-01</received-date>
264
+ <reply-by-date type=\"date\">2014-03-21</reply-by-date>
265
+ <kind>chargeback</kind>
266
+ <status>lost</status>
267
+ <reason>fraud</reason>
268
+ <id>${id}</id>
269
+ <transaction>
270
+ <id>${id}</id>
271
+ <amount>250.00</amount>
272
+ <next_billing-date type=\"date\">2020-02-10</next_billing-date>
273
+ </transaction>
274
+ <date-opened type=\"date\">2014-03-21</date-opened>
275
+ </dispute>
276
+ ";
277
+ }
278
+
279
+ private static function _disputeWonSampleXml($id)
280
+ {
281
+ return "
282
+ <dispute>
283
+ <amount>250.00</amount>
284
+ <currency-iso-code>USD</currency-iso-code>
285
+ <received-date type=\"date\">2014-03-01</received-date>
286
+ <reply-by-date type=\"date\">2014-03-21</reply-by-date>
287
+ <kind>chargeback</kind>
288
+ <status>won</status>
289
+ <reason>fraud</reason>
290
+ <id>${id}</id>
291
+ <transaction>
292
+ <id>${id}</id>
293
+ <amount>250.00</amount>
294
+ </transaction>
295
+ <date-opened type=\"date\">2014-03-21</date-opened>
296
+ <date-won type=\"date\">2014-03-22</date-won>
297
+ </dispute>
298
+ ";
299
+ }
300
+
301
+ private static function _subscriptionSampleXml($id)
302
+ {
303
+ return "
304
+ <subscription>
305
+ <id>{$id}</id>
306
+ <transactions type=\"array\">
307
+ </transactions>
308
+ <add_ons type=\"array\">
309
+ </add_ons>
310
+ <discounts type=\"array\">
311
+ </discounts>
312
+ </subscription>
313
+ ";
314
+ }
315
+
316
+ private static function _subscriptionChargedSuccessfullySampleXml($id)
317
+ {
318
+ return "
319
+ <subscription>
320
+ <id>{$id}</id>
321
+ <billing-period-start-date type=\"date\">2016-03-21</billing-period-start-date>
322
+ <billing-period-end-date type=\"date\">2017-03-31</billing-period-end-date>
323
+ <transactions type=\"array\">
324
+ <transaction>
325
+ <status>submitted_for_settlement</status>
326
+ <amount>49.99</amount>
327
+ </transaction>
328
+ </transactions>
329
+ <add_ons type=\"array\">
330
+ </add_ons>
331
+ <discounts type=\"array\">
332
+ </discounts>
333
+ </subscription>
334
+ ";
335
+ }
336
+
337
+ private static function _checkSampleXml()
338
+ {
339
+ return "
340
+ <check type=\"boolean\">true</check>
341
+ ";
342
+ }
343
+
344
+ private static function _partnerMerchantConnectedSampleXml($id)
345
+ {
346
+ return "
347
+ <partner-merchant>
348
+ <merchant-public-id>public_id</merchant-public-id>
349
+ <public-key>public_key</public-key>
350
+ <private-key>private_key</private-key>
351
+ <partner-merchant-id>abc123</partner-merchant-id>
352
+ <client-side-encryption-key>cse_key</client-side-encryption-key>
353
+ </partner-merchant>
354
+ ";
355
+ }
356
+
357
+ private static function _partnerMerchantDisconnectedSampleXml($id)
358
+ {
359
+ return "
360
+ <partner-merchant>
361
+ <partner-merchant-id>abc123</partner-merchant-id>
362
+ </partner-merchant>
363
+ ";
364
+ }
365
+
366
+ private static function _partnerMerchantDeclinedSampleXml($id)
367
+ {
368
+ return "
369
+ <partner-merchant>
370
+ <partner-merchant-id>abc123</partner-merchant-id>
371
+ </partner-merchant>
372
+ ";
373
+ }
374
+
375
+ private static function _accountUpdaterDailyReportSampleXml($id)
376
+ {
377
+ return "
378
+ <account-updater-daily-report>
379
+ <report-date type=\"date\">2016-01-14</report-date>
380
+ <report-url>link-to-csv-report</report-url>
381
+ </account-updater-daily-report>
382
+ ";
383
+ }
384
+
385
+ private static function _connectedMerchantStatusTransitionedSampleXml($id)
386
+ {
387
+ return "
388
+ <connected-merchant-status-transitioned>
389
+ <merchant-public-id>{$id}</merchant-public-id>
390
+ <status>new_status</status>
391
+ <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
392
+ </connected-merchant-status-transitioned>
393
+ ";
394
+ }
395
+
396
+ private static function _connectedMerchantPayPalStatusChangedSampleXml($id)
397
+ {
398
+ return "
399
+ <connected-merchant-paypal-status-changed>
400
+ <merchant-public-id>{$id}</merchant-public-id>
401
+ <action>link</action>
402
+ <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
403
+ </connected-merchant-paypal-status-changed>
404
+ ";
405
+ }
406
+
407
+ private static function _timestamp()
408
+ {
409
+ $originalZone = date_default_timezone_get();
410
+ date_default_timezone_set('UTC');
411
+ $timestamp = strftime('%Y-%m-%dT%TZ');
412
+ date_default_timezone_set($originalZone);
413
+
414
+ return $timestamp;
415
+ }
416
+ }
417
+ class_alias('Braintree\WebhookTesting', 'Braintree_WebhookTesting');
lib/Jmango360/Braintree/lib/Braintree/Xml.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree;
3
+
4
+ /**
5
+ * Braintree Xml parser and generator
6
+ * PHP version 5
7
+ * superclass for Braintree XML parsing and generation
8
+ */
9
+ class Xml
10
+ {
11
+ /**
12
+ * @ignore
13
+ */
14
+ protected function __construct()
15
+ {
16
+
17
+ }
18
+
19
+ /**
20
+ *
21
+ * @param string $xml
22
+ * @return array
23
+ */
24
+ public static function buildArrayFromXml($xml)
25
+ {
26
+ return Xml\Parser::arrayFromXml($xml);
27
+ }
28
+
29
+ /**
30
+ *
31
+ * @param array $array
32
+ * @return string
33
+ */
34
+ public static function buildXmlFromArray($array)
35
+ {
36
+ return Xml\Generator::arrayToXml($array);
37
+ }
38
+ }
39
+ class_alias('Braintree\Xml', 'Braintree_Xml');
lib/Jmango360/Braintree/lib/Braintree/Xml/Generator.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Xml;
3
+
4
+ use DateTime;
5
+ use DateTimeZone;
6
+ use XMLWriter;
7
+ use Braintree\Util;
8
+
9
+ /**
10
+ * PHP version 5
11
+ */
12
+
13
+ /**
14
+ * Generates XML output from arrays using PHP's
15
+ * built-in XMLWriter
16
+ */
17
+ class Generator
18
+ {
19
+ /**
20
+ * arrays passed to this method should have a single root element
21
+ * with an array as its value
22
+ * @param array $aData the array of data
23
+ * @return string XML string
24
+ */
25
+ public static function arrayToXml($aData)
26
+ {
27
+ $aData = Util::camelCaseToDelimiterArray($aData, '-');
28
+ // set up the XMLWriter
29
+ $writer = new XMLWriter();
30
+ $writer->openMemory();
31
+
32
+ $writer->setIndent(true);
33
+ $writer->setIndentString(' ');
34
+ $writer->startDocument('1.0', 'UTF-8');
35
+
36
+ // get the root element name
37
+ $aKeys = array_keys($aData);
38
+ $rootElementName = $aKeys[0];
39
+ // open the root element
40
+ $writer->startElement($rootElementName);
41
+ // create the body
42
+ self::_createElementsFromArray($writer, $aData[$rootElementName], $rootElementName);
43
+
44
+ // close the root element and document
45
+ $writer->endElement();
46
+ $writer->endDocument();
47
+
48
+ // send the output as string
49
+ return $writer->outputMemory();
50
+ }
51
+
52
+ /**
53
+ * Construct XML elements with attributes from an associative array.
54
+ *
55
+ * @access protected
56
+ * @static
57
+ * @param object $writer XMLWriter object
58
+ * @param array $aData contains attributes and values
59
+ * @return void
60
+ */
61
+ private static function _createElementsFromArray(&$writer, $aData)
62
+ {
63
+ if (!is_array($aData)) {
64
+ if (is_bool($aData)) {
65
+ $writer->text($aData ? 'true' : 'false');
66
+ } else {
67
+ $writer->text($aData);
68
+ }
69
+ return;
70
+ }
71
+ foreach ($aData AS $elementName => $element) {
72
+ // handle child elements
73
+ $writer->startElement($elementName);
74
+ if (is_array($element)) {
75
+ if (array_key_exists(0, $element) || empty($element)) {
76
+ $writer->writeAttribute('type', 'array');
77
+ foreach ($element AS $ignored => $itemInArray) {
78
+ $writer->startElement('item');
79
+ self::_createElementsFromArray($writer, $itemInArray);
80
+ $writer->endElement();
81
+ }
82
+ }
83
+ else {
84
+ self::_createElementsFromArray($writer, $element);
85
+ }
86
+ } else {
87
+ // generate attributes as needed
88
+ $attribute = self::_generateXmlAttribute($element);
89
+ if (is_array($attribute)) {
90
+ $writer->writeAttribute($attribute[0], $attribute[1]);
91
+ $element = $attribute[2];
92
+ }
93
+ $writer->text($element);
94
+ }
95
+ $writer->endElement();
96
+ }
97
+ }
98
+
99
+ /**
100
+ * convert passed data into an array of attributeType, attributeName, and value
101
+ * dates sent as DateTime objects will be converted to strings
102
+ * @access protected
103
+ * @param mixed $value
104
+ * @return array attributes and element value
105
+ */
106
+ private static function _generateXmlAttribute($value)
107
+ {
108
+ if ($value instanceof DateTime) {
109
+ return ['type', 'datetime', self::_dateTimeToXmlTimestamp($value)];
110
+ }
111
+ if (is_int($value)) {
112
+ return ['type', 'integer', $value];
113
+ }
114
+ if (is_bool($value)) {
115
+ return ['type', 'boolean', ($value ? 'true' : 'false')];
116
+ }
117
+ if ($value === NULL) {
118
+ return ['nil', 'true', $value];
119
+ }
120
+ }
121
+ /**
122
+ * converts datetime back to xml schema format
123
+ * @access protected
124
+ * @param object $dateTime
125
+ * @return string XML schema formatted timestamp
126
+ */
127
+ private static function _dateTimeToXmlTimestamp($dateTime)
128
+ {
129
+ $dateTimeForUTC = clone $dateTime;
130
+
131
+ $dateTimeForUTC->setTimeZone(new DateTimeZone('UTC'));
132
+ return ($dateTimeForUTC->format('Y-m-d\TH:i:s') . 'Z');
133
+ }
134
+
135
+ private static function _castDateTime($string)
136
+ {
137
+ try {
138
+ if (empty($string)) {
139
+ return false;
140
+ }
141
+ $dateTime = new DateTime($string);
142
+ return self::_dateTimeToXmlTimestamp($dateTime);
143
+ } catch (Exception $e) {
144
+ // not a datetime
145
+ return false;
146
+ }
147
+ }
148
+ }
149
+ class_alias('Braintree\Xml\Generator', 'Braintree_Xml_Generator');
lib/Jmango360/Braintree/lib/Braintree/Xml/Parser.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Braintree\Xml;
3
+
4
+ use DateTime;
5
+ use DateTimeZone;
6
+ use DOMDocument;
7
+ use DOMElement;
8
+ use DOMText;
9
+ use Braintree\Util;
10
+
11
+ /**
12
+ * Braintree XML Parser
13
+ */
14
+ class Parser
15
+ {
16
+ /**
17
+ * Converts an XML string into a multidimensional array
18
+ *
19
+ * @param string $xml
20
+ * @return array
21
+ */
22
+ public static function arrayFromXml($xml)
23
+ {
24
+ $document = new DOMDocument('1.0', 'UTF-8');
25
+ $document->loadXML($xml);
26
+
27
+ $root = $document->documentElement->nodeName;
28
+
29
+ return Util::delimiterToCamelCaseArray([
30
+ $root => self::_nodeToValue($document->childNodes->item(0)),
31
+ ]);
32
+ }
33
+
34
+ /**
35
+ * Converts a node to an array of values or nodes
36
+ *
37
+ * @param DOMNode @node
38
+ * @return mixed
39
+ */
40
+ private static function _nodeToArray($node)
41
+ {
42
+ $type = null;
43
+ if ($node instanceof DOMElement) {
44
+ $type = $node->getAttribute('type');
45
+ }
46
+
47
+ switch($type) {
48
+ case 'array':
49
+ $array = [];
50
+ foreach ($node->childNodes as $child) {
51
+ $value = self::_nodeToValue($child);
52
+ if ($value !== null) {
53
+ $array[] = $value;
54
+ }
55
+ }
56
+ return $array;
57
+ case 'collection':
58
+ $collection = [];
59
+ foreach ($node->childNodes as $child) {
60
+ $value = self::_nodetoValue($child);
61
+ if ($value !== null) {
62
+ if (!isset($collection[$child->nodeName])) {
63
+ $collection[$child->nodeName] = [];
64
+ }
65
+ $collection[$child->nodeName][] = self::_nodeToValue($child);
66
+ }
67
+ }
68
+ return $collection;
69
+ default:
70
+ $values = [];
71
+ if ($node->childNodes->length === 1 && $node->childNodes->item(0) instanceof DOMText) {
72
+ return $node->childNodes->item(0)->nodeValue;
73
+ } else {
74
+ foreach ($node->childNodes as $child) {
75
+ if (!$child instanceof DOMText) {
76
+ $values[$child->nodeName] = self::_nodeToValue($child);
77
+ }
78
+ }
79
+ return $values;
80
+ }
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Converts a node to a PHP value
86
+ *
87
+ * @param DOMNode $node
88
+ * @return mixed
89
+ */
90
+ private static function _nodeToValue($node)
91
+ {
92
+ $type = null;
93
+ if ($node instanceof DOMElement) {
94
+ $type = $node->getAttribute('type');
95
+ }
96
+
97
+ switch($type) {
98
+ case 'datetime':
99
+ return self::_timestampToUTC((string) $node->nodeValue);
100
+ case 'date':
101
+ return new DateTime((string) $node->nodeValue);
102
+ case 'integer':
103
+ return (int) $node->nodeValue;
104
+ case 'boolean':
105
+ $value = (string) $node->nodeValue;
106
+ if(is_numeric($value)) {
107
+ return (bool) $value;
108
+ } else {
109
+ return ($value !== "true") ? false : true;
110
+ }
111
+ case 'array':
112
+ case 'collection':
113
+ return self::_nodeToArray($node);
114
+ default:
115
+ if ($node->hasChildNodes()) {
116
+ return self::_nodeToArray($node);
117
+ } elseif (trim($node->nodeValue) === '') {
118
+ return null;
119
+ } else {
120
+ return $node->nodeValue;
121
+ }
122
+ }
123
+ }
124
+
125
+
126
+ /**
127
+ * Converts XML timestamps into DateTime instances
128
+ *
129
+ * @param string $timestamp
130
+ * @return DateTime
131
+ */
132
+ private static function _timestampToUTC($timestamp)
133
+ {
134
+ $tz = new DateTimeZone('UTC');
135
+ $dateTime = new DateTime($timestamp, $tz);
136
+ $dateTime->setTimezone($tz);
137
+ return $dateTime;
138
+ }
139
+ }
140
+ class_alias('Braintree\Xml\Parser', 'Braintree_Xml_Parser');
lib/Jmango360/Braintree/lib/autoload.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ spl_autoload_register(function ($className) {
4
+ if (strpos($className, 'Braintree') !== 0) {
5
+ return;
6
+ }
7
+
8
+ $fileName = dirname(__DIR__) . '/lib/';
9
+
10
+ if ($lastNsPos = strripos($className, '\\')) {
11
+ $namespace = substr($className, 0, $lastNsPos);
12
+ $className = substr($className, $lastNsPos + 1);
13
+ $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
14
+ }
15
+
16
+ $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
17
+
18
+ if (is_file($fileName)) {
19
+ require_once $fileName;
20
+ }
21
+ });
lib/Jmango360/Braintree/lib/ssl/api_braintreegateway_com.ca.crt ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB
3
+ yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL
4
+ ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp
5
+ U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW
6
+ ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0
7
+ aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL
8
+ MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW
9
+ ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln
10
+ biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp
11
+ U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y
12
+ aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1
13
+ nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex
14
+ t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz
15
+ SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG
16
+ BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+
17
+ rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/
18
+ NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E
19
+ BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH
20
+ BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
21
+ aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv
22
+ MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE
23
+ p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y
24
+ 5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK
25
+ WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ
26
+ 4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N
27
+ hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
28
+ -----END CERTIFICATE-----
29
+ -----BEGIN CERTIFICATE-----
30
+ MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI
31
+ MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x
32
+ FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz
33
+ MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv
34
+ cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN
35
+ AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz
36
+ Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO
37
+ 0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao
38
+ wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj
39
+ 7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS
40
+ 8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT
41
+ BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
42
+ /zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg
43
+ JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC
44
+ NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3
45
+ 6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/
46
+ 3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm
47
+ D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS
48
+ CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
49
+ 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
50
+ -----END CERTIFICATE-----
51
+ -----BEGIN CERTIFICATE-----
52
+ MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
53
+ EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
54
+ EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
55
+ ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz
56
+ NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
57
+ EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE
58
+ AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw
59
+ DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD
60
+ E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH
61
+ /PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy
62
+ DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh
63
+ GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR
64
+ tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA
65
+ AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
66
+ FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX
67
+ WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu
68
+ 9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr
69
+ gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo
70
+ 2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
71
+ LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI
72
+ 4uJEvlz36hz1
73
+ -----END CERTIFICATE-----
74
+ -----BEGIN CERTIFICATE-----
75
+ MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
76
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
77
+ d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
78
+ b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
79
+ EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
80
+ cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
81
+ MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
82
+ JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
83
+ mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+
84
+ wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4
85
+ VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/
86
+ AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB
87
+ AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
88
+ BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun
89
+ pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC
90
+ dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf
91
+ fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm
92
+ NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx
93
+ H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
94
+ +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
95
+ -----END CERTIFICATE-----
96
+ -----BEGIN CERTIFICATE-----
97
+ MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
98
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
99
+ d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
100
+ QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
101
+ MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
102
+ b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
103
+ 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
104
+ CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
105
+ nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
106
+ 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
107
+ T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
108
+ gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
109
+ BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
110
+ TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
111
+ DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
112
+ hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
113
+ 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
114
+ PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
115
+ YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
116
+ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
117
+ -----END CERTIFICATE-----
118
+ -----BEGIN CERTIFICATE-----
119
+ MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
120
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
121
+ d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
122
+ ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
123
+ MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
124
+ LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
125
+ RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
126
+ +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
127
+ PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
128
+ xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
129
+ Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
130
+ hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
131
+ EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
132
+ MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
133
+ FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
134
+ nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
135
+ eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
136
+ hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
137
+ Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
138
+ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
139
+ +OkuE6N36B9K
140
+ -----END CERTIFICATE-----
141
+ -----BEGIN CERTIFICATE-----
142
+ MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEW
143
+ MBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVy
144
+ c2FsIENBMB4XDTA0MDMwNDA1MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UE
145
+ BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xHjAcBgNVBAMTFUdlb1RydXN0
146
+ IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKYV
147
+ VaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9tJPi8
148
+ cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTT
149
+ QjOgNB0eRXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFh
150
+ F7em6fgemdtzbvQKoiFs7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2v
151
+ c7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d8Lsrlh/eezJS/R27tQahsiFepdaVaH/w
152
+ mZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7VqnJNk22CDtucvc+081xd
153
+ VHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3CgaRr0BHdCX
154
+ teGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZ
155
+ f9hBZ3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfRe
156
+ Bi9Fi1jUIxaS5BZuKGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+
157
+ nhutxx9z3SxPGWX9f5NAEC7S8O08ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB
158
+ /wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0XG0D08DYj3rWMB8GA1UdIwQY
159
+ MBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG
160
+ 9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
161
+ aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fX
162
+ IwjhmF7DWgh2qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzyn
163
+ ANXH/KttgCJwpQzgXQQpAvvLoJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0z
164
+ uzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsKxr2EoyNB3tZ3b4XUhRxQ4K5RirqN
165
+ Pnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxFKyDuSN/n3QmOGKja
166
+ QI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2DFKW
167
+ koRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9
168
+ ER/frslKxfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQt
169
+ DF4JbAiXfKM9fJP/P6EUp8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/Sfuvm
170
+ bJxPgWp6ZKy7PtXny3YuxadIwVyQD8vIP/rmMuGNG2+k5o7Y+SlIis5z/iw=
171
+ -----END CERTIFICATE-----
172
+ -----BEGIN CERTIFICATE-----
173
+ MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
174
+ MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
175
+ YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
176
+ EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
177
+ R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
178
+ 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
179
+ fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
180
+ iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
181
+ 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
182
+ bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
183
+ MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
184
+ ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
185
+ uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
186
+ Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
187
+ tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
188
+ PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
189
+ hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
190
+ 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
191
+ -----END CERTIFICATE-----
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Jmango360_Japi</name>
4
- <version>3.4.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License</license>
7
  <channel>community</channel>
@@ -31,9 +31,9 @@ Other generic mobile apps that you can add and configure:&#xD;
31
  For more details on JMango360 please visit our website http://www.jmango360.com or out knowledge site http://support.jmango360.com</description>
32
  <notes>* Bug fixes</notes>
33
  <authors><author><name>Duc Ngo</name><user>jmango360</user><email>duc@jmango360.com</email></author></authors>
34
- <date>2017-05-29</date>
35
- <time>02:32:43</time>
36
- <contents><target name="magecommunity"><dir name="Jmango360"><dir name="Japi"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Hide.php" hash="2e9fb95869151bb2a2c7cf7fca6f998f"/></dir></dir></dir></dir></dir><dir name="Order"><file name="Grid.php" hash="22273d3d0acaf1b0a093e524f87c6aff"/></dir><file name="Order.php" hash="04e94160608b989286aebeb190299565"/><dir name="Report"><dir name="Chart"><file name="Customers.php" hash="9a4c7c4af19c584aeb2dd5bc0f6d4735"/><file name="Orders.php" hash="ae5f516c56c5c8c72c14a7b0aa275ac6"/><file name="Sales.php" hash="7d5db491deeaa90571e965bbc2c07e23"/></dir><dir name="Customers"><file name="Chart.php" hash="69f2a7121d61f24d9b75de7281def8e5"/><file name="Grid.php" hash="f1adb7504646338330b7e7ef64a4fc5c"/></dir><file name="Customers.php" hash="6ffd72b1280b6cce39665fd35b5c4a78"/><dir name="Filter"><dir name="Form"><file name="Orders.php" hash="92574de82aa73cdd9de0cc59e20dadc4"/></dir><file name="Form.php" hash="7bf3f161f66abf97fc7db57e0acd59cf"/></dir><dir name="Orders"><file name="Chart.php" hash="75bd0bbe8649f423918dec555d3e9592"/><file name="Grid.php" hash="35590c1a54c8490c3982f0df038b8328"/></dir><file name="Orders.php" hash="6416ac5f6889d5a06f2a32f5ff00cbe2"/><dir name="Sales"><file name="Chart.php" hash="416f4ff4cdaa7f8f099dad3ffccacd68"/><file name="Grid.php" hash="baa9caa57906627ed3f31ec4fd87a500"/></dir><file name="Sales.php" hash="c1d1df3e7b90451e42142bb414a28d6b"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="2b02a6c90256c9bcc6d99d2d9301413e"/><file name="Log.php" hash="d92a34eab2fbac5dc45ad12fc7df11ed"/><file name="User.php" hash="cb7dfc72c7acde78efbabc49617cba3c"/><file name="Version.php" hash="b9802c302ef7ecacf106993e8506d314"/></dir></dir></dir><dir name="Widget"><dir name="Form"><dir name="Renderer"><dir name="Element"><file name="Chart.php" hash="f6f4c2ff80cb71f3e0758809b8ad480d"/></dir></dir></dir></dir></dir><file name="Banner.php" hash="0cafa22b3012e1a3b39f0e72a03534fa"/><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="43581de27feb1a0187bb0aee68bab0e9"/><file name="Category.php" hash="5d01fc7d90af7eccd412ef61056b825b"/><file name="Decimal.php" hash="d40a09709bda7b1011e4d2c970308638"/><file name="Price.php" hash="02dfe6d9429f0190ecf9a41f73653330"/></dir><file name="View.php" hash="e217dfaf2a2ee6c2fa59ba9db0244eb9"/></dir><dir name="Product"><file name="List.php" hash="e1336372e4aa63e0e35c7e9ea1bd3852"/></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4ba3d242a3343b1786cf081047650bb9"/></dir></dir><file name="Layer.php" hash="4d48db1a2b35151c363ed045646199a9"/></dir><dir name="Checkout"><dir name="Cart"><file name="Totals.php" hash="ed2ac76f7ebb2830c763deb80e1ea59e"/></dir><dir name="Onepage"><file name="Additional.php" hash="22a3c60e8fd44f5dfaec4b51d6fc1a62"/><file name="Addjs.php" hash="077d09b15ec8823c76854a575359cb1a"/><file name="Address.php" hash="bf596c77e982d4350fc532a3deb79e47"/><file name="Billing.php" hash="afc74029a0b8d571e440f50a04ab4340"/><file name="Button.php" hash="039d56b9b7982d5e32433d71f4b53959"/><file name="Shipping.php" hash="aaa1b70ecc095d297d6ab0a90f441c70"/></dir><file name="Onepage.php" hash="b02fe40ae9c73c0d1248c178a4f2d133"/><dir name="Total"><file name="Grandtotal.php" hash="0714677162e5c6e0ca9e1076083ee26e"/><file name="Shipping.php" hash="1bb99456f936de791df3b1e9cb4103d5"/><file name="Subtotal.php" hash="aa7cdd3b66df0ea397ad909848234a0e"/><file name="Tax.php" hash="91c12499a56a034d4733f8040feb7156"/></dir></dir><file name="Form.php" hash="e16eaa258cf650bd2106372fcf43ae9b"/><dir name="GiftMessage"><dir name="Message"><file name="Inline.php" hash="8f20e9383634f46b624f15d77b616380"/></dir></dir><file name="Js.php" hash="8e8091283a5a3142fec7486077a9586e"/></dir><dir name="Controller"><file name="Abstract.php" hash="ccb6cc7460e7bbf30293983bbe61a07d"/></dir><file name="Exception.php" hash="bd30a2efecdf9a8197f066d9574cd1ab"/><dir name="Helper"><dir name="Adminhtml"><dir name="Report"><file name="Order.php" hash="9f7a02c48f3f8e0545488375b03d7333"/></dir></dir><file name="Data.php" hash="d4c3ae9c8b84033fa21b512813842099"/><file name="Debug.php" hash="1002a59a5dee41f34da875979e907cbf"/><dir name="GiftMessage"><file name="Message.php" hash="5d1df4710b0aa3154ce0fa744b0244f3"/></dir><file name="Js.php" hash="55565b7d668b993fae6c180b30766d17"/><dir name="Product"><file name="Bundle.php" hash="c89baf5638e81d030f5a72b011af7cfd"/><file name="Configurable.php" hash="ac9d2847adc70af0470f9d1106845cf7"/><file name="Downloadable.php" hash="db531632adda525a91625da8d13296d6"/><file name="File.php" hash="0968c5688015b9c7a002457428607f80"/><file name="Grouped.php" hash="8e9cfa89b62e210744b799a1134ec064"/><file name="Media.php" hash="291003011bdca7299280ef0136089edf"/><file name="Options.php" hash="1bc8973b5a9227b0b7de93f2307c7fb9"/><file name="Review.php" hash="e415a0215a8dfbdac5ed76e6c065c705"/><file name="TierPrice.php" hash="4a7e94d83eed9e7ba47ee196b4ae15d9"/></dir><file name="Product.php" hash="374f8d6be0ae6cb8e4438fd5c7d168bc"/><dir name="Review"><file name="Bazaarvoice.php" hash="c4025551a7fec937594ac47871abe7a3"/></dir><file name="Tax.php" hash="05c99785012d55fce12c4f094385e25c"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="f058e0ced4579a556cbb969a98c7fc66"/><file name="Decimal.php" hash="849e1dbc11c99fb8f7a1f9d33e0d7908"/><file name="Price.php" hash="2bdc6f1ff06ad5aa736972c72558fd25"/></dir></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="81b287f96c40094c2a3743ddc6f6c6cb"/></dir></dir></dir><dir name="Core"><file name="Session.php" hash="7c5531af03c6a98e14dda3d358270938"/></dir><file name="Dispatcher.php" hash="81004902926427ba06a1a90d6e799554"/><dir name="Magpleasure"><dir name="Tierprices"><file name="Price.php" hash="1bfd6ed086649f518b3e98436513a491"/></dir></dir><dir name="Observer"><dir name="Controller"><file name="Front.php" hash="1098d9b5f6a214e53fb8657fe1fd250d"/></dir></dir><file name="Observer.php" hash="c19a6c0209260aad4d56b76672d70826"/><dir name="Renderer"><file name="Json.php" hash="b7c471548eecae7c9d05072aa6695cbb"/></dir><file name="Renderer.php" hash="47c320f795f1328a8df37d4b9af56abc"/><file name="Request.php" hash="ece58a0074c2ba238c102983e05d15a8"/><dir name="Resource"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="5bd13fbb5e8012ad24dc7908bc5ea755"/><file name="Decimal.php" hash="551120b728226ed408292fac732a05d7"/><file name="Price.php" hash="321f70b515b4d3deb9c7cc58eb803bf2"/></dir></dir></dir><dir name="Report"><dir name="Order"><file name="Collection.php" hash="1c5e69f548f2b4a0da8f789d7d03b643"/></dir></dir><dir name="Sales"><dir name="Report"><dir name="Order"><dir name="Collection"><file name="Aggregated.php" hash="61848c0b80699acbf478f279231c161d"/><file name="Live.php" hash="ea323ca0eec324ece97f08ece6639fb9"/></dir></dir><file name="Order.php" hash="53641b24d23bd811c278f65b56d5765f"/></dir></dir><file name="Setup.php" hash="3a97ea2e652869965f5b47b9e3099896"/></dir><file name="Response.php" hash="7209bb2e9c5b97b2a46d10ff97aa6740"/><dir name="Rest"><dir name="Cart"><file name="Coupon.php" hash="a5be6cfe674b46b6ba290b0388edf8ad"/><file name="Update.php" hash="48d85c58183c9696eea1fd2d4da6dfa1"/></dir><file name="Cart.php" hash="39e0f2f2b7630e5884d907f42bc5e11a"/><dir name="Catalog"><dir name="Category"><file name="Assignedproducts.php" hash="930ff28a4e8b2e401629c352c36569ca"/><file name="Tree.php" hash="5dce196312e33d3f7ac4a2235312e587"/></dir><dir name="Search"><file name="Products.php" hash="8b8f43f4f563dc27002884a57d42c858"/><file name="Terms.php" hash="71cadbe1fa7b19c96f2201f087c832ff"/></dir></dir><file name="Catalog.php" hash="a71eed5f39431b40a80b06f566baa653"/><dir name="Checkout"><file name="Methods.php" hash="e8ea7716b28587ecfb73bff7bb37b059"/><file name="Onepage.php" hash="e1e04e5936867fe452a08ee5774617bf"/><file name="Redirect.php" hash="19932aa45299e5ea3995f52cb9987183"/><file name="Submit.php" hash="50ac35f8218f5c3abeb0946e138db2ae"/></dir><file name="Checkout.php" hash="514f5be707f0a1a1175b825983831705"/><dir name="Cms"><file name="Page.php" hash="93bd77b2b3f2b8b1e72a3e6391553426"/></dir><file name="Cms.php" hash="a12fd4b2a437c8a6c0b2b65a1e471c23"/><dir name="Customer"><file name="Address.php" hash="cef92ca089a5cd7cd1218339104c4894"/><file name="Edit.php" hash="226f77d8cee872c4c622c062cfe1eff0"/><file name="Group.php" hash="c717d5faf52919787aa0f87270856ca3"/><file name="List.php" hash="17f0096755be01327c163a701b9f3780"/><file name="Login.php" hash="77df1e0afcf40e6129fb61397217f053"/><dir name="Order"><file name="List.php" hash="1e6ea53a87108ca487d9a58ac42f382f"/></dir><file name="Order.php" hash="da1565601bac963b72f64b0e6a147704"/><file name="Password.php" hash="6df128903742a8723f0a59c4203f8b12"/><file name="Register.php" hash="e25d0045e0d8ff650ca208b9fe75e3ae"/></dir><file name="Customer.php" hash="ecf57dcf8bbba1ebb12ed10630bd1715"/><file name="Mage.php" hash="731d7a85645d95af3a8fb281d0efaf42"/><dir name="Product"><file name="Crosssell.php" hash="1fbc8c3886de3703a77e911ac459422c"/><file name="List.php" hash="8d84ec9326a6747de6d2ca0a5aceee6c"/><file name="Price.php" hash="d47c9903d5719b0cee73836419e27bb1"/><file name="Purchased.php" hash="feb7fd9176da74e59722984732d04a9a"/><file name="Related.php" hash="8a6b52fc39f099f4339a91ad5709537a"/><file name="Review.php" hash="549ffdfaea3d95ac1f18e9d4ef18d6eb"/><file name="Search.php" hash="9e130de2d112ee567b4756b63b050809"/><file name="Upsell.php" hash="319fe08a0a4c52c41ec4418b312e1842"/><file name="Url.php" hash="4b920cc4913b77b1e463afad27ad5b78"/><file name="Viewed.php" hash="c2a9c99a56b57d8288eec75657f9bd47"/></dir><file name="Product.php" hash="33f395e10d5578d948bf32a7bd5388fd"/><file name="Wishlist.php" hash="ee26b4efcbf3b2c39aec2c1e3402c35b"/></dir><file name="Server.php" hash="1f51d81e323af28fd78618e62db11d82"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Icon.php" hash="242de9b094f94e397dc606dc926cc33f"/><file name="Payment.php" hash="5964322419785004a6c3f84a940d8d13"/><file name="Shipping.php" hash="016f22646fbac10cd81c6b7904c9abde"/></dir><dir name="Source"><dir name="Address"><file name="Attributes.php" hash="1a29b64d271693fba3ea76599d3408e2"/><file name="Validatetype.php" hash="6f4d9767ac0e476ec6a6cd3964882721"/></dir><file name="Attributes.php" hash="4b4de29e00623c971038d6fe895e5e76"/><dir name="Bazaarvoice"><file name="Env.php" hash="bc619503d1b175e74f7eaf2ba15ae8b4"/></dir><dir name="Catalog"><file name="Direction.php" hash="68cd86444037506ec39de8eba3c07d8b"/><file name="Sortby.php" hash="d2aba9a3798b8e2eee8c275fbbd202e1"/></dir><file name="Catalogimage.php" hash="500f9994ea13e463a5e5e5d3963cfbd1"/><dir name="Customer"><file name="Attributes.php" hash="8963356aabf88647ab5ecbbbe8cfb9f1"/></dir><file name="Defaultimage.php" hash="04c896116c01b16e2ac8d7f23bbc29d6"/><file name="Payment.php" hash="70e82f4887eb297d6a58160f64bfd204"/><file name="Shipping.php" hash="7d8e5a2dc8a57099d908bef2403aad46"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Japi"><file name="LogController.php" hash="b17e024285aea7b6834cf5bc9b868916"/><file name="OrderController.php" hash="e6b7c1f5a7156a06fa3f51c32e6bbba9"/><file name="ReportController.php" hash="e88b2425e0a39f7f2b0c2902a6d2d5e9"/><file name="TroubleshootingController.php" hash="bb8951d1523a56a0f55e827614a38d66"/></dir></dir><file name="CheckoutController.php" hash="f3b9b64649f7282fd3a4b9f91e73abe2"/><dir name="Customer"><file name="AccountController.php" hash="2e055c5b22a2414263a1b7d3fd0607f9"/></dir><file name="CustomerController.php" hash="e3204496e61f58a572ef8f9b3cefe38f"/><file name="ImageController.php" hash="a5b48d4e075faf989c908bd0954d3878"/><file name="KcoController.php" hash="38e15112f3438edd6723478cf18c6cab"/><file name="KlarnaController.php" hash="90474b512fdc813039a86ae8f24a0b39"/><dir name="Rest"><file name="CartController.php" hash="3994aafe8e31094b765fc0120c888fa3"/><file name="CatalogController.php" hash="8df5b798bb0330f5e3182717e1e15bf7"/><file name="CheckoutController.php" hash="2fd4a4bca1a37788616645f50392a701"/><file name="CmsController.php" hash="cb1bc3f67136434c4d8af1b5660eab1e"/><file name="CustomerController.php" hash="ca2b76f8f4e8a84d81749b37910287bd"/><file name="MageController.php" hash="e267156b2acf82d309b6c8c4680a7371"/><file name="ProductController.php" hash="81c0a0b0afcdfe99d6c651244baa075c"/><file name="WishlistController.php" hash="d7b0c8ff628b4244d120843d54a41248"/></dir><file name="TestController.php" hash="ffb60653808c0e0af00cc73d4755ef99"/></dir><dir name="data"><dir name="japi_setup"><file name="data-install-2.0.0.php" hash="bcf6de66f6b296182268b11b3e80bbeb"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9d1888abb4ed93ec7b3e1fa678fb1411"/><file name="config.xml" hash="d196748b8e37fcbef87da5b868fa89ae"/><file name="system.xml" hash="519bc57a297e6d93f9090d2a18ceeaf1"/></dir><dir name="sql"><dir name="japi_setup"><file name="install-1.0.0.php" hash="ce407ff5715c837d02b1aba7975bf512"/><file name="upgrade-2.0.1.2-2.0.2.php" hash="6fc0e0306b685279fc60f298643d181a"/><file name="upgrade-2.1.6-2.2.0.php" hash="947afcf7e20dfc2c3a3e45d8e5c316cd"/><file name="upgrade-2.2.0-2.2.1.php" hash="12a28845acf823eefc5f613b048efe52"/><file name="upgrade-2.8.2-2.9.0.php" hash="2761423f65920af0f8ba05d438710869"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jmango360_Japi.xml" hash="b60701b3a14084fa1a440ca5fe5bf47b"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="jmango360_japi.xml" hash="d6e1656e4a8e79dd9e37e0b09a5f57a6"/></dir><dir name="template"><dir name="japi"><dir name="report"><file name="chart.phtml" hash="102704d97cf69793a50fa96538bd767f"/><dir name="grid"><file name="container.phtml" hash="79050f4e2bc7b70ae452e850fc27e0b7"/></dir></dir><dir name="widget"><dir name="form"><dir name="renderer"><dir name="element"><file name="chart.phtml" hash="fb14be221a9ec0faad4ace8579c5dddc"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="jmango360_japi.xml" hash="af8409687b5ea1b5057acb5bec40a52b"/></dir><dir name="template"><dir name="japi"><dir name="TIG"><dir name="PostNL"><dir name="av"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="0cb781955d33fae46da09d62bd6fdaf3"/><file name="shipping.phtml" hash="cb72f56f0d26171c429d7a70701e0913"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="9a623e8c2184d08c2b288456ba50aef4"/><file name="postcode_check.phtml" hash="cbb8bfd76db65041cafacf976312ceb7"/></dir></dir></dir><dir name="do"><dir name="onepage"><file name="available.phtml" hash="8fce41a1696540a4546b52c025f3dde7"/></dir></dir></dir></dir><dir name="checkout"><dir name="onepage"><file name="additional_agreements.phtml" hash="2169df7f5c0d8b03e046cd000c9bea5f"/><file name="address.phtml" hash="3164ff4fc2d5f798e591a168d9d937d1"/><file name="agreements.phtml" hash="ae43c3b670b0d11a1217ca927a184ff7"/><file name="billing.phtml" hash="d5491399cbce3e565757023dc3e594ed"/><file name="coupon.phtml" hash="2b75d2b0c7e11276e1c85f7d4c1366bb"/><file name="js.phtml" hash="ac1740fe3e829d228a57b1e1a9dda58b"/><dir name="payment"><file name="info.phtml" hash="26bb640843ee3fb6e72b4f2739f0a111"/><file name="methods.phtml" hash="1680b5e33d8123fdb58ecbd353ff1ba7"/></dir><file name="payment.phtml" hash="cc3bfd21f2a141ea403db094e1264781"/><dir name="review"><file name="button.phtml" hash="e2089ae34e409df2fa13977a55db5f04"/><file name="info.phtml" hash="306936f465adcc1c09ad37b58609085d"/><file name="item.phtml" hash="244bba60d9151be71777e80e138b6ee7"/><dir name="totals"><file name="grand_total.phtml" hash="4ee3bdd1190a459e243249e288e6caff"/><file name="shipping.phtml" hash="75900b7d4cfb370e803d1489148450ad"/><file name="subtotal.phtml" hash="f91e3bc1a39761fa7cea8fc296091430"/><file name="tax.phtml" hash="37173b32341b2692a7890111f02f2938"/></dir><file name="totals.phtml" hash="0decbe242701193fee270e1f0f520a93"/></dir><file name="review.phtml" hash="d2494b8faac5833e747a5d329ee4fab7"/><file name="shipping.phtml" hash="d0aba8dade93f6798285f7163ec65e58"/><dir name="shipping_method"><file name="additional.phtml" hash="78c6dab72fefb888f587221639bf9177"/><file name="available.phtml" hash="4feca53deabec45bc3b223e64e32c4f0"/></dir><file name="shipping_method.phtml" hash="edc75d0aecc103ed69b216ef76bc6af2"/><file name="style.phtml" hash="1a28dcebc9bddba3c6e4e5cb44a2eb80"/></dir><file name="onepage.phtml" hash="733ad23bfa6442a5fcab8c9a6bbf1b88"/></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="900db1b8385f75e448f7ca42c8d113da"/></dir><dir name="form"><file name="additional.phtml" hash="0d413b832a447a524de18c74cbd17844"/><file name="edit.phtml" hash="484b2b56cbf34dba73c78dc97552c024"/><file name="register.phtml" hash="8d41d5471f450633a277feb13502d646"/></dir></dir><dir name="fatturazione"><dir name="customer"><dir name="address"><file name="edit.phtml" hash="e7f27a8a61d9554bfbc4f36dfff60e4d"/></dir></dir></dir><file name="form.phtml" hash="eec0416c8830c4ebe004256d86c7ea59"/><dir name="giftmessage"><file name="inline.phtml" hash="78814da47aed68315b7d1d6b2e64c4c7"/></dir><file name="js.phtml" hash="9af5ac67d9b1a4fc689084e135215f99"/><dir name="kega_checkout"><dir name="onepage"><file name="payment.phtml" hash="36ceb7a03629f08c789f42e98b1c1535"/></dir></dir><dir name="nwt"><dir name="kco"><dir name="cart"><dir name="item"><file name="default.phtml" hash="212018e8f0c4472a07fc81633d27c550"/></dir></dir><file name="checkout.phtml" hash="c7781347405e7e59322d9fc3b2f42b3c"/></dir></dir><dir name="page"><dir name="html"><file name="head.phtml" hash="b6a8cc30cd31bf642c2f885ed1fda855"/><file name="smart-app-banner.phtml" hash="8423731f246db33efb61026dd9ef5ddc"/></dir><file name="rwd.phtml" hash="06c53b02ad843574b22a803a709988f6"/></dir><dir name="symfony"><dir name="postcode"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="65181e0ab40a40671f35c54bc25b99af"/><file name="shipping.phtml" hash="a6e2a192b9998889e5d113a92df62623"/></dir></dir></dir></dir><dir name="vaimo"><dir name="klarna"><dir name="klarnacheckout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="f9f469de9cd1243cab176fc56071db64"/></dir></dir><file name="cart.phtml" hash="b40f17348beb248c4f1ff22374a1a05d"/><dir name="customer"><file name="balance.phtml" hash="198809cb8ebf8a468b89497c9abba07c"/></dir><dir name="discount"><file name="coupon.phtml" hash="1f3686b00a610d3f038c84e3621ef913"/></dir><file name="header.phtml" hash="fed93df0c84265a0f980b0de103945b8"/><file name="main.phtml" hash="94ad4f3aa30ae7db1131a1fe48ea2a99"/><file name="newsletter.phtml" hash="3a2251b9559e8b87b46ddf08b7cd27e2"/><file name="reward.phtml" hash="38c218d3777f11b03c3686067a706d00"/><file name="shipping_method.phtml" hash="44bb3c6efaab76641e02a07c2007a090"/><file name="sidebar.phtml" hash="410508fd9089e0be030915836abb42e2"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="japi"><dir name="css"><dir name="TIG"><dir name="Buckaroo3Extended"><file name="styles_opc.css" hash="9b0ecbbeb22655e2e896ec8134fa8188"/></dir></dir><file name="gomage-checkout.css" hash="223657dbb0aba2783bb9e8de4b633d93"/><dir name="icomoon"><dir name="fonts"><file name="icomoon.eot" hash="842065e274d718c38968a81a721d49f4"/><file name="icomoon.svg" hash="2deea3fcd9ecc464a422aa37943b5848"/><file name="icomoon.ttf" hash="8ffbfccd78de7c37eadeca837ee40344"/><file name="icomoon.woff" hash="32df67c3aed8769c316b3e7ff1bb637c"/></dir><file name="style.css" hash="178c956df2a327dc88e4ef8069caa9bc"/></dir><file name="send-cloud.css" hash="77f77fa89359fe508708ec522a5e76d8"/><file name="style.css" hash="f08d0683b5b01d18ed6097be93a6a93a"/><file name="style.less" hash="861bf6e1830d93975acf932ed876b29a"/></dir><dir name="images"><file name="ajax-loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/><file name="bg-down.png" hash="04d7cd2963010b610f608aca03a45c63"/><file name="bg-up.png" hash="2882d38108532275fb1d425bbd021c9d"/><file name="glc_sprite.png" hash="5cd6f3ba1df3a6d26db5bbc193ce9c61"/></dir><dir name="js"><file name="checkout.js" hash="9f13a3545ecfe0e2d35f61c1db304c60"/><dir name="vaimo"><dir name="klarna"><file name="klarnautils.js" hash="e29553aa8446af7672c9ba1814fac3a5"/></dir></dir><dir name="varien"><file name="form.js" hash="9abc0bb4419828513b5c6e904a041616"/></dir></dir><dir name="lib"><dir name="bootstrap"><dir name="css"><file name="bootstrap.min.css" hash="5d5357cb3704e1f43a1f5bfed2aebf42"/></dir><dir name="fonts"><file name="glyphicons-halflings-regular.eot" hash="f4769f9bdb7466be65088239c12046d1"/><file name="glyphicons-halflings-regular.svg" hash="89889688147bd7575d6327160d64e760"/><file name="glyphicons-halflings-regular.ttf" hash="e18bbf611f2a2e43afc071aa2f4e1512"/><file name="glyphicons-halflings-regular.woff" hash="fa2772327f55d8198301fdb8bcfc8158"/><file name="glyphicons-halflings-regular.woff2" hash="448c34a56d699c29117adc64c43affeb"/></dir><dir name="js"><file name="collapse.js" hash="2bc99ca6c9b060ba5616f41ddd5e2703"/><file name="modal.js" hash="b7d8f688e67e78c07ffde44ec4248fd9"/><file name="transition.js" hash="3cb001675410903ecaadcfeb7c296965"/></dir></dir><dir name="jquery"><file name="jquery-1.11.2.min.js" hash="5790ead7ad3ba27397aedfa3d263b867"/><file name="jquery-noconflict.js" hash="32eb0a33820167f328a227e11210d32a"/></dir><dir name="ladda"><file name="ladda.min.css" hash="614e769024385cf21879d6a238b682e1"/><file name="ladda.min.js" hash="a34bcf417de7fc290ac5b034caca2371"/></dir><dir name="scrollto"><file name="scrollTo.js" hash="5c86793da8a4bfec6338bec965d35f6b"/></dir><dir name="smart-app-banner"><file name="smart-app-banner.css" hash="64c15053dbd22b44a519f55e75f6c2ca"/><file name="smart-app-banner.js" hash="4162cb20424080964b5d886125b73b47"/></dir><dir name="spin"><file name="spin.min.js" hash="1d06ceb800acbeae82d1fa2ad5b571de"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Jmango360_Japi.csv" hash="3ecbadafe75c076e087389e527c2fa4e"/></dir><dir name="fr_FR"><file name="Jmango360_Japi.csv" hash="49fa338f05916214904965ca3009eadf"/></dir><dir name="it_IT"><file name="Jmango360_Japi.csv" hash="2ff891468a5c5fe0bd3775cc155341cb"/></dir><dir name="pt_PT"><file name="Jmango360_Japi.csv" hash="3a70c94cf76ccf0649ab2c525f2acece"/></dir><dir name="pt_BR"><file name="Jmango360_Japi.csv" hash="3a70c94cf76ccf0649ab2c525f2acece"/></dir><dir name="ar_SA"><file name="Jmango360_Japi.csv" hash="25b829fa5515c567af7ed8e5e4a2690a"/></dir><dir name="nl_NL"><file name="Jmango360_Japi.csv" hash="f37b336b47a320803a967237a7765a2a"/></dir><dir name="sv_SE"><file name="Jmango360_Japi.csv" hash="3414d54579206e71cabaaea3153bc266"/></dir><dir name="da_DK"><file name="Jmango360_Japi.csv" hash="a8f243d230a312f4d5cee8c99a275ee7"/></dir><dir name="es_ES"><file name="Jmango360_Japi.csv" hash="0f763b984f64e095f863c2e66335c791"/></dir><dir name="de_DE"><file name="Jmango360_Japi.csv" hash="d97408dc0ece1a193669bc491798355a"/></dir></target></contents>
37
  <compatible/>
38
  <dependencies><required><php><min>5.2.0</min><max>7.1.0</max></php></required></dependencies>
39
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Jmango360_Japi</name>
4
+ <version>3.5.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License</license>
7
  <channel>community</channel>
31
  For more details on JMango360 please visit our website http://www.jmango360.com or out knowledge site http://support.jmango360.com</description>
32
  <notes>* Bug fixes</notes>
33
  <authors><author><name>Duc Ngo</name><user>jmango360</user><email>duc@jmango360.com</email></author></authors>
34
+ <date>2017-06-16</date>
35
+ <time>02:32:42</time>
36
+ <contents><target name="magecommunity"><dir name="Jmango360"><dir name="Japi"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Hide.php" hash="2e9fb95869151bb2a2c7cf7fca6f998f"/></dir></dir></dir></dir></dir><dir name="Order"><file name="Grid.php" hash="22273d3d0acaf1b0a093e524f87c6aff"/></dir><file name="Order.php" hash="04e94160608b989286aebeb190299565"/><dir name="Report"><dir name="Chart"><file name="Customers.php" hash="9a4c7c4af19c584aeb2dd5bc0f6d4735"/><file name="Orders.php" hash="ae5f516c56c5c8c72c14a7b0aa275ac6"/><file name="Sales.php" hash="7d5db491deeaa90571e965bbc2c07e23"/></dir><dir name="Customers"><file name="Chart.php" hash="69f2a7121d61f24d9b75de7281def8e5"/><file name="Grid.php" hash="f1adb7504646338330b7e7ef64a4fc5c"/></dir><file name="Customers.php" hash="6ffd72b1280b6cce39665fd35b5c4a78"/><dir name="Filter"><dir name="Form"><file name="Orders.php" hash="92574de82aa73cdd9de0cc59e20dadc4"/></dir><file name="Form.php" hash="7bf3f161f66abf97fc7db57e0acd59cf"/></dir><dir name="Orders"><file name="Chart.php" hash="75bd0bbe8649f423918dec555d3e9592"/><file name="Grid.php" hash="35590c1a54c8490c3982f0df038b8328"/></dir><file name="Orders.php" hash="6416ac5f6889d5a06f2a32f5ff00cbe2"/><dir name="Sales"><file name="Chart.php" hash="416f4ff4cdaa7f8f099dad3ffccacd68"/><file name="Grid.php" hash="baa9caa57906627ed3f31ec4fd87a500"/></dir><file name="Sales.php" hash="c1d1df3e7b90451e42142bb414a28d6b"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Button"><file name="Paypal.php" hash="26ddf9a5b820c3fb23c1c4e0a46d6db4"/></dir><file name="Button.php" hash="2b02a6c90256c9bcc6d99d2d9301413e"/><file name="Log.php" hash="9a228a569090c0fc9a905c5fb29a7c4d"/><file name="User.php" hash="cb7dfc72c7acde78efbabc49617cba3c"/><file name="Version.php" hash="b9802c302ef7ecacf106993e8506d314"/></dir></dir></dir><dir name="Widget"><dir name="Form"><dir name="Renderer"><dir name="Element"><file name="Chart.php" hash="f6f4c2ff80cb71f3e0758809b8ad480d"/></dir></dir></dir></dir></dir><file name="Banner.php" hash="0cafa22b3012e1a3b39f0e72a03534fa"/><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="43581de27feb1a0187bb0aee68bab0e9"/><file name="Category.php" hash="5d01fc7d90af7eccd412ef61056b825b"/><file name="Decimal.php" hash="d40a09709bda7b1011e4d2c970308638"/><file name="Price.php" hash="02dfe6d9429f0190ecf9a41f73653330"/></dir><file name="View.php" hash="e217dfaf2a2ee6c2fa59ba9db0244eb9"/></dir><dir name="Product"><file name="List.php" hash="e1336372e4aa63e0e35c7e9ea1bd3852"/></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="4ba3d242a3343b1786cf081047650bb9"/></dir></dir><file name="Layer.php" hash="4d48db1a2b35151c363ed045646199a9"/></dir><dir name="Checkout"><dir name="Cart"><file name="Totals.php" hash="ed2ac76f7ebb2830c763deb80e1ea59e"/></dir><dir name="Onepage"><file name="Additional.php" hash="22a3c60e8fd44f5dfaec4b51d6fc1a62"/><file name="Addjs.php" hash="077d09b15ec8823c76854a575359cb1a"/><file name="Address.php" hash="bf596c77e982d4350fc532a3deb79e47"/><file name="Billing.php" hash="afc74029a0b8d571e440f50a04ab4340"/><file name="Button.php" hash="039d56b9b7982d5e32433d71f4b53959"/><file name="Shipping.php" hash="aaa1b70ecc095d297d6ab0a90f441c70"/></dir><file name="Onepage.php" hash="f6c3ef9390a3ac38560a34fbecf00eba"/><dir name="Total"><file name="Grandtotal.php" hash="0714677162e5c6e0ca9e1076083ee26e"/><file name="Shipping.php" hash="1bb99456f936de791df3b1e9cb4103d5"/><file name="Subtotal.php" hash="aa7cdd3b66df0ea397ad909848234a0e"/><file name="Tax.php" hash="91c12499a56a034d4733f8040feb7156"/></dir></dir><dir name="Customer"><dir name="Widget"><file name="Name.php" hash="aca4eea6675b64e1bc6d165307e1b958"/></dir></dir><file name="Form.php" hash="e16eaa258cf650bd2106372fcf43ae9b"/><dir name="GiftMessage"><dir name="Message"><file name="Inline.php" hash="8f20e9383634f46b624f15d77b616380"/></dir></dir><file name="Js.php" hash="8e8091283a5a3142fec7486077a9586e"/><dir name="Payment"><file name="Form.php" hash="f014c3faaad4e31a14052a76137f5dac"/><file name="Info.php" hash="2171f7379f4017b7a541926a9224cd54"/></dir><dir name="Socolissimosimplicite"><file name="Iframe.php" hash="91e096613f73e1edc7fcce4c6a17ce39"/></dir></dir><dir name="Controller"><file name="Abstract.php" hash="ccb6cc7460e7bbf30293983bbe61a07d"/></dir><file name="Exception.php" hash="bd30a2efecdf9a8197f066d9574cd1ab"/><dir name="Helper"><dir name="Adminhtml"><dir name="Report"><file name="Order.php" hash="9f7a02c48f3f8e0545488375b03d7333"/></dir></dir><file name="Data.php" hash="d4c3ae9c8b84033fa21b512813842099"/><file name="Debug.php" hash="1002a59a5dee41f34da875979e907cbf"/><dir name="GiftMessage"><file name="Message.php" hash="5d1df4710b0aa3154ce0fa744b0244f3"/></dir><file name="Js.php" hash="55565b7d668b993fae6c180b30766d17"/><dir name="Product"><file name="Bundle.php" hash="c89baf5638e81d030f5a72b011af7cfd"/><file name="Configurable.php" hash="ac9d2847adc70af0470f9d1106845cf7"/><file name="Downloadable.php" hash="db531632adda525a91625da8d13296d6"/><file name="File.php" hash="0968c5688015b9c7a002457428607f80"/><file name="Grouped.php" hash="8e9cfa89b62e210744b799a1134ec064"/><file name="Media.php" hash="291003011bdca7299280ef0136089edf"/><file name="Options.php" hash="1bc8973b5a9227b0b7de93f2307c7fb9"/><file name="Review.php" hash="e415a0215a8dfbdac5ed76e6c065c705"/><file name="TierPrice.php" hash="4a7e94d83eed9e7ba47ee196b4ae15d9"/></dir><file name="Product.php" hash="57a49f808ae5146a5c364d4b2e60ac96"/><dir name="Review"><file name="Bazaarvoice.php" hash="bb6f94bc662f6c7faa65454fca5a47a8"/></dir><file name="Tax.php" hash="05c99785012d55fce12c4f094385e25c"/></dir><dir name="Model"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="f058e0ced4579a556cbb969a98c7fc66"/><file name="Decimal.php" hash="849e1dbc11c99fb8f7a1f9d33e0d7908"/><file name="Price.php" hash="2bdc6f1ff06ad5aa736972c72558fd25"/></dir></dir></dir><dir name="Catalogsearch"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="81b287f96c40094c2a3743ddc6f6c6cb"/></dir></dir></dir><dir name="Core"><file name="Session.php" hash="7c5531af03c6a98e14dda3d358270938"/></dir><file name="Dispatcher.php" hash="81004902926427ba06a1a90d6e799554"/><dir name="Magpleasure"><dir name="Tierprices"><file name="Price.php" hash="1bfd6ed086649f518b3e98436513a491"/></dir></dir><dir name="Observer"><dir name="Controller"><file name="Front.php" hash="1098d9b5f6a214e53fb8657fe1fd250d"/></dir></dir><file name="Observer.php" hash="8692e999a2497a472c0bcd64f3d24bea"/><dir name="Payment"><file name="Braintree.php" hash="212d788906a3d94e2e10135d4de6bb58"/><file name="Paypal.php" hash="3a349b8e55f5abae4a960962e2191cd0"/></dir><file name="Payment.php" hash="0e2f9ff405b47e63bb8a3d27e82fb6ea"/><dir name="Renderer"><file name="Json.php" hash="b7c471548eecae7c9d05072aa6695cbb"/></dir><file name="Renderer.php" hash="47c320f795f1328a8df37d4b9af56abc"/><file name="Request.php" hash="ece58a0074c2ba238c102983e05d15a8"/><dir name="Resource"><dir name="Catalog"><dir name="Layer"><dir name="Filter"><file name="Attribute.php" hash="5bd13fbb5e8012ad24dc7908bc5ea755"/><file name="Decimal.php" hash="551120b728226ed408292fac732a05d7"/><file name="Price.php" hash="321f70b515b4d3deb9c7cc58eb803bf2"/></dir></dir></dir><dir name="Report"><dir name="Order"><file name="Collection.php" hash="1c5e69f548f2b4a0da8f789d7d03b643"/></dir></dir><dir name="Sales"><dir name="Report"><dir name="Order"><dir name="Collection"><file name="Aggregated.php" hash="61848c0b80699acbf478f279231c161d"/><file name="Live.php" hash="ea323ca0eec324ece97f08ece6639fb9"/></dir></dir><file name="Order.php" hash="53641b24d23bd811c278f65b56d5765f"/></dir></dir><file name="Setup.php" hash="3a97ea2e652869965f5b47b9e3099896"/></dir><file name="Response.php" hash="7209bb2e9c5b97b2a46d10ff97aa6740"/><dir name="Rest"><dir name="Cart"><file name="Coupon.php" hash="a5be6cfe674b46b6ba290b0388edf8ad"/><file name="Update.php" hash="48d85c58183c9696eea1fd2d4da6dfa1"/></dir><file name="Cart.php" hash="39e0f2f2b7630e5884d907f42bc5e11a"/><dir name="Catalog"><dir name="Category"><file name="Assignedproducts.php" hash="930ff28a4e8b2e401629c352c36569ca"/><file name="Tree.php" hash="5dce196312e33d3f7ac4a2235312e587"/></dir><dir name="Search"><file name="Products.php" hash="8b8f43f4f563dc27002884a57d42c858"/><file name="Terms.php" hash="71cadbe1fa7b19c96f2201f087c832ff"/></dir></dir><file name="Catalog.php" hash="a71eed5f39431b40a80b06f566baa653"/><dir name="Checkout"><file name="Methods.php" hash="e8ea7716b28587ecfb73bff7bb37b059"/><file name="Onepage.php" hash="51c0a6cecbc3f5ed55aa781653eba0fd"/><file name="Redirect.php" hash="19932aa45299e5ea3995f52cb9987183"/><file name="Submit.php" hash="f76e5952a9864e8d747c6123757e13bc"/></dir><file name="Checkout.php" hash="7241b560aedbc7eb728af8ea937af335"/><dir name="Cms"><file name="Page.php" hash="93bd77b2b3f2b8b1e72a3e6391553426"/></dir><file name="Cms.php" hash="a12fd4b2a437c8a6c0b2b65a1e471c23"/><dir name="Customer"><file name="Address.php" hash="cef92ca089a5cd7cd1218339104c4894"/><file name="Edit.php" hash="226f77d8cee872c4c622c062cfe1eff0"/><file name="Group.php" hash="c717d5faf52919787aa0f87270856ca3"/><file name="List.php" hash="17f0096755be01327c163a701b9f3780"/><file name="Login.php" hash="77df1e0afcf40e6129fb61397217f053"/><dir name="Order"><file name="List.php" hash="1e6ea53a87108ca487d9a58ac42f382f"/></dir><file name="Order.php" hash="da1565601bac963b72f64b0e6a147704"/><file name="Password.php" hash="6df128903742a8723f0a59c4203f8b12"/><file name="Register.php" hash="e25d0045e0d8ff650ca208b9fe75e3ae"/></dir><file name="Customer.php" hash="ecf57dcf8bbba1ebb12ed10630bd1715"/><file name="Mage.php" hash="731d7a85645d95af3a8fb281d0efaf42"/><dir name="Product"><file name="Crosssell.php" hash="1fbc8c3886de3703a77e911ac459422c"/><file name="List.php" hash="8d84ec9326a6747de6d2ca0a5aceee6c"/><file name="Price.php" hash="d47c9903d5719b0cee73836419e27bb1"/><file name="Purchased.php" hash="feb7fd9176da74e59722984732d04a9a"/><file name="Related.php" hash="8a6b52fc39f099f4339a91ad5709537a"/><file name="Review.php" hash="549ffdfaea3d95ac1f18e9d4ef18d6eb"/><file name="Search.php" hash="f760256b6158dacf44754cc026286c97"/><file name="Upsell.php" hash="319fe08a0a4c52c41ec4418b312e1842"/><file name="Url.php" hash="4b920cc4913b77b1e463afad27ad5b78"/><file name="Viewed.php" hash="c2a9c99a56b57d8288eec75657f9bd47"/></dir><file name="Product.php" hash="33f395e10d5578d948bf32a7bd5388fd"/><file name="Wishlist.php" hash="ee26b4efcbf3b2c39aec2c1e3402c35b"/></dir><file name="Server.php" hash="1f51d81e323af28fd78618e62db11d82"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Icon.php" hash="242de9b094f94e397dc606dc926cc33f"/><file name="Payment.php" hash="5964322419785004a6c3f84a940d8d13"/><file name="Shipping.php" hash="016f22646fbac10cd81c6b7904c9abde"/></dir><dir name="Source"><dir name="Address"><file name="Attributes.php" hash="1a29b64d271693fba3ea76599d3408e2"/><file name="Validatetype.php" hash="6f4d9767ac0e476ec6a6cd3964882721"/></dir><file name="Attributes.php" hash="4b4de29e00623c971038d6fe895e5e76"/><dir name="Bazaarvoice"><file name="Env.php" hash="bc619503d1b175e74f7eaf2ba15ae8b4"/></dir><dir name="Catalog"><file name="Direction.php" hash="68cd86444037506ec39de8eba3c07d8b"/><file name="Sortby.php" hash="d2aba9a3798b8e2eee8c275fbbd202e1"/></dir><file name="Catalogimage.php" hash="500f9994ea13e463a5e5e5d3963cfbd1"/><dir name="Customer"><file name="Attributes.php" hash="8963356aabf88647ab5ecbbbe8cfb9f1"/></dir><file name="Defaultimage.php" hash="04c896116c01b16e2ac8d7f23bbc29d6"/><file name="Payment.php" hash="70e82f4887eb297d6a58160f64bfd204"/><file name="Shipping.php" hash="7d8e5a2dc8a57099d908bef2403aad46"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Japi"><file name="LogController.php" hash="b17e024285aea7b6834cf5bc9b868916"/><file name="OrderController.php" hash="e6b7c1f5a7156a06fa3f51c32e6bbba9"/><file name="PaymentController.php" hash="a6f7cce53b85e2011bfb457cef98683a"/><file name="ReportController.php" hash="e88b2425e0a39f7f2b0c2902a6d2d5e9"/><file name="TroubleshootingController.php" hash="bb8951d1523a56a0f55e827614a38d66"/></dir></dir><file name="CheckoutController.php" hash="379751def26d6bd9b69a526707f4b464"/><dir name="Customer"><file name="AccountController.php" hash="2e055c5b22a2414263a1b7d3fd0607f9"/></dir><file name="CustomerController.php" hash="e3204496e61f58a572ef8f9b3cefe38f"/><file name="ImageController.php" hash="a5b48d4e075faf989c908bd0954d3878"/><file name="KcoController.php" hash="38e15112f3438edd6723478cf18c6cab"/><file name="KlarnaController.php" hash="90474b512fdc813039a86ae8f24a0b39"/><dir name="Rest"><file name="CartController.php" hash="3994aafe8e31094b765fc0120c888fa3"/><file name="CatalogController.php" hash="8df5b798bb0330f5e3182717e1e15bf7"/><file name="CheckoutController.php" hash="65b3a3592cdfc0a51c254451505dedea"/><file name="CmsController.php" hash="cb1bc3f67136434c4d8af1b5660eab1e"/><file name="CustomerController.php" hash="ca2b76f8f4e8a84d81749b37910287bd"/><file name="MageController.php" hash="e267156b2acf82d309b6c8c4680a7371"/><file name="ProductController.php" hash="81c0a0b0afcdfe99d6c651244baa075c"/><file name="WishlistController.php" hash="d7b0c8ff628b4244d120843d54a41248"/></dir><file name="TestController.php" hash="ffb60653808c0e0af00cc73d4755ef99"/></dir><dir name="data"><dir name="japi_setup"><file name="data-install-2.0.0.php" hash="bcf6de66f6b296182268b11b3e80bbeb"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="9d1888abb4ed93ec7b3e1fa678fb1411"/><file name="config.xml" hash="c18d759dd47bda0ba38102d5f3f48dc7"/><file name="system.xml" hash="c5881750c4f6211ed06612cc856ed228"/></dir><dir name="sql"><dir name="japi_setup"><file name="install-1.0.0.php" hash="ce407ff5715c837d02b1aba7975bf512"/><file name="upgrade-2.0.1.2-2.0.2.php" hash="6fc0e0306b685279fc60f298643d181a"/><file name="upgrade-2.1.6-2.2.0.php" hash="947afcf7e20dfc2c3a3e45d8e5c316cd"/><file name="upgrade-2.2.0-2.2.1.php" hash="12a28845acf823eefc5f613b048efe52"/><file name="upgrade-2.8.2-2.9.0.php" hash="2761423f65920af0f8ba05d438710869"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Jmango360_Japi.xml" hash="b60701b3a14084fa1a440ca5fe5bf47b"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="jmango360_japi.xml" hash="d6e1656e4a8e79dd9e37e0b09a5f57a6"/></dir><dir name="template"><dir name="japi"><dir name="report"><file name="chart.phtml" hash="102704d97cf69793a50fa96538bd767f"/><dir name="grid"><file name="container.phtml" hash="79050f4e2bc7b70ae452e850fc27e0b7"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="button"><file name="paypal.phtml" hash="247d0fd0a221f61bfa5b97dae8d95640"/></dir></dir></dir></dir><dir name="widget"><dir name="form"><dir name="renderer"><dir name="element"><file name="chart.phtml" hash="fb14be221a9ec0faad4ace8579c5dddc"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="jmango360_japi.xml" hash="23b9be12d2ca7c58fa5f942012ba5e2b"/></dir><dir name="template"><dir name="japi"><dir name="TIG"><dir name="PostNL"><dir name="av"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="6756588fef4d689418cbb4ea8d4ad92e"/><file name="shipping.phtml" hash="95a2f56b36a8111eba9c582b2b3d1d57"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="9a623e8c2184d08c2b288456ba50aef4"/><file name="postcode_check.phtml" hash="cbb8bfd76db65041cafacf976312ceb7"/></dir></dir></dir><dir name="do"><dir name="onepage"><file name="available.phtml" hash="8fce41a1696540a4546b52c025f3dde7"/></dir></dir></dir></dir><dir name="checkout"><dir name="onepage"><file name="additional_agreements.phtml" hash="2169df7f5c0d8b03e046cd000c9bea5f"/><file name="address.phtml" hash="3164ff4fc2d5f798e591a168d9d937d1"/><file name="agreements.phtml" hash="ae43c3b670b0d11a1217ca927a184ff7"/><file name="billing.phtml" hash="105051160f867d8e016593edcb6888b8"/><file name="coupon.phtml" hash="2b75d2b0c7e11276e1c85f7d4c1366bb"/><file name="js.phtml" hash="ac1740fe3e829d228a57b1e1a9dda58b"/><dir name="payment"><file name="info.phtml" hash="26bb640843ee3fb6e72b4f2739f0a111"/><file name="methods.phtml" hash="1680b5e33d8123fdb58ecbd353ff1ba7"/></dir><file name="payment.phtml" hash="966bfc2c8ca160086fa10bf63022172b"/><dir name="review"><file name="button.phtml" hash="e2089ae34e409df2fa13977a55db5f04"/><file name="info.phtml" hash="306936f465adcc1c09ad37b58609085d"/><file name="item.phtml" hash="244bba60d9151be71777e80e138b6ee7"/><dir name="totals"><file name="grand_total.phtml" hash="4ee3bdd1190a459e243249e288e6caff"/><file name="shipping.phtml" hash="75900b7d4cfb370e803d1489148450ad"/><file name="subtotal.phtml" hash="f91e3bc1a39761fa7cea8fc296091430"/><file name="tax.phtml" hash="37173b32341b2692a7890111f02f2938"/></dir><file name="totals.phtml" hash="0decbe242701193fee270e1f0f520a93"/></dir><file name="review.phtml" hash="d2494b8faac5833e747a5d329ee4fab7"/><file name="shipping.phtml" hash="f955c8b11f494041f1a88939219c1590"/><dir name="shipping_method"><file name="additional.phtml" hash="78c6dab72fefb888f587221639bf9177"/><file name="available.phtml" hash="4feca53deabec45bc3b223e64e32c4f0"/></dir><file name="shipping_method.phtml" hash="7f948fdc0601e48be0834178b56dbfb3"/><file name="style.phtml" hash="a1c2a9d43448339e6b9dfe8163e7b784"/></dir><file name="onepage.phtml" hash="d23107c80b94522e00c7d0c1ec5a4577"/></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="900db1b8385f75e448f7ca42c8d113da"/></dir><dir name="form"><file name="additional.phtml" hash="0d413b832a447a524de18c74cbd17844"/><file name="edit.phtml" hash="484b2b56cbf34dba73c78dc97552c024"/><file name="register.phtml" hash="8d41d5471f450633a277feb13502d646"/></dir></dir><dir name="fatturazione"><dir name="customer"><dir name="address"><file name="edit.phtml" hash="e7f27a8a61d9554bfbc4f36dfff60e4d"/></dir></dir></dir><file name="form.phtml" hash="eec0416c8830c4ebe004256d86c7ea59"/><dir name="giftmessage"><file name="inline.phtml" hash="78814da47aed68315b7d1d6b2e64c4c7"/></dir><file name="js.phtml" hash="9af5ac67d9b1a4fc689084e135215f99"/><dir name="kega_checkout"><dir name="onepage"><file name="payment.phtml" hash="a8d62337a136e32bed218f2de0523ac8"/></dir></dir><dir name="nwt"><dir name="kco"><dir name="cart"><dir name="item"><file name="default.phtml" hash="212018e8f0c4472a07fc81633d27c550"/></dir></dir><file name="checkout.phtml" hash="c7781347405e7e59322d9fc3b2f42b3c"/></dir></dir><dir name="page"><dir name="html"><file name="head.phtml" hash="b6a8cc30cd31bf642c2f885ed1fda855"/><file name="smart-app-banner.phtml" hash="8423731f246db33efb61026dd9ef5ddc"/></dir><file name="rwd.phtml" hash="06c53b02ad843574b22a803a709988f6"/></dir><dir name="symfony"><dir name="postcode"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="dea3cefc72e6317c5ea6e0db553d8758"/><file name="shipping.phtml" hash="56d1f7414cc62887b3d9d8de7e192440"/></dir></dir></dir></dir><dir name="vaimo"><dir name="klarna"><dir name="klarnacheckout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="f9f469de9cd1243cab176fc56071db64"/></dir></dir><file name="cart.phtml" hash="b40f17348beb248c4f1ff22374a1a05d"/><dir name="customer"><file name="balance.phtml" hash="198809cb8ebf8a468b89497c9abba07c"/></dir><dir name="discount"><file name="coupon.phtml" hash="1f3686b00a610d3f038c84e3621ef913"/></dir><file name="header.phtml" hash="fed93df0c84265a0f980b0de103945b8"/><file name="main.phtml" hash="94ad4f3aa30ae7db1131a1fe48ea2a99"/><file name="newsletter.phtml" hash="3a2251b9559e8b87b46ddf08b7cd27e2"/><file name="reward.phtml" hash="38c218d3777f11b03c3686067a706d00"/><file name="shipping_method.phtml" hash="44bb3c6efaab76641e02a07c2007a090"/><file name="sidebar.phtml" hash="410508fd9089e0be030915836abb42e2"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="japi"><dir name="css"><dir name="TIG"><dir name="Buckaroo3Extended"><file name="styles_opc.css" hash="9b0ecbbeb22655e2e896ec8134fa8188"/></dir></dir><file name="gomage-checkout.css" hash="223657dbb0aba2783bb9e8de4b633d93"/><dir name="icomoon"><dir name="fonts"><file name="icomoon.eot" hash="842065e274d718c38968a81a721d49f4"/><file name="icomoon.svg" hash="2deea3fcd9ecc464a422aa37943b5848"/><file name="icomoon.ttf" hash="8ffbfccd78de7c37eadeca837ee40344"/><file name="icomoon.woff" hash="32df67c3aed8769c316b3e7ff1bb637c"/></dir><file name="style.css" hash="178c956df2a327dc88e4ef8069caa9bc"/></dir><file name="send-cloud.css" hash="77f77fa89359fe508708ec522a5e76d8"/><file name="style.css" hash="5d7b93ff05aa5148ed80d524f3360040"/><file name="style.less" hash="df960797823955d7a37ba9322c6ef051"/></dir><dir name="images"><file name="ajax-loader.gif" hash="f48ee069890b16455c3ddcacee9b5f75"/><file name="bg-down.png" hash="04d7cd2963010b610f608aca03a45c63"/><file name="bg-up.png" hash="2882d38108532275fb1d425bbd021c9d"/><file name="glc_sprite.png" hash="5cd6f3ba1df3a6d26db5bbc193ce9c61"/></dir><dir name="js"><file name="checkout.js" hash="3b74e8a4d0fd21b3718ed86812edcc92"/><dir name="vaimo"><dir name="klarna"><file name="klarnautils.js" hash="e29553aa8446af7672c9ba1814fac3a5"/></dir></dir><dir name="varien"><file name="form.js" hash="9abc0bb4419828513b5c6e904a041616"/></dir></dir><dir name="lib"><dir name="bootstrap"><dir name="css"><file name="bootstrap.min.css" hash="5d5357cb3704e1f43a1f5bfed2aebf42"/></dir><dir name="fonts"><file name="glyphicons-halflings-regular.eot" hash="f4769f9bdb7466be65088239c12046d1"/><file name="glyphicons-halflings-regular.svg" hash="89889688147bd7575d6327160d64e760"/><file name="glyphicons-halflings-regular.ttf" hash="e18bbf611f2a2e43afc071aa2f4e1512"/><file name="glyphicons-halflings-regular.woff" hash="fa2772327f55d8198301fdb8bcfc8158"/><file name="glyphicons-halflings-regular.woff2" hash="448c34a56d699c29117adc64c43affeb"/></dir><dir name="js"><file name="collapse.js" hash="2bc99ca6c9b060ba5616f41ddd5e2703"/><file name="modal.js" hash="b7d8f688e67e78c07ffde44ec4248fd9"/><file name="transition.js" hash="3cb001675410903ecaadcfeb7c296965"/></dir></dir><dir name="jquery"><file name="jquery-1.11.2.min.js" hash="5790ead7ad3ba27397aedfa3d263b867"/><file name="jquery-noconflict.js" hash="32eb0a33820167f328a227e11210d32a"/></dir><dir name="ladda"><file name="ladda.min.css" hash="614e769024385cf21879d6a238b682e1"/><file name="ladda.min.js" hash="a34bcf417de7fc290ac5b034caca2371"/></dir><dir name="scrollto"><file name="scrollTo.js" hash="5c86793da8a4bfec6338bec965d35f6b"/></dir><dir name="smart-app-banner"><file name="smart-app-banner.css" hash="64c15053dbd22b44a519f55e75f6c2ca"/><file name="smart-app-banner.js" hash="4162cb20424080964b5d886125b73b47"/></dir><dir name="spin"><file name="spin.min.js" hash="1d06ceb800acbeae82d1fa2ad5b571de"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Jmango360_Japi.csv" hash="dda2ffbc3f1c2e60ac21e980e46499cc"/></dir><dir name="fr_FR"><file name="Jmango360_Japi.csv" hash="49fa338f05916214904965ca3009eadf"/></dir><dir name="it_IT"><file name="Jmango360_Japi.csv" hash="2ff891468a5c5fe0bd3775cc155341cb"/></dir><dir name="pt_PT"><file name="Jmango360_Japi.csv" hash="3a70c94cf76ccf0649ab2c525f2acece"/></dir><dir name="pt_BR"><file name="Jmango360_Japi.csv" hash="3a70c94cf76ccf0649ab2c525f2acece"/></dir><dir name="ar_SA"><file name="Jmango360_Japi.csv" hash="25b829fa5515c567af7ed8e5e4a2690a"/></dir><dir name="nl_NL"><file name="Jmango360_Japi.csv" hash="e7bf7f06b20dfa3ed3f5fcc49b5591a0"/></dir><dir name="sv_SE"><file name="Jmango360_Japi.csv" hash="3414d54579206e71cabaaea3153bc266"/></dir><dir name="da_DK"><file name="Jmango360_Japi.csv" hash="a8f243d230a312f4d5cee8c99a275ee7"/></dir><dir name="es_ES"><file name="Jmango360_Japi.csv" hash="0f763b984f64e095f863c2e66335c791"/></dir><dir name="de_DE"><file name="Jmango360_Japi.csv" hash="d9b0379bdb87bd4e70c12f131db76dd8"/></dir><dir name="el_GR"><file name="Jmango360_Japi.csv" hash="485815339ffff7bc4aac29803866e60d"/></dir></target><target name="magelib"><dir name="Jmango360"><dir name="Braintree"><file name="LICENSE" hash="7203c8834a3b633e63fba98aaedf7246"/><dir name="lib"><dir name="Braintree"><file name="AccountUpdaterDailyReport.php" hash="24081e5126e923c106d38de6d4bfa206"/><file name="AchMandate.php" hash="1c27b15b8508745e678f9637c495f126"/><file name="AddOn.php" hash="82925560fd6d09575150d03851132999"/><file name="AddOnGateway.php" hash="71f1cf435ad4a0f846cbdb61f54582b6"/><file name="Address.php" hash="80b3e24e93c142cc2fdb0401542c74f9"/><file name="AddressGateway.php" hash="5785772be266f1095ec9badc42872eda"/><file name="AmexExpressCheckoutCard.php" hash="e8638efd3aa53c9029c9a779c9a3c0d3"/><file name="AndroidPayCard.php" hash="b2dea285101ac3a6a811b35f854a8f70"/><file name="ApplePayCard.php" hash="ad86024899c22c02b2fe4661fb9795c3"/><file name="Base.php" hash="e32c757071d8f8effc5660cd1ce58c6b"/><file name="ClientToken.php" hash="81e2f643f912c8943560008d2fa7869d"/><file name="ClientTokenGateway.php" hash="bbac8367658b596480b50e1e7dd049b5"/><file name="CoinbaseAccount.php" hash="a0794c8d29dbab81ecf32dac6c4d66c1"/><file name="Collection.php" hash="ba52af974da21b424c7b9a6a881f4f26"/><file name="Configuration.php" hash="1e4c293d778380623a9806674cf1944f"/><file name="ConnectedMerchantPayPalStatusChanged.php" hash="3ebdd7be5c997c811ae134d6a6451f41"/><file name="ConnectedMerchantStatusTransitioned.php" hash="7ead86a6c4fc0c79d0f9277f0efd0068"/><file name="CredentialsParser.php" hash="85c9539be64146fa3ddde216f4ac20c9"/><file name="CreditCard.php" hash="0452233946373d6a6c3ac4e686a7b572"/><file name="CreditCardGateway.php" hash="e8ebf4e755318acfa0c6c014a64c9675"/><file name="CreditCardVerification.php" hash="b06ad08b7120572732498d2035a25952"/><file name="CreditCardVerificationGateway.php" hash="38a299c6e9a500fbf7e962e39f34e4bf"/><file name="CreditCardVerificationSearch.php" hash="93e08c9a258af84003700013d497cd82"/><file name="Customer.php" hash="4fd732fd33dfcf173fcb39cb005c4e3e"/><file name="CustomerGateway.php" hash="78d8a3f62be79d7ae67846ce6359646c"/><file name="CustomerSearch.php" hash="8e8d024b951a4baa458556d4281fe988"/><file name="Descriptor.php" hash="97dc19a001fb6845c0c0eb0ee396f9bf"/><file name="Digest.php" hash="622fb0f1a11cf4dc8ee0a6f5fe7150e8"/><file name="Disbursement.php" hash="851eb18f89594984838ce1c59f8e6d8c"/><file name="DisbursementDetails.php" hash="ce5af619a858d883453c21c0f9217163"/><file name="Discount.php" hash="ba59054dd8d42d600c6dfb5813267150"/><file name="DiscountGateway.php" hash="8c354a122a23e3ad2136905e1c9b1d95"/><dir name="Dispute"><file name="TransactionDetails.php" hash="3a554f1576f6269d1d7137d14be8b361"/></dir><file name="Dispute.php" hash="1478be0c3c39725eef8976c6531f4ebb"/><file name="EqualityNode.php" hash="62715d694920f751dfa270ee6234eb43"/><dir name="Error"><file name="Codes.php" hash="6f16da1bd831cb48faeb6f62389ed6f5"/><file name="ErrorCollection.php" hash="b32f1904ee32cf078470c109cec497c8"/><file name="Validation.php" hash="f5062b7d7385bac2c9fb8e653e7ecbdf"/><file name="ValidationErrorCollection.php" hash="bb82bf92f7d33e607d59fc9c36aaf8e0"/></dir><file name="EuropeBankAccount.php" hash="8784a357d37c42673e60f8c866228af8"/><dir name="Exception"><file name="Authentication.php" hash="d21bc381984fa6078377aacfe930f27f"/><file name="Authorization.php" hash="4b17dca02c715fcd50d6d80a40e808ce"/><file name="Configuration.php" hash="225dfca2a3fcb48620e971a03acc6213"/><file name="Connection.php" hash="97bf914cc5e53e573932b57eb60167be"/><file name="DownForMaintenance.php" hash="f9827287436a4c51669fad4c637238a6"/><file name="ForgedQueryString.php" hash="c8a65e4c3e20f4f834914d67a9e782cc"/><file name="InvalidChallenge.php" hash="d825f5fc7acf8dd0e92dc886e7351721"/><file name="InvalidSignature.php" hash="a627af00c19b01a92fe01d432e3296d9"/><file name="NotFound.php" hash="7ee49bce52fc34db868443d569300470"/><file name="SSLCaFileNotFound.php" hash="fcc6e63349cad74ae9651af421cfec15"/><file name="SSLCertificate.php" hash="2b23ad8a5f477accd97a5d26db3e9b68"/><file name="ServerError.php" hash="2dbc5d988ed3bf2ba858dfe8c1ce68e6"/><file name="TestOperationPerformedInProduction.php" hash="55dcb7ed8f8886a77edfd754a775567a"/><file name="Timeout.php" hash="48b27846cc5a412148be05ed081288f9"/><file name="TooManyRequests.php" hash="84c506492eae180f47a325871c7e4d5a"/><file name="Unexpected.php" hash="eb871413e9d4c394b2e4a5d4da02c7d4"/><file name="UpgradeRequired.php" hash="22d1766b6d115cd7144ed2b9186afc85"/><file name="ValidationsFailed.php" hash="3ee5ce23d0bda2f2794f5d5451111417"/></dir><file name="Exception.php" hash="cedf12b332e21324f4a6579426a3ab00"/><file name="FacilitatorDetails.php" hash="7a25557b06c663197d1aea39bd93e776"/><file name="Gateway.php" hash="d7705ccfa1caa0734c505651fc1381a2"/><file name="Http.php" hash="6c1428f7a9a397b1a6a45ebcdd0f6897"/><file name="IbanBankAccount.php" hash="fd44b18d5e0e64dec0e1fcffc445e6c1"/><file name="IdealPayment.php" hash="474ea0309045ed88db4de538ec739a4c"/><file name="IdealPaymentGateway.php" hash="b79384c4be5c89f212096cb1cb3c701f"/><file name="Instance.php" hash="827ebd75d39217e53873c82e753fc1ed"/><file name="IsNode.php" hash="783c6ad65c6030a12ad52253cd5bc1a8"/><file name="KeyValueNode.php" hash="6668a312a6aaaddbdcfc940775ed5820"/><file name="MasterpassCard.php" hash="24a6394c5ae1370c01ee35dbd764654b"/><file name="Merchant.php" hash="b1f8444fc109708a43017d6cda9536a2"/><dir name="MerchantAccount"><file name="AddressDetails.php" hash="540f9e79b8df5da5267835dd01db45c1"/><file name="BusinessDetails.php" hash="ca8a0dc16bce3fff5831fd22652b2f6b"/><file name="FundingDetails.php" hash="9ba992a0dda1be9a0cf8bd8b53ea33be"/><file name="IndividualDetails.php" hash="4855a6aa64b35ecab7bada4e3e0fc0c3"/></dir><file name="MerchantAccount.php" hash="a4ba2e530164c06b8e50ef8ff10f76f2"/><file name="MerchantAccountGateway.php" hash="ad62343cbbdb3e0d9732edfb7255d26c"/><file name="MerchantGateway.php" hash="e9d0fc529b7a32f7080201991deb29d1"/><file name="Modification.php" hash="5df7d89d7365e9edf7235f09b9b7ced4"/><file name="MultipleValueNode.php" hash="2555632262d8b7d81a69739817e1887d"/><file name="MultipleValueOrTextNode.php" hash="9d4a49bc8051d47fd820da2ffef03936"/><file name="OAuthCredentials.php" hash="661accf840ad921523b48ec1be8d9075"/><file name="OAuthGateway.php" hash="f1e54a919b9b65117114b8de7ebfc6f0"/><file name="OAuthResult.php" hash="6f7384d12e28b6748ef3cb92128d833d"/><file name="PaginatedCollection.php" hash="c45cd3395c53ac37946ab3defaab84ef"/><file name="PaginatedResult.php" hash="821bdf0de25d98df7054af24c33b1ce4"/><file name="PartialMatchNode.php" hash="084258b5f9f39a493ca6b02e7019a101"/><file name="PartnerMerchant.php" hash="389c4fae22a19d75b312998027b3fe0e"/><file name="PayPalAccount.php" hash="902debd6d7cdc62e018e3541484a8a5e"/><file name="PayPalAccountGateway.php" hash="5d0a865c2d012511f4a2b3e2c9029053"/><file name="PaymentInstrumentType.php" hash="44cfb496a9bd50eae618e18fcf41e856"/><file name="PaymentMethod.php" hash="3e53b3edd2bdd87fec010709c8acab8c"/><file name="PaymentMethodGateway.php" hash="3ac1231bc63edf1fff681442d4474db0"/><file name="PaymentMethodNonce.php" hash="73330240522e5655bbf01bb90629487f"/><file name="PaymentMethodNonceGateway.php" hash="f103b6749b9700a923e4cc1679f8ba4e"/><file name="Plan.php" hash="fcf369071d74d273604fc63ea2548f2b"/><file name="PlanGateway.php" hash="8713f672e916f26460b06a156b511e32"/><file name="RangeNode.php" hash="a3f74af2c4811a68c9f31ca136cc1c82"/><file name="ResourceCollection.php" hash="8e9da02c6ca6bf5e819efe6ad7837bf2"/><dir name="Result"><file name="CreditCardVerification.php" hash="c64c8bb4a76f77688ebc49a4f6769a20"/><file name="Error.php" hash="09b138f5992593ae33ea3e6f588d1ceb"/><file name="Successful.php" hash="9d2d014d188cbadf773ccca83cc2408d"/></dir><file name="RiskData.php" hash="61de70d88d4b40168e54cea84d2afc70"/><file name="SettlementBatchSummary.php" hash="73a3b6b583b5a852b3d1437b2d62ec5f"/><file name="SettlementBatchSummaryGateway.php" hash="d66b1708f32d1bcc4d738bf39df649b7"/><file name="SignatureService.php" hash="566a5d18567a513f4a527ebf3c8cd410"/><dir name="Subscription"><file name="StatusDetails.php" hash="4c01d220704e6d285c77dc2011f8746e"/></dir><file name="Subscription.php" hash="07ed981ef67b946f97598f48ae00e871"/><file name="SubscriptionGateway.php" hash="b82884333c65a8b747e1dae4919bf2a8"/><file name="SubscriptionSearch.php" hash="e97a9a2a7187058082afab7701f37b1a"/><dir name="Test"><file name="CreditCardNumbers.php" hash="c7b8fbac49f64deb33a8ac3d66757d68"/><file name="MerchantAccount.php" hash="2c700e2724472c0af362ecee6de04bc8"/><file name="Nonces.php" hash="19e6111751b9980732ebb00b41d1d35f"/><file name="Transaction.php" hash="54a421889bb7753192d06150758523ac"/><file name="TransactionAmounts.php" hash="aff59733ffd5a23ddd44ed37f6bda9a7"/><file name="VenmoSdk.php" hash="92872ddddd03c83489a81f8da99839a5"/></dir><file name="TestingGateway.php" hash="3ec7fe4a5a11f2db91b5ecaa6ab6d1c1"/><file name="TextNode.php" hash="da1cc61af2896b945552318d67bd2a46"/><file name="ThreeDSecureInfo.php" hash="8cbb2a63c256368123cb01f2e2a2a194"/><dir name="Transaction"><file name="AddressDetails.php" hash="ca29baa27dcc5c7ccddb7c653d6d99d4"/><file name="AmexExpressCheckoutCardDetails.php" hash="18c96b2d98d81918ec128101d8d69709"/><file name="AndroidPayCardDetails.php" hash="0c278d6aa4bddf669c949617ae37a880"/><file name="ApplePayCardDetails.php" hash="1a544ea0efe19943ff1618ada4100fcc"/><file name="CoinbaseDetails.php" hash="5a5e297bcc19f7d5e21c2f2886abaa09"/><file name="CreditCardDetails.php" hash="13385b916ec0e321e61c18e63baf1c58"/><file name="CustomerDetails.php" hash="fe0012e585006193a39cea9fd6c6eb7c"/><file name="EuropeBankAccountDetails.php" hash="520703e2689c99547bde17e8464df7d5"/><file name="IdealPaymentDetails.php" hash="444d3093c700de8217708a94cd2575e7"/><file name="MasterpassCardDetails.php" hash="f4aa0601b94d6ada0f9b29e27f8a4bc6"/><file name="PayPalDetails.php" hash="022041c82de738e45db9cef4da2eee1f"/><file name="StatusDetails.php" hash="59a90119124d8cb1efcb476e66db984e"/><file name="SubscriptionDetails.php" hash="8fe6507f04dda08b8aafc45a93ed2a4f"/><file name="UsBankAccountDetails.php" hash="52fdad1e440a36a8f2ce27719ecf72b6"/><file name="VenmoAccountDetails.php" hash="87f02410e01dea1e68f1d07130dd0539"/><file name="VisaCheckoutCardDetails.php" hash="d4909eb31f17abc5b16775e09c18687f"/></dir><file name="Transaction.php" hash="95e1fcccd0b58c0547646568fe16cc4f"/><file name="TransactionGateway.php" hash="2c4d9dc9f4a1d2a99788db533a868c6f"/><file name="TransactionSearch.php" hash="634b7a51905a41c1f037f186b53b540e"/><file name="TransparentRedirect.php" hash="134d55a603fa9d0c203c6a0635b93605"/><file name="TransparentRedirectGateway.php" hash="30deff1d0369b6a340260dac78f677ce"/><file name="UnknownPaymentMethod.php" hash="2b5d3ccae34ae73cf728ec38266a42e3"/><file name="UsBankAccount.php" hash="51ab8e304753c92de6ea87d019163b78"/><file name="UsBankAccountGateway.php" hash="ccde686657990c8db38a844ab86809ae"/><file name="Util.php" hash="9b2f24aab2919001d2e859ee8fce1207"/><file name="VenmoAccount.php" hash="fe5a40901d3924f956902f88b9490727"/><file name="Version.php" hash="6480d6b1aa6be1647a3c6b665e99e67d"/><file name="VisaCheckoutCard.php" hash="011c44b8bbf554eb5a114b65b8f02dab"/><file name="WebhookNotification.php" hash="fd2cb2c1872d55795140da78368af6d3"/><file name="WebhookNotificationGateway.php" hash="9a021c6b737362d61890e9e43dff57c2"/><file name="WebhookTesting.php" hash="f3a95c38979c11c1ac3d5d55e65b5a74"/><dir name="Xml"><file name="Generator.php" hash="3a4f2ad0e8c6ae17788c218587dcfc03"/><file name="Parser.php" hash="af8f3729c58efd1d8f8fbf2672faf8a8"/></dir><file name="Xml.php" hash="30bb301518e06e41a17eb4d03c4d8db9"/></dir><file name="Braintree.php" hash="40f87e43c5b205b646186e0b638da941"/><file name="autoload.php" hash="700bd7dbe39f8d89d925ccbb33651898"/><dir name="ssl"><file name="api_braintreegateway_com.ca.crt" hash="d1155107b085a1ee04dd13a634b00c42"/></dir></dir></dir></dir></target></contents>
37
  <compatible/>
38
  <dependencies><required><php><min>5.2.0</min><max>7.1.0</max></php></required></dependencies>
39
  </package>
skin/frontend/base/default/japi/css/style.css CHANGED
@@ -1533,3 +1533,10 @@ label[for^="s_method_chronorelais_Chronopost_relais_France"] {
1533
  #checkout-payment-method-load dd.ppp.ppp-selected {
1534
  padding: 0;
1535
  }
 
 
 
 
 
 
 
1533
  #checkout-payment-method-load dd.ppp.ppp-selected {
1534
  padding: 0;
1535
  }
1536
+ /** LaPoste_SoColissimoSimplicite **/
1537
+ label[for="s_method_socolissimosimplicite_socolissimosimplicite"] {
1538
+ display: inline !important;
1539
+ }
1540
+ #socolissimosimplicite_iframe_wrapper iframe {
1541
+ width: 100%;
1542
+ }
skin/frontend/base/default/japi/css/style.less CHANGED
@@ -1832,3 +1832,12 @@ label[for^="s_method_chronorelais_Chronopost_relais_France"] {
1832
  padding: 0;
1833
  }
1834
  }
 
 
 
 
 
 
 
 
 
1832
  padding: 0;
1833
  }
1834
  }
1835
+
1836
+ /** LaPoste_SoColissimoSimplicite **/
1837
+ label[for="s_method_socolissimosimplicite_socolissimosimplicite"] {
1838
+ display: inline !important;
1839
+ }
1840
+
1841
+ #socolissimosimplicite_iframe_wrapper iframe {
1842
+ width: 100%;
1843
+ }
skin/frontend/base/default/japi/js/checkout.js CHANGED
@@ -201,8 +201,9 @@ if (typeof Checkout !== "undefined") {
201
  },
202
 
203
  gotoSection: function (section, reloadProgressBlock) {
204
- this.currentStep = section;
205
  var sectionElement = $('opc-' + section);
 
 
206
  sectionElement.addClassName('allow');
207
  this.cleanList(sectionElement);
208
  this.initLaddaButtons(section);
@@ -557,4 +558,52 @@ if (typeof Review !== 'undefined') {
557
  if (!this.moreForms) this.moreForms = [];
558
  this.moreForms.push($(formId));
559
  };
560
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  },
202
 
203
  gotoSection: function (section, reloadProgressBlock) {
 
204
  var sectionElement = $('opc-' + section);
205
+ if (!sectionElement) return;
206
+ this.currentStep = section;
207
  sectionElement.addClassName('allow');
208
  this.cleanList(sectionElement);
209
  this.initLaddaButtons(section);
558
  if (!this.moreForms) this.moreForms = [];
559
  this.moreForms.push($(formId));
560
  };
561
+ }
562
+
563
+ document.observe('dom:loaded', function () {
564
+ if (typeof SocoShippingMethod !== 'undefined') {
565
+ SocoShippingMethod.prototype.freezeSteps = function () {
566
+ this.savedAllowedSteps = [];
567
+
568
+ var steps = $('checkoutSteps').children;
569
+ for (var i = 0; i < steps.length; i++) {
570
+ if (steps[i].hasClassName('allow')) {
571
+ this.savedAllowedSteps[i] = true;
572
+ steps[i].removeClassName('allow');
573
+ } else {
574
+ this.savedAllowedSteps[i] = false;
575
+ }
576
+ }
577
+
578
+ /**
579
+ * Hide default "Continue" button
580
+ */
581
+ $('shipping-method-buttons-container').hide();
582
+
583
+ /**
584
+ * Style "Annuler So Colissimo" button
585
+ */
586
+ var $btn = $$('#socolissimosimplicite_iframe_wrapper button')[0];
587
+ if ($btn) {
588
+ $btn.addClassName('ladda-button');
589
+ $btn.setAttribute('data-size', 's');
590
+ }
591
+ };
592
+
593
+ SocoShippingMethod.prototype.unfreezeSteps = function () {
594
+ if (typeof(this.savedAllowedSteps) !== 'undefined') {
595
+ var steps = $('checkoutSteps').children;
596
+ for (var i = 0; i < steps.length; i++) {
597
+ if (this.savedAllowedSteps[i] === true) {
598
+ steps[i].addClassName('allow');
599
+ }
600
+ }
601
+ }
602
+
603
+ /**
604
+ * Show default "Continue" button
605
+ */
606
+ $('shipping-method-buttons-container').show();
607
+ };
608
+ }
609
+ });