first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.payu-table input[data-global=can-be-global][readonly=readonly]{color:transparent}.payu-table .absolute-global fieldset{position:relative}.payu-table .absolute-global fieldset span{position:absolute;left:10px;top:6px}.receive-payment{border:1px solid #a6c307 !important;color:#fff !important;background:#a6c307 !important}.discard-payment{border:1px solid red !important;color:#fff !important;background:red !important}.payu-red{color:#a00}
|
||||
@@ -0,0 +1,31 @@
|
||||
.payu-table{
|
||||
input[data-global="can-be-global"]{
|
||||
&[readonly="readonly"]{
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
.absolute-global{
|
||||
fieldset{
|
||||
position: relative;
|
||||
span{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.receive-payment{
|
||||
border: 1px solid #a6c307 !important;
|
||||
color: #fff !important;
|
||||
background: #a6c307 !important;
|
||||
}
|
||||
.discard-payment{
|
||||
border: 1px solid #ff0000 !important;
|
||||
color: #fff !important;
|
||||
background: #ff0000 !important;
|
||||
}
|
||||
|
||||
.payu-red {
|
||||
color: #aa0000;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.pbl-container{display:flex;justify-content:center;flex-direction:column}.pbl-container .payu-list-banks{list-style-type:none;display:flex;flex-wrap:wrap;margin:0;padding:0;justify-content:center}.pbl-container .payu-list-banks li{padding:5px 3px 0}.pbl-container .payu-list-banks li.payu-inactive{opacity:.5;-webkit-filter:grayscale(1);-moz-filter:grayscale(1);-ms-filter:grayscale(1);-o-filter:grayscale(1);filter:grayscale(1);filter:gray}.pbl-container .payu-list-banks li:not(.payu-inactive) label{cursor:pointer}.pbl-container .payu-list-banks li:not(.payu-inactive) label:hover{background:#ddd;border-color:#aaa}.pbl-container .payu-list-banks li label{padding:10px;display:flex;border:1px solid #bbb;transition:all 250ms;width:86px;justify-content:center;align-items:center}.pbl-container .payu-list-banks li label.active{background:#ddd;border-color:#aaa}.pbl-container .payu-list-banks li label img{width:auto;height:31px;object-fit:contain;margin:0 !important;padding:0}.pbl-container .payu-list-banks li label input{display:none}.pbl-container .pbl-error{padding-top:.5em;padding-bottom:.5em;margin-top:.5em;margin-bottom:.5em;display:none}.pbl-container .pbl-error:before{top:.5em}.payu-accept-conditions{margin-top:15px}.payu-accept-conditions .payu-conditions-description{margin-top:8px;font-size:12px;line-height:120%}.payu-accept-conditions .payu-conditions-description>div{margin:5px 0}.payu-accept-conditions .payu-conditions-description a{text-decoration:underline}.payu-accept-conditions .payu-conditions-description .payu-read-more{text-decoration:underline;cursor:pointer}.payu-accept-conditions .payu-conditions-description .payu-more-hidden{display:none}#payu-card-container{max-width:350px;margin:10px auto 10px;text-align:left;box-sizing:border-box;border:1px solid #bbb;padding:5px;border-radius:5px;background-color:#ddd;color:#333}#payu-card-container .payu-sf-validation-error,#payu-card-container .payu-sf-technical-error{display:none;color:#b21b0f;font-size:13px}#payu-card-container .payu-card-form{background-color:#fff;padding:5px;border-radius:4px;border:1px solid transparent}#payu-card-container .payu-secure-form-invalid:not(.payu-secure-form-focus){border-color:#b21b0f}#payu-card-container label{padding-bottom:2px;font-size:15px}.card-details{clear:both;overflow:auto;margin-top:10px}.card-details .expiration{width:47%;float:left;margin-right:5%}.card-details .cvv{width:47%;float:left}#tokenizeButton{border:none;background:#438f29;padding:8px 15px;cursor:pointer;color:#fff;display:table;margin:10px auto 0}.response-success{color:#438f29}.response-error{color:#900}.autonomy-payu-button{display:flex;align-items:center;text-decoration:none;margin:10px 0}.autonomy-payu-button img{margin-left:10px;width:50px;height:auto}label[for*=payment_method_payu] img{border-radius:0}
|
||||
@@ -0,0 +1,193 @@
|
||||
.pbl-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
|
||||
.payu-list-banks {
|
||||
list-style-type: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
justify-content: center;
|
||||
|
||||
li {
|
||||
padding: 5px 3px 0;
|
||||
|
||||
&.payu-inactive {
|
||||
opacity: 0.5;
|
||||
-webkit-filter: grayscale(1);
|
||||
-moz-filter: grayscale(1);
|
||||
-ms-filter: grayscale(1);
|
||||
-o-filter: grayscale(1);
|
||||
filter: grayscale(1);
|
||||
filter: gray;
|
||||
}
|
||||
|
||||
&:not(.payu-inactive) {
|
||||
label {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #ddd;
|
||||
border-color: #aaa;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
border: 1px solid #bbb;
|
||||
transition: all 250ms;
|
||||
width: 86px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&.active {
|
||||
background: #ddd;
|
||||
border-color: #aaa;
|
||||
}
|
||||
|
||||
img {
|
||||
width: auto;
|
||||
height: 31px;
|
||||
object-fit: contain;
|
||||
margin: 0 !important;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pbl-error {
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
display: none;
|
||||
&:before {
|
||||
top: 0.5em
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.payu-accept-conditions {
|
||||
margin-top: 15px;
|
||||
.payu-conditions-description {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 120%;
|
||||
|
||||
> div {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.payu-read-more {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.payu-more-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#payu-card-container {
|
||||
max-width: 350px;
|
||||
margin: 10px auto 10px;
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #bbb;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
background-color: #ddd;
|
||||
color: #333;
|
||||
|
||||
.payu-sf-validation-error, .payu-sf-technical-error {
|
||||
display: none;
|
||||
color: #b21b0f;
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
#payu-card-container {
|
||||
.payu-card-form {
|
||||
background-color: #ffffff;
|
||||
padding: 5px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.payu-secure-form-invalid:not(.payu-secure-form-focus) {
|
||||
border-color: #b21b0f;
|
||||
}
|
||||
|
||||
label {
|
||||
padding-bottom: 2px;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.card-details {
|
||||
clear: both;
|
||||
overflow: auto;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.card-details .expiration {
|
||||
width: 47%;
|
||||
float: left;
|
||||
margin-right: 5%;
|
||||
}
|
||||
|
||||
.card-details .cvv {
|
||||
width: 47%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#tokenizeButton {
|
||||
border: none;
|
||||
background: #438F29;
|
||||
padding: 8px 15px;
|
||||
cursor: pointer;
|
||||
color: #fff;
|
||||
display: table;
|
||||
margin: 10px auto 0;
|
||||
}
|
||||
|
||||
.response-success {
|
||||
color: #438F29;
|
||||
}
|
||||
|
||||
.response-error {
|
||||
color: #990000;
|
||||
}
|
||||
|
||||
.autonomy-payu-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
margin: 10px 0;
|
||||
|
||||
img {
|
||||
margin-left: 10px;
|
||||
width: 50px;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
||||
label[for*="payment_method_payu"] {
|
||||
img {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 52 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg version="1.1" width="95" height="23" viewBox="0 0 95 23" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="matrix(.3162 0 0 .3194 55.82 -2.376)">
|
||||
<rect x="48.37" y="15.14" width="34.66" height="56.61" fill="#ff5f00"/>
|
||||
<path d="m51.94 43.45a35.94 35.94 0 0113.75-28.3 36 36 0 100 56.61 35.94 35.94 0 01-13.75-28.31z" fill="#eb001b"/>
|
||||
<path d="m123.9 43.45a36 36 0 01-58.25 28.3 36 36 0 000-56.61 36 36 0 0158.25 28.3z" fill="#f79e1b"/>
|
||||
</g>
|
||||
<path d="m25.74 3.413-3.475 16.31h-4.2l3.475-16.31zm17.67 10.53 2.212-6.125 1.273 6.125zm4.687 5.779h3.885l-3.39-16.31h-3.587c-.8058 0-1.486.471-1.789 1.197l-6.303 15.12h4.411l.8758-2.436h5.389zm-10.96-5.327c.01809-4.305-5.927-4.543-5.886-6.466.01226-.5856.5677-1.207 1.781-1.367.6028-.07906 2.261-.1397 4.143.7301l.7366-3.459c-1.011-.3689-2.311-.7234-3.93-.7234-4.152 0-7.074 2.217-7.098 5.393-.02599 2.347 2.086 3.658 3.679 4.439 1.635.7998 2.186 1.312 2.18 2.027-.01088 1.095-1.306 1.578-2.514 1.596-2.112.03359-3.338-.5728-4.315-1.03l-.761 3.574c.9813.4531 2.793.8465 4.672.8668 4.413 0 7.299-2.191 7.314-5.581m-17.4-10.99-6.805 16.31h-4.44l-3.349-13.02c-.2034-.8019-.3803-1.095-.9987-1.433-1.009-.5503-2.676-1.067-4.144-1.387l.1006-.4739h7.147c.9107 0 1.73.609 1.937 1.664l1.769 9.44 4.371-11.1z" style="fill:#1434cb;stroke-width:1.533"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,11 @@
|
||||
<svg version="1.1" width="50" height="25" viewBox="0 0 50 25" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="matrix(.2222 0 0 -.2222 0 32.07)" fill="#a6c307">
|
||||
<path d="m195.1 101.8c-1.462 0-2.646 1.188-2.645 2.652l.004 11.72h-.9756c-6.051 0-8.302-1-8.302-6.524v-12.92c-.00078-.02737-.004-.0548-.004-.08217v-2.833c-.002-.09807-.008-.1894-.008-.2909v-18.06c0-2.206-.424-3.962-1.299-5.326-1.65-2.547-4.917-3.706-10.14-3.712-5.224.0067-8.49 1.164-10.14 3.709-.8776 1.365-1.302 3.122-1.302 5.329v18.06c0 .1014-.005.1928-.007.2909v2.833c0 .02737-.003.0548-.004.08217v12.92c0 5.524-2.251 6.524-8.302 6.524h-1.905c-6.052 0-8.302-1-8.302-6.524v-34.19c0-5.5 1.238-10.16 3.629-13.91 4.619-7.274 13.57-11.15 26.29-11.15.0156 0 .0311.000624.0467.000624.0163 0 .0311-.000624.0475-.000624 12.72 0 21.67 3.874 26.29 11.15 2.391 3.754 3.629 8.411 3.629 13.91v26.34l-6.59.002"/>
|
||||
<path d="m223 120.7-9.953.004c-1.085 0-1.965.8825-1.964 1.97l.003 10.1c.00078 1.088.8814 1.97 1.967 1.97l9.953-.004c1.086 0 1.966-.8825 1.966-1.971l-.004-10.1c0-1.088-.8807-1.969-1.967-1.969"/>
|
||||
<path d="m209.8 134.8-6.76.002c-.7375.00077-1.335.5995-1.335 1.338l.002 6.858c.00078.7398.599 1.338 1.336 1.338l6.76-.002c.7375 0 1.335-.5995 1.335-1.339l-.002-6.858c-.00078-.739-.5983-1.337-1.336-1.337"/>
|
||||
<path d="m38.63 95.42c0-8.113-2.067-12.51-12.97-12.51h-16.79v20.94c0 2.904 1.077 3.983 3.975 3.983h12.81c8.216 0 12.97-2.031 12.97-12.41zm-12.97 20.81h-14.48c-7.735 0-11.18-3.457-11.18-11.21v-49.79c0-2.994.9591-3.956 3.947-3.956h.9782c2.988 0 3.948.9614 3.948 3.956v19.37h16.79c14.9 0 21.85 6.614 21.85 20.81 0 14.2-6.942 20.81-21.85 20.81"/>
|
||||
<path d="m78.73 73.66v-6.825c0-5.564-2.058-8.786-12.58-8.786-6.952 0-10.33 2.521-10.33 7.707 0 5.687 3.39 7.903 12.09 7.903zm-12.58 28.3c-5.737 0-9.332-.7211-10.7-.9943-2.415-.5262-3.424-1.19-3.424-3.942v-.7841c0-1.078.1593-1.825.5011-2.35.3978-.6121 1.038-.9227 1.905-.9227.4227 0 .9123.07157 1.497.2177 1.379.3457 5.786 1.06 10.61 1.06 8.659 0 12.19-2.404 12.19-8.295v-5.258h-10.92c-14.04 0-20.57-4.744-20.57-14.93 0-9.882 6.751-15.32 19.01-15.32 14.57 0 21.06 4.967 21.06 16.11v19.41c0 10.77-6.922 16.01-21.16 16.01"/>
|
||||
<path d="m135.3 99.64c-.6185.7781-1.788.8853-2.96.8853h-.8791c-2.921 0-4.067-.9029-4.714-3.711l-8.117-33.81c-1.013-4.155-2.437-4.914-4.872-4.914-2.983 0-4.177.7135-5.366 4.931l-9.194 33.81c-.7609 2.832-1.883 3.695-4.806 3.695h-.7826c-1.179 0-2.354-.1088-2.957-.8968-.6037-.7893-.3999-1.967-.08869-3.125l9.291-34.1c1.743-6.527 3.814-11.93 11.56-11.93 1.445 0 2.781.201 3.893.5768-2.348-7.399-4.736-10.66-11.78-11.39-1.429-.119-2.358-.3243-2.875-1.02-.5376-.7211-.4154-1.754-.2233-2.676l.1937-.8746c.4201-2.022 1.137-3.276 3.402-3.276.2381 0 .494.01249.7686.03593 10.52.6897 16.15 6.364 19.45 19.58l11.25 45.1c.2668 1.157.4279 2.335-.189 3.112"/>
|
||||
<path d="m208.5 120.7-13.4.005c-1.462 0-2.647-1.187-2.647-2.652l-.00078-1.873h.9297c6.051 0 8.302-1 8.302-6.524v-7.852l6.811-.002c1.462-.00085 2.647 1.186 2.647 2.651l.005 13.59c0 1.465-1.184 2.653-2.645 2.654"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,15 @@
|
||||
<svg version="1.1" width="84" height="23" viewBox="0 0 84 23" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<style>.cls-1{fill:#a70584;}.cls-2{fill:#36b587;}.cls-3{fill:#fad05b;}.cls-4{fill:#000000;}</style>
|
||||
</defs>
|
||||
<g transform="matrix(.082111 0 0 .082115 -1.9197 -1.5922)">
|
||||
<rect class="cls-1" transform="rotate(90 133.64 208.26)" x="103.88" y="178.25" width="59.51" height="60"/>
|
||||
<rect class="cls-2" transform="rotate(90 133.38 127.76)" x="103.39" y="97.76" width="60" height="60"/>
|
||||
<rect class="cls-3" transform="rotate(90 53.385 207.76)" x="23.39" y="177.76" width="60" height="60"/>
|
||||
<path class="cls-4" d="m342.51 94c0 41.36-33.28 74.65-76.2 74.65h-32.66v68.42h-49.76v-217.68h82.42c42.92 0 76.2 33.28 76.2 74.61zm-49.76 0c0-15.87-11.2-28-26.44-28h-32.66v56h32.66c15.24 0 26.44-12.1 26.44-28z"/>
|
||||
<path class="cls-4" d="m516.07 77.35v159.65h-47.89v-15c-10.54 12.13-26.18 19.48-47.58 19.48-41.82 0-76.31-36.72-76.31-84.3s34.49-84.29 76.31-84.29c21.4 0 37 7.34 47.58 19.48v-15zm-47.89 79.82c0-23.94-16-38.95-38-38.95s-38 15-38 38.95 16 39 38 39 38-15.05 38-39z"/>
|
||||
<path class="cls-4" d="m698 77.35-54.2 153.79c-17.76 50.42-46 70.4-90.37 68.18v-44.4c22.19 0 32.66-7 39.64-26.31l-63.07-151.26h52.32l35.2 97 29.81-97z"/>
|
||||
<path class="cls-4" d="m875.32 94c0 41.36-33.29 74.65-76.21 74.65h-32.66v68.42h-49.76v-217.68h82.42c42.89 0 76.21 33.28 76.21 74.61zm-49.77 0c0-15.87-11.2-28-26.44-28h-32.66v56h32.66c15.24 0 26.44-12.1 26.44-28z"/>
|
||||
<path class="cls-4" d="m881.54 159.35c0-46.34 36.7-82.11 82.42-82.11s82.43 35.77 82.43 82.11-36.71 82.12-82.43 82.12-82.42-35.77-82.42-82.12zm118.19 0c0-22.08-15.55-36.7-35.77-36.7s-35.77 14.62-35.77 36.7 15.55 36.71 35.77 36.71 35.77-14.62 35.77-36.71z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,30 @@
|
||||
<svg version="1.1" width="77" height="23" viewBox="0 0 77 23" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="linearGradient-1" x1="50.792" x2="73.45" y1="-2.9245" y2="19.734" gradientTransform="scale(1.0009 .9991)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#82BC00" stop-opacity="0" offset="0"/>
|
||||
<stop stop-color="#82BC00" offset="1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g transform="scale(.32857)" fill="none" fill-rule="evenodd">
|
||||
<g transform="translate(-1038,-265)" fill-rule="nonzero">
|
||||
<g transform="translate(960,180)">
|
||||
<g id="Twisto-h-c" transform="translate(78,85)">
|
||||
<g id="Logo">
|
||||
<g id="Group" transform="translate(91.163 11.9)" fill="#4e0f89">
|
||||
<path d="m11.113 27.738v-11.32h5.6646v-5.7754h-5.6646v-7.0459h-7.1675v7.0459h-3.9305v5.7754h3.9305v12.244c0 5.7754 3.3525 8.3165 8.5547 8.3165 1.9653 0 3.6993-0.34652 4.6242-0.80855v-6.3529c-0.80923 0.57754-2.0809 0.92406-3.1213 0.92406-1.7341-0.11551-2.8901-1.0396-2.8901-3.0032z"/>
|
||||
<polygon points="49.031 36.401 56.892 10.643 49.956 10.643 45.332 27.045 40.939 10.643 35.505 10.643 31.228 27.045 26.604 10.643 19.436 10.643 27.297 36.401 33.887 36.401 38.164 20.577 42.441 36.401"/>
|
||||
<polygon points="67.874 36.517 60.707 36.517 60.707 10.643 67.874 10.643"/>
|
||||
<path d="m87.643 21.155-5.3178-1.2706c-1.6185-0.46203-2.3121-1.0396-2.3121-2.0791 0-1.6171 1.7341-2.4257 3.4681-2.4257 2.4277 0 3.5837 1.1551 4.0462 2.5412h6.8207c-0.92484-4.8513-4.5086-7.97-10.982-7.97-5.7802 0-10.289 3.3497-10.289 8.432 0 4.3893 2.7745 6.3529 6.7051 7.277l5.2022 1.1551c1.8497 0.46203 2.6589 1.0396 2.6589 2.1946 0 1.7326-1.5029 2.5412-3.6993 2.5412-2.1965 0-3.8149-1.0396-4.393-2.8877h-7.1675c0.80923 5.3133 5.2022 8.3165 11.56 8.3165 6.0114 0 10.636-3.1187 10.636-8.432 0-3.8117-2.4277-6.3529-6.9363-7.3925z"/>
|
||||
<path d="m108.1 27.738v-11.32h5.6646v-5.7754h-5.6646v-7.0459h-7.1675v7.0459h-3.9306v5.7754h3.9306v12.244c0 5.7754 3.3525 8.3165 8.5547 8.3165 1.9653 0 3.6993-0.34652 4.6242-0.80855v-6.3529c-0.80923 0.57754-2.0809 0.92406-3.1213 0.92406-1.8497-0.11551-2.8901-1.0396-2.8901-3.0032z"/>
|
||||
<path d="m129.53 10.048c-7.5143 0-13.526 6.0064-13.526 13.514 0 7.508 6.0114 13.514 13.526 13.514 7.5143 0 13.526-6.0064 13.526-13.514 0-7.508-6.0114-13.514-13.526-13.514zm0 19.983c-3.5837 0-6.5894-3.0032-6.5894-6.5839s3.0057-6.5839 6.5894-6.5839c3.5837 0 6.5894 3.0032 6.5894 6.5839s-3.0057 6.5839-6.5894 6.5839z"/>
|
||||
<ellipse cx="64.291" cy="3.5974" rx="3.5837" ry="3.5807"/>
|
||||
</g>
|
||||
<polygon points="23.492 23.333 23.492 70 46.984 70 46.984 0 0 0 0 23.333" fill="#4e0f89"/>
|
||||
<path d="m46.984 0c0 12.82 10.414 23.1 23.141 23.1v-23.1z" fill="#009d4e"/>
|
||||
<path d="m46.984 0c0 12.82 10.414 23.1 23.141 23.1v-23.1z" fill="url(#linearGradient-1)"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,32 @@
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
if ($('.form-table input[data-global="can-be-global"]').length) {
|
||||
$('.form-table').addClass('payu-table');
|
||||
$('.form-table .forminp').each(function () {
|
||||
if ($(this).find('input[data-global="can-be-global"]').length) {
|
||||
$(this).addClass('absolute-global');
|
||||
}
|
||||
});
|
||||
test_values_type();
|
||||
}
|
||||
$('input[data-toggle-global]').on('click', function () {
|
||||
test_values_type();
|
||||
});
|
||||
});
|
||||
|
||||
function test_values_type() {
|
||||
if ($('input[data-toggle-global]').prop('checked') == true) {
|
||||
$('input[data-global="can-be-global"]').each(function () {
|
||||
$(this).attr('readonly', true);
|
||||
var global_value = $(this).attr('global-value');
|
||||
$('<span>' + global_value + '</span>').insertAfter($(this));
|
||||
});
|
||||
} else {
|
||||
$('input[data-global="can-be-global"]').each(function () {
|
||||
$(this).attr('readonly', false);
|
||||
$(this).next('span').remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
jQuery('body').on('click', '.payu-list-banks li.payu-active label', function () {
|
||||
jQuery('.payu-list-banks label').removeClass('active');
|
||||
jQuery(this).addClass('active');
|
||||
});
|
||||
|
||||
(function ($) {
|
||||
$('body').on('click', '.payu-list-banks .payu-active', function () {
|
||||
$('.pbl-error').slideUp(250);
|
||||
});
|
||||
|
||||
$('body').on('click', '.payu-conditions-description .payu-read-more', function () {
|
||||
$(this).next('.payu-more-hidden').show();
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$('form#order_review').on('submit', function (e) {
|
||||
var validateResult = validate_payu_checkout('form#order_review', e);
|
||||
|
||||
if (!validateResult) {
|
||||
setTimeout(function () {
|
||||
$('form#order_review').unblock();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
return validateResult;
|
||||
});
|
||||
|
||||
$('form.checkout').on('checkout_place_order', function (e) {
|
||||
return validate_payu_checkout('form.checkout', e);
|
||||
});
|
||||
|
||||
function validate_payu_checkout(form, e) {
|
||||
var $payment_method = $(form).find('input[name="payment_method"]:checked').val();
|
||||
|
||||
if ($payment_method === 'payusecureform') {
|
||||
if ($('#response-tokenize').val() === '') {
|
||||
try {
|
||||
window.payuSdkForms.tokenize()
|
||||
.then(function (result) {
|
||||
$('.payu-sf-validation-error, .payu-sf-technical-error')
|
||||
.html('')
|
||||
.slideUp(250);
|
||||
if (result.status === 'SUCCESS') {
|
||||
$('#response-tokenize').val(result.body.token);
|
||||
$(form).submit();
|
||||
} else {
|
||||
$(result.error.messages).each(function (i, error) {
|
||||
var source = error.source || 'technical';
|
||||
$('.payu-sf-' + error.type + '-error[data-type="' + source + '"]')
|
||||
.html(error.message)
|
||||
.slideDown(250);
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.card-container').offset().top
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if ($payment_method === 'payulistbanks') {
|
||||
if (!$('.payu-list-banks').find('.payu-active .active').length) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.payu-list-banks').offset().top
|
||||
}, 300);
|
||||
$('.pbl-error').slideDown(250);
|
||||
return false;
|
||||
} else {
|
||||
$('.pbl-error').slideUp(250);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,33 @@
|
||||
function sf_init() {
|
||||
var cc = document.getElementById('payu-card-container');
|
||||
if (cc) {
|
||||
var lang = cc.dataset.lang;
|
||||
var optionsForms = {
|
||||
cardIcon: true,
|
||||
style: {
|
||||
basic: {
|
||||
fontSize: '18px'
|
||||
}
|
||||
},
|
||||
placeholder: {
|
||||
number: '',
|
||||
date: 'MM/YY',
|
||||
cvv: ''
|
||||
},
|
||||
lang: lang
|
||||
};
|
||||
var pcn = document.getElementById('payu-card-number');
|
||||
if (pcn.childNodes.length === 0) {
|
||||
var payuSdkForms = PayU(cc.dataset.payuPosid);
|
||||
var secureForms = payuSdkForms.secureForms();
|
||||
var cardNumber = secureForms.add('number', optionsForms);
|
||||
var cardDate = secureForms.add('date', optionsForms);
|
||||
var cardCvv = secureForms.add('cvv', optionsForms);
|
||||
|
||||
cardNumber.render('#payu-card-number');
|
||||
cardDate.render('#payu-card-date');
|
||||
cardCvv.render('#payu-card-cvv');
|
||||
window.payuSdkForms = payuSdkForms;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php $pay_now_url = wc_get_endpoint_url('order-pay', $order->get_id(),
|
||||
wc_get_checkout_url()) . '?pay_for_order=true&key=' . $order->get_order_key(); ?>
|
||||
|
||||
<a href="<?php echo $pay_now_url ?>" class="autonomy-payu-button"><?php echo __('Pay with', 'payu'); ?> <img
|
||||
src="<?php echo plugins_url( '/assets/images/logo-payu.svg', PAYU_PLUGIN_FILE ) ?>"/></a>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class OauthCacheWP implements OauthCacheInterface
|
||||
{
|
||||
public function get($key)
|
||||
{
|
||||
$cache = get_transient($key);
|
||||
return $cache === false ? null : unserialize($cache);
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
return set_transient($key, serialize($value));
|
||||
}
|
||||
|
||||
public function invalidate($key)
|
||||
{
|
||||
return delete_transient($key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
|
||||
class PayUSettings
|
||||
{
|
||||
private $payu_settings_options;
|
||||
private $fields;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->fields = $this->payu_fields();
|
||||
add_action('admin_menu', [$this, 'payu_settings_add_plugin_page']);
|
||||
add_action('admin_init', [$this, 'payu_settings_page_init']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function payu_fields()
|
||||
{
|
||||
return [
|
||||
'pos_id' => [
|
||||
'label' => __('Id point of sales', 'payu'),
|
||||
'description' => __('Pos identifier from "Configuration Keys" section of PayU management panel.',
|
||||
'payu')
|
||||
],
|
||||
'md5' => [
|
||||
'label' => __('Second key (MD5)', 'payu'),
|
||||
'description' => __('Second key from "Configuration Keys" section of PayU management panel.', 'payu')
|
||||
],
|
||||
'client_id' => [
|
||||
'label' => __('OAuth - client_id', 'payu'),
|
||||
'description' => __('Client Id for OAuth identifier from "Configuration Keys" section of PayU management panel.',
|
||||
'payu')
|
||||
],
|
||||
'client_secret' => [
|
||||
'label' => __('OAuth - client_secret', 'payu'),
|
||||
'description' => __('First key from "Configuration Keys" section of PayU management panel.', 'payu'),
|
||||
],
|
||||
'sandbox_pos_id' => [
|
||||
'label' => __('Sandbox - Id point of sales', 'payu'),
|
||||
'description' => __('Pos identifier from "Configuration Keys" section of PayU management panel.',
|
||||
'payu'),
|
||||
],
|
||||
'sandbox_md5' => [
|
||||
'label' => __('Sandbox - Second key (MD5):', 'payu'),
|
||||
'description' => __('Second key from "Configuration Keys" section of PayU management panel.', 'payu'),
|
||||
],
|
||||
'sandbox_client_id' => [
|
||||
'label' => __('Sandbox - OAuth - client_id:', 'payu'),
|
||||
'description' => __('Client Id for OAuth identifier from "Configuration Keys" section of PayU management panel.',
|
||||
'payu'),
|
||||
],
|
||||
'sandbox_client_secret' => [
|
||||
'label' => __('Sandbox - OAuth - client_secret:', 'payu'),
|
||||
'description' => __('First key from "Configuration Keys" section of PayU management panel.', 'payu'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function payu_settings_add_plugin_page()
|
||||
{
|
||||
add_submenu_page(
|
||||
'woocommerce',
|
||||
__('PayU settings', 'payu'), // page_title
|
||||
__('PayU settings', 'payu'), // menu_title
|
||||
'manage_options', // capability
|
||||
'payu-settings', // menu_slug
|
||||
[$this, 'payu_settings_create_admin_page'], // function
|
||||
100
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function payu_settings_create_admin_page()
|
||||
{
|
||||
$this->payu_settings_options = get_option('payu_settings_option_name'); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php echo __('PayU settings', 'payu') ?></h2>
|
||||
<p></p>
|
||||
<?php settings_errors(); ?>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields('payu_settings_option_group');
|
||||
do_settings_sections('payu-settings-admin');
|
||||
submit_button();
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function payu_settings_page_init()
|
||||
{
|
||||
global $woocommerce_wpml;
|
||||
register_setting(
|
||||
'payu_settings_option_group', // option_group
|
||||
'payu_settings_option_name', // option_name
|
||||
[$this, 'payu_settings_sanitize'] // sanitize_callback
|
||||
);
|
||||
|
||||
//global
|
||||
add_settings_section(
|
||||
'payu_settings_setting_section', // id
|
||||
__('PayU config global', 'payu'), // title
|
||||
[], // callback
|
||||
'payu-settings-admin' // page
|
||||
);
|
||||
$currencies = woocommerce_payu_get_currencies();
|
||||
if (count($currencies) < 2) {
|
||||
$currencies = [''];
|
||||
}
|
||||
|
||||
foreach ($currencies as $code) {
|
||||
$idSuffix = ($code ? '_' : '') . $code;
|
||||
$namePrefix = $code . ($code ? ' - ' : '');
|
||||
foreach ($this->fields as $field => $desc) {
|
||||
$args = [
|
||||
'id' => 'global_' . $field . $idSuffix,
|
||||
'desc' => $namePrefix . $desc['label'],
|
||||
'name' => 'payu_settings_option_name'
|
||||
];
|
||||
add_settings_field(
|
||||
$args['id'], // id
|
||||
$args['desc'], // title
|
||||
[$this, 'global_callback'], // callback
|
||||
'payu-settings-admin', // page
|
||||
'payu_settings_setting_section',
|
||||
$args
|
||||
);
|
||||
}
|
||||
}
|
||||
add_settings_field(
|
||||
'global_default_on_hold_status', // id
|
||||
__('Default on-hold status', 'payu'), // title
|
||||
[$this, 'global_default_on_hold_status_callback'], // callback
|
||||
'payu-settings-admin', // page
|
||||
'payu_settings_setting_section' // section
|
||||
);
|
||||
add_settings_field(
|
||||
'global_repayment', // id
|
||||
__('Enable repayment', 'payu'), // title
|
||||
[$this, 'global_repayment_callback'], // callback
|
||||
'payu-settings-admin', // page
|
||||
'payu_settings_setting_section' // section
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @return void
|
||||
*/
|
||||
public function global_callback($args)
|
||||
{
|
||||
$id = $args['id'];
|
||||
$value = isset($this->payu_settings_options[$id]) ? esc_attr($this->payu_settings_options[$id]) : '';
|
||||
printf('<input type="text" class="regular-text" value="%s" name="payu_settings_option_name[%s]" id="%s" />',
|
||||
$value, $id, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @return array
|
||||
*/
|
||||
public function payu_settings_sanitize($input)
|
||||
{
|
||||
$sanitary_values = [];
|
||||
$currencies = woocommerce_payu_get_currencies();
|
||||
if (count($currencies) < 2) {
|
||||
$currencies = [''];
|
||||
}
|
||||
foreach ($currencies as $code) {
|
||||
$idSuffix = ($code ? '_' : '') . $code;
|
||||
foreach ($this->fields as $field => $desc) {
|
||||
$field = $field . $idSuffix;
|
||||
if (isset($input['global_' . $field])) {
|
||||
$sanitary_values['global_' . $field] = sanitize_text_field($input['global_' . $field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($input['global_default_on_hold_status'])) {
|
||||
$sanitary_values['global_default_on_hold_status'] = sanitize_text_field($input['global_default_on_hold_status']);
|
||||
}
|
||||
|
||||
if (isset($input['global_repayment'])) {
|
||||
$sanitary_values['global_repayment'] = sanitize_text_field($input['global_repayment']);
|
||||
}
|
||||
|
||||
return $sanitary_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function global_repayment_callback()
|
||||
{
|
||||
printf(
|
||||
'<input type="checkbox" name="payu_settings_option_name[global_repayment]" id="global_repayment" value="global_repayment" %s>',
|
||||
(isset($this->payu_settings_options['global_repayment']) && $this->payu_settings_options['global_repayment'] === 'global_repayment') ? 'checked' : ''
|
||||
);
|
||||
?>
|
||||
<span class="description payu-red">
|
||||
<span class="dashicons dashicons-warning"></span>
|
||||
<?php echo __('Before enabling repayment, read <a target="_blank" href="https://github.com/PayU-EMEA/plugin_woocommerce#ponawianie-p%C5%82atno%C5%9Bci">the documentation</a> and disable <strong>automatic collection</strong> in POS configuration.', 'payu'); ?>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function global_default_on_hold_status_callback()
|
||||
{
|
||||
?>
|
||||
<select class="regular-text" type="text" name="payu_settings_option_name[global_default_on_hold_status]"
|
||||
id="global_default_on_hold_status">
|
||||
<?php foreach ($this->before_payment_statuses() as $key => $value): ?>
|
||||
<option <?php if (@$this->payu_settings_options['global_default_on_hold_status'] === $key) echo 'selected="selected"' ?>
|
||||
value="<?php echo $key ?>"><?php echo $value ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function before_payment_statuses()
|
||||
{
|
||||
$statuses = wc_get_order_statuses();
|
||||
$available = [];
|
||||
foreach ($statuses as $key => $value) {
|
||||
if (in_array($key, ['wc-pending', 'wc-on-hold'])) {
|
||||
$available[str_replace('wc-', '', $key)] = $value;
|
||||
}
|
||||
}
|
||||
ksort($available);
|
||||
return $available;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_admin()) {
|
||||
$payu_settings = new PayUSettings();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuBlik extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'blik';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payublik');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = true;
|
||||
$this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/blik.svg', PAYU_PLUGIN_FILE ));
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuCreditCard extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'c';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payucreditcard');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = false;
|
||||
$this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/card-visa-mc.svg', PAYU_PLUGIN_FILE ));
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuInstallments extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'ai';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payuinstallments');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuListBanks extends WC_PayUGateways
|
||||
{
|
||||
private $unset_banks = [];
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payulistbanks');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = true;
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function init_form_fields() {
|
||||
parent::payu_init_form_fields(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function try_retrieve_banks()
|
||||
{
|
||||
$response = $this->get_payu_response();
|
||||
if (isset($response) && $response->getStatus() === 'SUCCESS') {
|
||||
$payMethods = $response->getResponse();
|
||||
|
||||
return $payMethods->payByLinks;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
|
||||
$response = $this->get_payu_response();
|
||||
if (isset($response) && $response->getStatus() === 'SUCCESS') {
|
||||
$this->retrieve_methods($response);
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OpenPayU_Result $response
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function retrieve_methods($response)
|
||||
{
|
||||
$payMethods = $response->getResponse();
|
||||
$custom_order = '';
|
||||
if (get_option('woocommerce_' . $this->id . '_settings')['custom_order']) {
|
||||
$custom_order = get_option('woocommerce_' . $this->id . '_settings')['custom_order'];
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
if (!window.ApplePaySession || !window.ApplePaySession.canMakePayments() && jQuery(".payu-list-banks").is(":visible")) {
|
||||
jQuery(".payu-bank-jp").remove();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<div class="pbl-container">
|
||||
<ul class="payu-list-banks">
|
||||
<?php if ($payMethods->payByLinks):
|
||||
$payByLinks = $this->process_pay_methods($payMethods->payByLinks, $custom_order);
|
||||
if ($payByLinks):
|
||||
foreach ($payByLinks as $key => $value):
|
||||
?>
|
||||
<li class="payu-bank payu-bank-<?php echo $key . ' ' . $value['active'] ?>"
|
||||
title="<?php echo $value['name'] ?>">
|
||||
<label>
|
||||
<input type="radio"
|
||||
value="<?php if ($value['active'] === 'payu-active') echo $key ?>"
|
||||
name="selected-bank"/>
|
||||
<div><img src="<?php echo $value['brandImageUrl']; ?>"></div>
|
||||
</label>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
</ul>
|
||||
<ul class="pbl-error woocommerce-error" role="alert">
|
||||
<li><?php echo __('Choose payment method.', 'payu') ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $payMethods
|
||||
* @param string|null $sort
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function process_pay_methods($payMethods, $sort = null)
|
||||
{
|
||||
$result_methods = [];
|
||||
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
|
||||
if ($available_gateways) {
|
||||
foreach ($available_gateways as $available_gateway => $data) {
|
||||
if ($available_gateway === 'payucreditcard' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'c');
|
||||
}
|
||||
if ($available_gateway === 'payusecureform' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'c');
|
||||
}
|
||||
if ($available_gateway === 'payublik' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'blik');
|
||||
}
|
||||
if ($available_gateway === 'payuinstallments' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'ai');
|
||||
}
|
||||
if ($available_gateway === 'payupaypo' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'dpp');
|
||||
}
|
||||
if ($available_gateway === 'payutwistopl' && $data->enabled === 'yes') {
|
||||
array_push($this->unset_banks, 'dpt');
|
||||
}
|
||||
}
|
||||
}
|
||||
$show_inactive = @get_option('woocommerce_' . $this->id . '_settings')['show_inactive_methods'];
|
||||
foreach ($payMethods as $payMethod) {
|
||||
if (!in_array($payMethod->value, $this->unset_banks)) {
|
||||
if ($show_inactive === 'yes' && $payMethod->value != 't') {
|
||||
$show_method = true;
|
||||
if ($payMethod->status !== 'ENABLED') {
|
||||
$show_method = false;
|
||||
} else {
|
||||
if (!$this->check_min_max($payMethod)) {
|
||||
$show_method = false;
|
||||
}
|
||||
}
|
||||
$result_methods[$payMethod->value] = [
|
||||
'brandImageUrl' => $payMethod->brandImageUrl,
|
||||
'name' => $payMethod->name,
|
||||
'active' => $show_method ? 'payu-active' : 'payu-inactive'
|
||||
];
|
||||
} else {
|
||||
if ($payMethod->status === 'ENABLED') {
|
||||
$can_be_use = true;
|
||||
if (!$this->check_min_max($payMethod)) {
|
||||
$can_be_use = false;
|
||||
}
|
||||
if ($can_be_use) {
|
||||
$result_methods[$payMethod->value] = [
|
||||
'brandImageUrl' => $payMethod->brandImageUrl,
|
||||
'name' => $payMethod->name,
|
||||
'active' => 'payu-active'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$sort) {
|
||||
$first_paytypes = ['c','ap','jp','vc'];
|
||||
$last_paytypes = ['b', 'pt', 'bt'];
|
||||
} else {
|
||||
$first_paytypes = explode(',', str_replace(' ', '', $sort));
|
||||
$last_paytypes = [];
|
||||
}
|
||||
|
||||
list($first, $result_methods) = $this->extract_paytypes($result_methods, $first_paytypes);
|
||||
list($last, $result_methods) = $this->extract_paytypes($result_methods, $last_paytypes);
|
||||
|
||||
$result_methods = array_merge($first, $result_methods, $last);
|
||||
|
||||
return $result_methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $result_methods
|
||||
* @param $paytypes
|
||||
* @return array
|
||||
*/
|
||||
private function extract_paytypes($result_methods, $paytypes)
|
||||
{
|
||||
$extracted = [];
|
||||
foreach ($paytypes as $item) {
|
||||
if (@$result_methods[$item]) {
|
||||
$extracted[$item] = [
|
||||
'brandImageUrl' => $result_methods[$item]['brandImageUrl'],
|
||||
'name' => $result_methods[$item]['name'],
|
||||
'active' => $result_methods[$item]['active'],
|
||||
];
|
||||
unset($result_methods[$item]);
|
||||
}
|
||||
}
|
||||
|
||||
return [$extracted, $result_methods];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function get_payu_pay_method()
|
||||
{
|
||||
$selected_method = filter_var($_POST['selected-bank'], FILTER_SANITIZE_STRING);
|
||||
|
||||
return $this->get_payu_pay_method_array('PBL', $selected_method ? $selected_method : -1, $selected_method);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuPaypo extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'dpp';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payupaypo');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = false;
|
||||
$this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/paypo.svg', PAYU_PLUGIN_FILE ));
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuSecureForm extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'c';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payusecureform');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = true;
|
||||
$this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/card-visa-mc.svg', PAYU_PLUGIN_FILE ));
|
||||
|
||||
add_action('wp_enqueue_scripts', [$this, 'include_payu_sf_scripts']);
|
||||
|
||||
//refresh card iframe after checkout change
|
||||
if (!is_admin()) {
|
||||
add_action('wp_footer', [$this, 'minicart_checkout_refresh_script']);
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
function minicart_checkout_refresh_script()
|
||||
{
|
||||
if (is_checkout() || is_wc_endpoint_url()) :
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
(function ($) {
|
||||
$(document.body).on('change', '#shipping_method input', function () {
|
||||
$(document.body).trigger('update_checkout').trigger('wc_fragment_refresh');
|
||||
sf_init();
|
||||
});
|
||||
$(document).ready(function(){
|
||||
if($('form#order_review').length > 0) {
|
||||
sf_init();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
|
||||
$response = $this->get_payu_response();
|
||||
if (isset($response) && $response->getStatus() === 'SUCCESS') {
|
||||
$this->retrieve_methods($response);
|
||||
$this->agreements_field();
|
||||
echo '<script>try{sf_init();}catch(e){}</script>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OpenPayU_Result $response
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
private function retrieve_methods($response)
|
||||
{
|
||||
$payMethods = $response->getResponse();
|
||||
if ($payMethods->payByLinks) {
|
||||
$payByLinks = $this->process_pay_methods($payMethods->payByLinks);
|
||||
if ($payByLinks) {
|
||||
?>
|
||||
<div class="card-container" id="payu-card-container" data-payu-posid="<?php echo $this->pos_id ?>"
|
||||
data-lang="<?php echo explode('_', get_locale())[0] ?>">
|
||||
<div class="payu-sf-technical-error"
|
||||
data-type="technical"><?php echo __('The card could not be sent', 'payu') ?></div>
|
||||
<label for="payu-card-number"><?php echo __('Card number', 'payu') ?></label>
|
||||
<div class="payu-card-form" id="payu-card-number"></div>
|
||||
<div class="payu-sf-validation-error" data-type="number"></div>
|
||||
|
||||
<div class="card-details clearfix">
|
||||
<div class="expiration">
|
||||
<label for="payu-card-date"><?php echo __('Expire date', 'payu') ?></label>
|
||||
<div class="payu-card-form" id="payu-card-date"></div>
|
||||
<div class="payu-sf-validation-error" data-type="date"></div>
|
||||
</div>
|
||||
|
||||
<div class="cvv">
|
||||
<label for="payu-card-cvv"><?php echo __('CVV', 'payu') ?></label>
|
||||
<div class="payu-card-form" id="payu-card-cvv"></div>
|
||||
<div class="payu-sf-validation-error" data-type="cvv"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="response-tokenize" id="response-tokenize"/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function get_payu_pay_method()
|
||||
{
|
||||
$token = filter_var($_POST['response-tokenize'], FILTER_SANITIZE_STRING);
|
||||
|
||||
return $this->get_payu_pay_method_array('CARD_TOKEN', $token ? $token : -1, $this->paytype);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function include_payu_sf_scripts()
|
||||
{
|
||||
$payu_sdk_url = $this->sandbox==='yes'?'https://secure.snd.payu.com/javascript/sdk':'https://secure.payu.com/javascript/sdk';
|
||||
wp_enqueue_script('payu-sfsdk', $payu_sdk_url, [], null);
|
||||
wp_enqueue_script('payu-promise-polyfill', 'https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js', [], null);
|
||||
wp_enqueue_script('payu-sf-init', plugins_url( '/assets/js/sf-init.js', PAYU_PLUGIN_FILE ), [], PAYU_PLUGIN_VERSION,
|
||||
true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuStandard extends WC_PayUGateways
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payustandard');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = false;
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function try_retrieve_banks()
|
||||
{
|
||||
$response = $this->get_payu_response();
|
||||
if (isset($response) && $response->getStatus() === 'SUCCESS') {
|
||||
$payMethods = $response->getResponse();
|
||||
|
||||
return isset($payMethods->payByLinks);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class WC_Gateway_PayuTwistoPl extends WC_PayUGateways
|
||||
{
|
||||
protected $paytype = 'dpt';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('payutwistopl');
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
$this->show_terms_info = false;
|
||||
$this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/twisto-pl.svg', PAYU_PLUGIN_FILE ));
|
||||
|
||||
if (!is_admin()) {
|
||||
if (!$this->try_retrieve_banks()) {
|
||||
add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function payment_fields()
|
||||
{
|
||||
parent::payment_fields();
|
||||
$this->agreements_field();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
order deny,allow
|
||||
deny from all
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
interface AuthType
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class AuthType_Basic implements AuthType
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $authBasicToken;
|
||||
|
||||
public function __construct($posId, $signatureKey)
|
||||
{
|
||||
if (empty($posId)) {
|
||||
throw new OpenPayU_Exception_Configuration('PosId is empty');
|
||||
}
|
||||
|
||||
if (empty($signatureKey)) {
|
||||
throw new OpenPayU_Exception_Configuration('SignatureKey is empty');
|
||||
}
|
||||
|
||||
$this->authBasicToken = base64_encode($posId . ':' . $signatureKey);
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
{
|
||||
return array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Basic ' . $this->authBasicToken
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class AuthType_Oauth implements AuthType
|
||||
{
|
||||
|
||||
/**
|
||||
* @var OauthResultClientCredentials
|
||||
*/
|
||||
private $oauthResult;
|
||||
|
||||
public function __construct($clientId, $clientSecret)
|
||||
{
|
||||
if (empty($clientId)) {
|
||||
throw new OpenPayU_Exception_Configuration('ClientId is empty');
|
||||
}
|
||||
|
||||
if (empty($clientSecret)) {
|
||||
throw new OpenPayU_Exception_Configuration('ClientSecret is empty');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->oauthResult = OpenPayU_Oauth::getAccessToken();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception('Oauth error: [code=' . $e->getCode() . '], [message=' . $e->getMessage() . ']');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getHeaders()
|
||||
{
|
||||
return array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: */*',
|
||||
'Authorization: Bearer ' . $this->oauthResult->getAccessToken()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
class AuthType_TokenRequest implements AuthType
|
||||
{
|
||||
|
||||
public function getHeaders()
|
||||
{
|
||||
return array(
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'Accept: */*'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2017 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
class OpenPayU_Configuration
|
||||
{
|
||||
private static $_availableEnvironment = array('custom', 'secure', 'sandbox');
|
||||
private static $_availableHashAlgorithm = array('SHA', 'SHA-256', 'SHA-384', 'SHA-512');
|
||||
|
||||
private static $env = 'secure';
|
||||
|
||||
/**
|
||||
* Merchant Pos ID for Auth Basic and Notification Consume
|
||||
*/
|
||||
private static $merchantPosId = '';
|
||||
|
||||
/**
|
||||
* Signature Key for Auth Basic and Notification Consume
|
||||
*/
|
||||
private static $signatureKey = '';
|
||||
|
||||
/**
|
||||
* OAuth protocol - default type
|
||||
*/
|
||||
private static $oauthGrantType = OauthGrantType::CLIENT_CREDENTIAL;
|
||||
/**
|
||||
* OAuth protocol - client_id
|
||||
*/
|
||||
private static $oauthClientId = '';
|
||||
|
||||
/**
|
||||
* OAuth protocol - client_secret
|
||||
*/
|
||||
private static $oauthClientSecret = '';
|
||||
|
||||
/**
|
||||
* OAuth protocol - email
|
||||
*/
|
||||
private static $oauthEmail = '';
|
||||
|
||||
/**
|
||||
* OAuth protocol - extCustomerId
|
||||
*/
|
||||
private static $oauthExtCustomerId;
|
||||
|
||||
/**
|
||||
* OAuth protocol - endpoint address
|
||||
*/
|
||||
private static $oauthEndpoint = '';
|
||||
|
||||
/**
|
||||
* OAuth protocol - methods for token cache
|
||||
*/
|
||||
private static $oauthTokenCache = null;
|
||||
|
||||
/**
|
||||
* Proxy - host
|
||||
*/
|
||||
private static $proxyHost = null;
|
||||
|
||||
/**
|
||||
* Proxy - port
|
||||
*/
|
||||
private static $proxyPort = null;
|
||||
|
||||
/**
|
||||
* Proxy - user
|
||||
*/
|
||||
private static $proxyUser = null;
|
||||
|
||||
/**
|
||||
* Proxy - password
|
||||
*/
|
||||
private static $proxyPassword = null;
|
||||
|
||||
private static $serviceUrl = '';
|
||||
private static $hashAlgorithm = 'SHA-256';
|
||||
|
||||
private static $sender = 'Generic';
|
||||
|
||||
const API_VERSION = '2.1';
|
||||
const COMPOSER_JSON = "/composer.json";
|
||||
const DEFAULT_SDK_VERSION = 'PHP SDK 2.3.0';
|
||||
const OAUTH_CONTEXT = 'pl/standard/user/oauth/authorize';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getApiVersion()
|
||||
{
|
||||
return self::API_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function setHashAlgorithm($value)
|
||||
{
|
||||
if (!in_array($value, self::$_availableHashAlgorithm)) {
|
||||
throw new OpenPayU_Exception_Configuration('Hash algorithm "' . $value . '"" is not available');
|
||||
}
|
||||
|
||||
self::$hashAlgorithm = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getHashAlgorithm()
|
||||
{
|
||||
return self::$hashAlgorithm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $environment
|
||||
* @param string $domain
|
||||
* @param string $api
|
||||
* @param string $version
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function setEnvironment($environment = 'secure', $domain = 'payu.com', $api = 'api/', $version = 'v2_1/')
|
||||
{
|
||||
$environment = strtolower($environment);
|
||||
$domain = strtolower($domain) . '/';
|
||||
|
||||
if (!in_array($environment, self::$_availableEnvironment)) {
|
||||
throw new OpenPayU_Exception_Configuration($environment . ' - is not valid environment');
|
||||
}
|
||||
|
||||
self::$env = $environment;
|
||||
|
||||
if ($environment == 'secure') {
|
||||
self::$serviceUrl = 'https://' . $environment . '.' . $domain . $api . $version;
|
||||
self::$oauthEndpoint = 'https://' . $environment . '.' . $domain . self::OAUTH_CONTEXT;
|
||||
} else if ($environment == 'sandbox') {
|
||||
self::$serviceUrl = 'https://secure.snd.' . $domain . $api . $version;
|
||||
self::$oauthEndpoint = 'https://secure.snd.' . $domain . self::OAUTH_CONTEXT;
|
||||
} else if ($environment == 'custom') {
|
||||
self::$serviceUrl = $domain . $api . $version;
|
||||
self::$oauthEndpoint = $domain . self::OAUTH_CONTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getServiceUrl()
|
||||
{
|
||||
return self::$serviceUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOauthEndpoint()
|
||||
{
|
||||
return self::$oauthEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getEnvironment()
|
||||
{
|
||||
return self::$env;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public static function setMerchantPosId($value)
|
||||
{
|
||||
self::$merchantPosId = trim($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getMerchantPosId()
|
||||
{
|
||||
return self::$merchantPosId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public static function setSignatureKey($value)
|
||||
{
|
||||
self::$signatureKey = trim($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getSignatureKey()
|
||||
{
|
||||
return self::$signatureKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOauthGrantType()
|
||||
{
|
||||
return self::$oauthGrantType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oauthGrantType
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function setOauthGrantType($oauthGrantType)
|
||||
{
|
||||
if ($oauthGrantType !== OauthGrantType::CLIENT_CREDENTIAL && $oauthGrantType !== OauthGrantType::TRUSTED_MERCHANT) {
|
||||
throw new OpenPayU_Exception_Configuration('Oauth grand type "' . $oauthGrantType . '"" is not available');
|
||||
}
|
||||
|
||||
self::$oauthGrantType = $oauthGrantType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOauthClientId()
|
||||
{
|
||||
return self::$oauthClientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOauthClientSecret()
|
||||
{
|
||||
return self::$oauthClientSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $oauthClientId
|
||||
*/
|
||||
public static function setOauthClientId($oauthClientId)
|
||||
{
|
||||
self::$oauthClientId = trim($oauthClientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $oauthClientSecret
|
||||
*/
|
||||
public static function setOauthClientSecret($oauthClientSecret)
|
||||
{
|
||||
self::$oauthClientSecret = trim($oauthClientSecret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getOauthEmail()
|
||||
{
|
||||
return self::$oauthEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $oauthEmail
|
||||
*/
|
||||
public static function setOauthEmail($oauthEmail)
|
||||
{
|
||||
self::$oauthEmail = $oauthEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getOauthExtCustomerId()
|
||||
{
|
||||
return self::$oauthExtCustomerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $oauthExtCustomerId
|
||||
*/
|
||||
public static function setOauthExtCustomerId($oauthExtCustomerId)
|
||||
{
|
||||
self::$oauthExtCustomerId = $oauthExtCustomerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null | OauthCacheInterface
|
||||
*/
|
||||
public static function getOauthTokenCache()
|
||||
{
|
||||
return self::$oauthTokenCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OauthCacheInterface $oauthTokenCache
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function setOauthTokenCache($oauthTokenCache)
|
||||
{
|
||||
if (!$oauthTokenCache instanceof OauthCacheInterface) {
|
||||
throw new OpenPayU_Exception_Configuration('Oauth token cache class is not instance of OauthCacheInterface');
|
||||
}
|
||||
self::$oauthTokenCache = $oauthTokenCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string | null
|
||||
*/
|
||||
public static function getProxyHost()
|
||||
{
|
||||
return self::$proxyHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string | null $proxyHost
|
||||
*/
|
||||
public static function setProxyHost($proxyHost)
|
||||
{
|
||||
self::$proxyHost = $proxyHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int | null
|
||||
*/
|
||||
public static function getProxyPort()
|
||||
{
|
||||
return self::$proxyPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int | null $proxyPort
|
||||
*/
|
||||
public static function setProxyPort($proxyPort)
|
||||
{
|
||||
self::$proxyPort = $proxyPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string | null
|
||||
*/
|
||||
public static function getProxyUser()
|
||||
{
|
||||
return self::$proxyUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string | null $proxyUser
|
||||
*/
|
||||
public static function setProxyUser($proxyUser)
|
||||
{
|
||||
self::$proxyUser = $proxyUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string | null
|
||||
*/
|
||||
public static function getProxyPassword()
|
||||
{
|
||||
return self::$proxyPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string | null $proxyPassword
|
||||
*/
|
||||
public static function setProxyPassword($proxyPassword)
|
||||
{
|
||||
self::$proxyPassword = $proxyPassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sender
|
||||
*/
|
||||
public static function setSender($sender)
|
||||
{
|
||||
self::$sender = $sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getSender()
|
||||
{
|
||||
return self::$sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getFullSenderName()
|
||||
{
|
||||
return sprintf("%s@%s", self::getSender(), self::getSdkVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getSdkVersion()
|
||||
{
|
||||
$composerFilePath = self::getComposerFilePath();
|
||||
if (file_exists($composerFilePath)) {
|
||||
$fileContent = file_get_contents($composerFilePath);
|
||||
$composerData = json_decode($fileContent);
|
||||
if (isset($composerData->version) && isset($composerData->extra[0]->engine)) {
|
||||
return sprintf("%s %s", $composerData->extra[0]->engine, $composerData->version);
|
||||
}
|
||||
}
|
||||
|
||||
return self::DEFAULT_SDK_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private static function getComposerFilePath()
|
||||
{
|
||||
return realpath(dirname(__FILE__)) . '/../../' . self::COMPOSER_JSON;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Http
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $pathUrl
|
||||
* @param string $data
|
||||
* @param AuthType $authType
|
||||
* @return mixed
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
* @throws OpenPayU_Exception_Network
|
||||
*/
|
||||
public static function doPost($pathUrl, $data, $authType)
|
||||
{
|
||||
$response = OpenPayU_HttpCurl::doPayuRequest('POST', $pathUrl, $authType, $data);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pathUrl
|
||||
* @param AuthType $authType
|
||||
* @return mixed
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
* @throws OpenPayU_Exception_Network
|
||||
*/
|
||||
public static function doGet($pathUrl, $authType)
|
||||
{
|
||||
$response = OpenPayU_HttpCurl::doPayuRequest('GET', $pathUrl, $authType);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pathUrl
|
||||
* @param AuthType $authType
|
||||
* @return mixed
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
* @throws OpenPayU_Exception_Network
|
||||
*/
|
||||
public static function doDelete($pathUrl, $authType)
|
||||
{
|
||||
$response = OpenPayU_HttpCurl::doPayuRequest('DELETE', $pathUrl, $authType);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pathUrl
|
||||
* @param string $data
|
||||
* @param AuthType $authType
|
||||
* @return mixed
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
* @throws OpenPayU_Exception_Network
|
||||
*/
|
||||
public static function doPut($pathUrl, $data, $authType)
|
||||
{
|
||||
$response = OpenPayU_HttpCurl::doPayuRequest('PUT', $pathUrl, $authType, $data);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $statusCode
|
||||
* @param null $message
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Request
|
||||
* @throws OpenPayU_Exception_Authorization
|
||||
* @throws OpenPayU_Exception_Network
|
||||
* @throws OpenPayU_Exception_ServerMaintenance
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
*/
|
||||
public static function throwHttpStatusException($statusCode, $message = null)
|
||||
{
|
||||
|
||||
$response = $message->getResponse();
|
||||
$statusDesc = isset($response->status->statusDesc) ? $response->status->statusDesc : '';
|
||||
|
||||
switch ($statusCode) {
|
||||
case 400:
|
||||
throw new OpenPayU_Exception_Request($message, $message->getStatus().' - '.$statusDesc, $statusCode);
|
||||
break;
|
||||
|
||||
case 401:
|
||||
case 403:
|
||||
throw new OpenPayU_Exception_Authorization($message->getStatus().' - '.$statusDesc, $statusCode);
|
||||
break;
|
||||
|
||||
case 404:
|
||||
throw new OpenPayU_Exception_Network($message->getStatus().' - '.$statusDesc, $statusCode);
|
||||
break;
|
||||
|
||||
case 408:
|
||||
throw new OpenPayU_Exception_ServerError('Request timeout', $statusCode);
|
||||
break;
|
||||
|
||||
case 500:
|
||||
throw new OpenPayU_Exception_ServerError('PayU system is unavailable or your order is not processed.
|
||||
Error:
|
||||
[' . $statusDesc . ']', $statusCode);
|
||||
break;
|
||||
|
||||
case 503:
|
||||
throw new OpenPayU_Exception_ServerMaintenance('Service unavailable', $statusCode);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new OpenPayU_Exception_Network('Unexpected HTTP code response', $statusCode);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $statusCode
|
||||
* @param ResultError $resultError
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Authorization
|
||||
* @throws OpenPayU_Exception_Network
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
* @throws OpenPayU_Exception_ServerMaintenance
|
||||
*/
|
||||
public static function throwErrorHttpStatusException($statusCode, $resultError)
|
||||
{
|
||||
switch ($statusCode) {
|
||||
case 400:
|
||||
throw new OpenPayU_Exception($resultError->getError().' - '.$resultError->getErrorDescription(), $statusCode);
|
||||
break;
|
||||
|
||||
case 401:
|
||||
case 403:
|
||||
throw new OpenPayU_Exception_Authorization($resultError->getError().' - '.$resultError->getErrorDescription(), $statusCode);
|
||||
break;
|
||||
|
||||
case 404:
|
||||
throw new OpenPayU_Exception_Network($resultError->getError().' - '.$resultError->getErrorDescription(), $statusCode);
|
||||
break;
|
||||
|
||||
case 408:
|
||||
throw new OpenPayU_Exception_ServerError('Request timeout', $statusCode);
|
||||
break;
|
||||
|
||||
case 500:
|
||||
throw new OpenPayU_Exception_ServerError('PayU system is unavailable. Error: [' . $resultError->getErrorDescription() . ']', $statusCode);
|
||||
break;
|
||||
|
||||
case 503:
|
||||
throw new OpenPayU_Exception_ServerMaintenance('Service unavailable', $statusCode);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new OpenPayU_Exception_Network('Unexpected HTTP code response', $statusCode);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_HttpCurl
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
static $headers;
|
||||
|
||||
/**
|
||||
* @param $requestType
|
||||
* @param $pathUrl
|
||||
* @param $data
|
||||
* @param AuthType $auth
|
||||
* @return array
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
* @throws OpenPayU_Exception_Network
|
||||
*/
|
||||
public static function doPayuRequest($requestType, $pathUrl, $auth, $data = null)
|
||||
{
|
||||
if (empty($pathUrl)) {
|
||||
throw new OpenPayU_Exception_Configuration('The endpoint is empty');
|
||||
}
|
||||
|
||||
$ch = curl_init($pathUrl);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $requestType);
|
||||
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $auth->getHeaders());
|
||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'OpenPayU_HttpCurl::readHeader');
|
||||
if ($data) {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
||||
|
||||
if ($proxy = self::getProxy()) {
|
||||
curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
||||
if ($proxyAuth = self::getProxyAuth()) {
|
||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyAuth);
|
||||
}
|
||||
}
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
if($response === false) {
|
||||
throw new OpenPayU_Exception_Network(curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
return array('code' => $httpStatus, 'response' => trim($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getSignature($headers)
|
||||
{
|
||||
foreach($headers as $name => $value)
|
||||
{
|
||||
if(preg_match('/X-OpenPayU-Signature/i', $name) || preg_match('/OpenPayu-Signature/i', $name))
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $ch
|
||||
* @param string $header
|
||||
* @return int
|
||||
*/
|
||||
public static function readHeader($ch, $header)
|
||||
{
|
||||
if( preg_match('/([^:]+): (.+)/m', $header, $match) ) {
|
||||
self::$headers[$match[1]] = trim($match[2]);
|
||||
}
|
||||
|
||||
return strlen($header);
|
||||
}
|
||||
|
||||
private static function getProxy()
|
||||
{
|
||||
return OpenPayU_Configuration::getProxyHost() != null ? OpenPayU_Configuration::getProxyHost()
|
||||
. (OpenPayU_Configuration::getProxyPort() ? ':' . OpenPayU_Configuration::getProxyPort() : '') : false;
|
||||
}
|
||||
|
||||
private static function getProxyAuth()
|
||||
{
|
||||
return OpenPayU_Configuration::getProxyUser() != null ? OpenPayU_Configuration::getProxyUser()
|
||||
. (OpenPayU_Configuration::getProxyPassword() ? ':' . OpenPayU_Configuration::getProxyPassword() : '') : false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class PayuShop
|
||||
{
|
||||
/** @var string */
|
||||
private $shopId;
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var string */
|
||||
private $currencyCode;
|
||||
|
||||
/** @var PayuShopBalance */
|
||||
private $balance;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getShopId()
|
||||
{
|
||||
return $this->shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $shopId
|
||||
* @return PayuShop
|
||||
*/
|
||||
public function setShopId($shopId)
|
||||
{
|
||||
$this->shopId = $shopId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return PayuShop
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrencyCode()
|
||||
{
|
||||
return $this->currencyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $currencyCode
|
||||
* @return PayuShop
|
||||
*/
|
||||
public function setCurrencyCode($currencyCode)
|
||||
{
|
||||
$this->currencyCode = $currencyCode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PayuShopBalance
|
||||
*/
|
||||
public function getBalance()
|
||||
{
|
||||
return $this->balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PayuShopBalance $balance
|
||||
* @return PayuShop
|
||||
*/
|
||||
public function setBalance($balance)
|
||||
{
|
||||
$this->balance = $balance;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'PayuShop [shopId=' . $this->shopId .
|
||||
', name=' . $this->name .
|
||||
', currencyCode=' . $this->currencyCode .
|
||||
', balance=' . $this->balance .
|
||||
']';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class PayuShopBalance
|
||||
{
|
||||
/** @var string */
|
||||
private $currencyCode;
|
||||
|
||||
/** @var int */
|
||||
private $total;
|
||||
|
||||
/** @var int */
|
||||
private $available;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrencyCode()
|
||||
{
|
||||
return $this->currencyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $currencyCode
|
||||
* @return PayuShopBalance
|
||||
*/
|
||||
public function setCurrencyCode($currencyCode)
|
||||
{
|
||||
$this->currencyCode = $currencyCode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTotal()
|
||||
{
|
||||
return $this->total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $total
|
||||
* @return PayuShopBalance
|
||||
*/
|
||||
public function setTotal($total)
|
||||
{
|
||||
$this->total = $total;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAvailable()
|
||||
{
|
||||
return $this->available;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $available
|
||||
* @return PayuShopBalance
|
||||
*/
|
||||
public function setAvailable($available)
|
||||
{
|
||||
$this->available = $available;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return 'PayuShopBalance [currencyCode=' . $this->currencyCode .
|
||||
', total=' . $this->total .
|
||||
', available=' . $this->available .
|
||||
']';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class OauthCacheFile implements OauthCacheInterface
|
||||
{
|
||||
private $directory;
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public function __construct($directory = null)
|
||||
{
|
||||
if ($directory === null) {
|
||||
$directory = dirname(__FILE__).'/../../../Cache';
|
||||
}
|
||||
|
||||
if (!is_dir($directory) || !is_writable($directory)) {
|
||||
throw new OpenPayU_Exception_Configuration('Cache directory [' . $directory . '] not exist or not writable.');
|
||||
}
|
||||
|
||||
$this->directory = $directory . (substr($directory, -1) != '/' ? '/' : '');
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
$cache = @file_get_contents($this->directory . md5($key));
|
||||
return $cache === false ? null : unserialize($cache);
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
return @file_put_contents($this->directory . md5($key), serialize($value));
|
||||
}
|
||||
|
||||
public function invalidate($key)
|
||||
{
|
||||
return @unlink($this->directory . md5($key));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
interface OauthCacheInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return null | object
|
||||
*/
|
||||
public function get($key);
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param object $value
|
||||
* @return bool
|
||||
*/
|
||||
public function set($key, $value);
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function invalidate($key);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class OauthCacheMemcached implements OauthCacheInterface
|
||||
{
|
||||
private $memcached;
|
||||
|
||||
/**
|
||||
* @param string $host
|
||||
* @param int $port
|
||||
* @param int $weight
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public function __construct($host = 'localhost', $port = 11211, $weight = 0)
|
||||
{
|
||||
if (!class_exists('Memcached')) {
|
||||
throw new OpenPayU_Exception_Configuration('PHP Memcached extension not installed.');
|
||||
}
|
||||
|
||||
$this->memcached = new Memcached('PayU');
|
||||
$this->memcached->addServer($host, $port, $weight);
|
||||
$stats = $this->memcached->getStats();
|
||||
if ($stats[$host . ':' . $port]['pid'] == -1) {
|
||||
throw new OpenPayU_Exception_Configuration('Problem with connection to memcached server [host=' . $host . '] [port=' . $port . '] [weight=' . $weight . ']');
|
||||
}
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
$cache = $this->memcached->get($key);
|
||||
return $cache === false ? null : unserialize($cache);
|
||||
}
|
||||
|
||||
public function set($key, $value)
|
||||
{
|
||||
return $this->memcached->set($key, serialize($value));
|
||||
}
|
||||
|
||||
public function invalidate($key)
|
||||
{
|
||||
return $this->memcached->delete($key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
class OpenPayU_Oauth
|
||||
{
|
||||
/**
|
||||
* @var OauthCacheInterface
|
||||
*/
|
||||
private static $oauthTokenCache;
|
||||
|
||||
const CACHE_KEY = 'AccessToken';
|
||||
|
||||
/**
|
||||
* @param string $clientId
|
||||
* @param string $clientSecret
|
||||
* @return OauthResultClientCredentials
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
*/
|
||||
public static function getAccessToken($clientId = null, $clientSecret = null)
|
||||
{
|
||||
if (OpenPayU_Configuration::getOauthGrantType() === OauthGrantType::TRUSTED_MERCHANT) {
|
||||
return self::retrieveAccessToken($clientId, $clientSecret);
|
||||
}
|
||||
|
||||
$cacheKey = self::CACHE_KEY . OpenPayU_Configuration::getOauthClientId();
|
||||
|
||||
self::getOauthTokenCache();
|
||||
|
||||
$tokenCache = self::$oauthTokenCache->get($cacheKey);
|
||||
|
||||
if ($tokenCache instanceof OauthResultClientCredentials && !$tokenCache->hasExpire()) {
|
||||
return $tokenCache;
|
||||
}
|
||||
|
||||
self::$oauthTokenCache->invalidate($cacheKey);
|
||||
$response = self::retrieveAccessToken($clientId, $clientSecret);
|
||||
self::$oauthTokenCache->set($cacheKey, $response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $clientId
|
||||
* @param $clientSecret
|
||||
* @return OauthResultClientCredentials
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
*/
|
||||
private static function retrieveAccessToken($clientId, $clientSecret)
|
||||
{
|
||||
$authType = new AuthType_TokenRequest();
|
||||
|
||||
$oauthUrl = OpenPayU_Configuration::getOauthEndpoint();
|
||||
$data = array(
|
||||
'grant_type' => OpenPayU_Configuration::getOauthGrantType(),
|
||||
'client_id' => $clientId ? $clientId : OpenPayU_Configuration::getOauthClientId(),
|
||||
'client_secret' => $clientSecret ? $clientSecret : OpenPayU_Configuration::getOauthClientSecret()
|
||||
);
|
||||
|
||||
if (OpenPayU_Configuration::getOauthGrantType() === OauthGrantType::TRUSTED_MERCHANT) {
|
||||
$data['email'] = OpenPayU_Configuration::getOauthEmail();
|
||||
$data['ext_customer_id'] = OpenPayU_Configuration::getOauthExtCustomerId();
|
||||
}
|
||||
|
||||
return self::parseResponse(OpenPayU_Http::doPost($oauthUrl, http_build_query($data, '', '&'), $authType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse response from PayU
|
||||
*
|
||||
* @param array $response
|
||||
* @return OauthResultClientCredentials
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Authorization
|
||||
* @throws OpenPayU_Exception_Network
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
* @throws OpenPayU_Exception_ServerMaintenance
|
||||
*/
|
||||
private static function parseResponse($response)
|
||||
{
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
if ($httpStatus == 500) {
|
||||
$result = new ResultError();
|
||||
$result->setErrorDescription($response['response']);
|
||||
OpenPayU_Http::throwErrorHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
|
||||
$message = OpenPayU_Util::convertJsonToArray($response['response'], true);
|
||||
|
||||
if (json_last_error() == JSON_ERROR_SYNTAX) {
|
||||
throw new OpenPayU_Exception_ServerError('Incorrect json response. Response: [' . $response['response'] . ']');
|
||||
}
|
||||
|
||||
if ($httpStatus == 200) {
|
||||
$result = new OauthResultClientCredentials();
|
||||
$result->setAccessToken($message['access_token'])
|
||||
->setTokenType($message['token_type'])
|
||||
->setExpiresIn($message['expires_in'])
|
||||
->setGrantType($message['grant_type'])
|
||||
->calculateExpireDate(new \DateTime());
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = new ResultError();
|
||||
$result->setError($message['error'])
|
||||
->setErrorDescription($message['error_description']);
|
||||
|
||||
OpenPayU_Http::throwErrorHttpStatusException($httpStatus, $result);
|
||||
|
||||
}
|
||||
|
||||
private static function getOauthTokenCache()
|
||||
{
|
||||
$oauthTokenCache = OpenPayU_Configuration::getOauthTokenCache();
|
||||
|
||||
if (!$oauthTokenCache instanceof OauthCacheInterface) {
|
||||
$oauthTokenCache = new OauthCacheFile();
|
||||
OpenPayU_Configuration::setOauthTokenCache($oauthTokenCache);
|
||||
}
|
||||
|
||||
self::$oauthTokenCache = $oauthTokenCache;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
abstract class OauthGrantType
|
||||
{
|
||||
const CLIENT_CREDENTIAL = 'client_credentials';
|
||||
const TRUSTED_MERCHANT = 'trusted_merchant';
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
class OauthResultClientCredentials
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $accessToken;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $tokenType;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $expiresIn;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $grantType;
|
||||
|
||||
/**
|
||||
* @var DateTime
|
||||
*/
|
||||
private $expireDate;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
return $this->accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accessToken
|
||||
* @return OauthResultClientCredentials
|
||||
*/
|
||||
public function setAccessToken($accessToken)
|
||||
{
|
||||
$this->accessToken = $accessToken;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTokenType()
|
||||
{
|
||||
return $this->tokenType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tokenType
|
||||
* @return OauthResultClientCredentials
|
||||
*/
|
||||
public function setTokenType($tokenType)
|
||||
{
|
||||
$this->tokenType = $tokenType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExpiresIn()
|
||||
{
|
||||
return $this->expiresIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $expiresIn
|
||||
* @return OauthResultClientCredentials
|
||||
*/
|
||||
public function setExpiresIn($expiresIn)
|
||||
{
|
||||
$this->expiresIn = $expiresIn;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getGrantType()
|
||||
{
|
||||
return $this->grantType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $grantType
|
||||
* @return OauthResultClientCredentials
|
||||
*/
|
||||
public function setGrantType($grantType)
|
||||
{
|
||||
$this->grantType = $grantType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DateTime
|
||||
*/
|
||||
public function getExpireDate()
|
||||
{
|
||||
return $this->expireDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DateTime $date
|
||||
*/
|
||||
public function calculateExpireDate($date)
|
||||
{
|
||||
$this->expireDate = $date->add(new DateInterval('PT' . ($this->expiresIn - 60) . 'S'));
|
||||
}
|
||||
|
||||
public function hasExpire()
|
||||
{
|
||||
return ($this->expireDate <= new DateTime());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU
|
||||
{
|
||||
protected static function build($data)
|
||||
{
|
||||
$instance = new OpenPayU_Result();
|
||||
|
||||
if (array_key_exists('status', $data) && $data['status'] == 'WARNING_CONTINUE_REDIRECT') {
|
||||
$data['status'] = 'SUCCESS';
|
||||
$data['response']['status']['statusCode'] = 'SUCCESS';
|
||||
}
|
||||
|
||||
$instance->init($data);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $incomingSignature
|
||||
* @throws OpenPayU_Exception_Authorization
|
||||
*/
|
||||
public static function verifyDocumentSignature($data, $incomingSignature)
|
||||
{
|
||||
$sign = OpenPayU_Util::parseSignature($incomingSignature);
|
||||
|
||||
if ($sign === null || !array_key_exists('signature', $sign) || !array_key_exists('algorithm', $sign)) {
|
||||
throw new OpenPayU_Exception_Authorization('Signature not found');
|
||||
}
|
||||
|
||||
if (false === OpenPayU_Util::verifySignature(
|
||||
$data,
|
||||
$sign['signature'],
|
||||
OpenPayU_Configuration::getSignatureKey(),
|
||||
$sign['algorithm'])
|
||||
) {
|
||||
throw new OpenPayU_Exception_Authorization('Invalid signature - ' . $sign['signature']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AuthType
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
protected static function getAuth()
|
||||
{
|
||||
if (OpenPayU_Configuration::getOauthClientId() && OpenPayU_Configuration::getOauthClientSecret()) {
|
||||
$authType = new AuthType_Oauth(OpenPayU_Configuration::getOauthClientId(), OpenPayU_Configuration::getOauthClientSecret());
|
||||
} else {
|
||||
$authType = new AuthType_Basic(OpenPayU_Configuration::getMerchantPosId(), OpenPayU_Configuration::getSignatureKey());
|
||||
}
|
||||
|
||||
return $authType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_Request extends OpenPayU_Exception
|
||||
{
|
||||
/** @var stdClass|null */
|
||||
private $originalResponseMessage;
|
||||
|
||||
public function __construct($originalResponseMessage, $message = "", $code = 0, $previous = null)
|
||||
{
|
||||
$this->originalResponseMessage = $originalResponseMessage;
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
/** @return null|stdClass */
|
||||
public function getOriginalResponse()
|
||||
{
|
||||
return $this->originalResponseMessage;
|
||||
}
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_Configuration extends OpenPayU_Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_Network extends OpenPayU_Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_ServerError extends OpenPayU_Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_ServerMaintenance extends OpenPayU_Exception
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OpenPayU_Exception_Authorization extends OpenPayU_Exception
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class OpenPayuOrderStatus
|
||||
*/
|
||||
abstract class OpenPayuOrderStatus
|
||||
{
|
||||
const STATUS_NEW = 'NEW';
|
||||
const STATUS_PENDING = 'PENDING';
|
||||
const STATUS_CANCELED = 'CANCELED';
|
||||
const STATUS_REJECTED = 'REJECTED';
|
||||
const STATUS_COMPLETED = 'COMPLETED';
|
||||
const STATUS_WAITING_FOR_CONFIRMATION = 'WAITING_FOR_CONFIRMATION';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Result
|
||||
{
|
||||
private $status = '';
|
||||
private $error = '';
|
||||
private $success = 0;
|
||||
private $request = '';
|
||||
/** @var object */
|
||||
private $response;
|
||||
private $sessionId = '';
|
||||
private $message = '';
|
||||
private $countryCode = '';
|
||||
private $reqId = '';
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setStatus($value)
|
||||
{
|
||||
$this->status = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setError($value)
|
||||
{
|
||||
$this->error = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getSuccess()
|
||||
{
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setSuccess($value)
|
||||
{
|
||||
$this->success = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setRequest($value)
|
||||
{
|
||||
$this->request = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setResponse($value)
|
||||
{
|
||||
$this->response = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getSessionId()
|
||||
{
|
||||
return $this->sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setSessionId($value)
|
||||
{
|
||||
$this->sessionId = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setMessage($value)
|
||||
{
|
||||
$this->message = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getCountryCode()
|
||||
{
|
||||
return $this->countryCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setCountryCode($value)
|
||||
{
|
||||
$this->countryCode = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getReqId()
|
||||
{
|
||||
return $this->reqId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @access public
|
||||
* @param $value
|
||||
*/
|
||||
public function setReqId($value)
|
||||
{
|
||||
$this->reqId = $value;
|
||||
}
|
||||
|
||||
public function init($attributes)
|
||||
{
|
||||
$attributes = OpenPayU_Util::parseArrayToObject($attributes);
|
||||
|
||||
if (!empty($attributes)) {
|
||||
foreach ($attributes as $name => $value) {
|
||||
$this->set($name, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function set($name, $value)
|
||||
{
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if (isset($this->{$name}))
|
||||
return $this->name;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function __call($methodName, $args) {
|
||||
if (preg_match('~^(set|get)([A-Z])(.*)$~', $methodName, $matches)) {
|
||||
$property = strtolower($matches[2]) . $matches[3];
|
||||
if (!property_exists($this, $property)) {
|
||||
throw new Exception('Property ' . $property . ' not exists');
|
||||
}
|
||||
switch($matches[1]) {
|
||||
case 'get':
|
||||
$this->checkArguments($args, 0, 0, $methodName);
|
||||
return $this->get($property);
|
||||
case 'default':
|
||||
throw new Exception('Method ' . $methodName . ' not exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class ResultError
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $errorDescription;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $error
|
||||
* @return ResultError
|
||||
*/
|
||||
public function setError($error)
|
||||
{
|
||||
$this->error = $error;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorDescription()
|
||||
{
|
||||
return $this->errorDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $errorDescription
|
||||
* @return ResultError
|
||||
*/
|
||||
public function setErrorDescription($errorDescription)
|
||||
{
|
||||
$this->errorDescription = $errorDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
class OpenPayU_Util
|
||||
{
|
||||
/**
|
||||
* Function generate sign data
|
||||
*
|
||||
* @param array $data
|
||||
* @param string $algorithm
|
||||
* @param string $merchantPosId
|
||||
* @param string $signatureKey
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function generateSignData(array $data, $algorithm = 'SHA-256', $merchantPosId = '', $signatureKey = '')
|
||||
{
|
||||
if (empty($signatureKey))
|
||||
throw new OpenPayU_Exception_Configuration('Merchant Signature Key should not be null or empty.');
|
||||
|
||||
if (empty($merchantPosId))
|
||||
throw new OpenPayU_Exception_Configuration('MerchantPosId should not be null or empty.');
|
||||
|
||||
$contentForSign = '';
|
||||
ksort($data);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$contentForSign .= $key . '=' . urlencode($value) . '&';
|
||||
}
|
||||
|
||||
if (in_array($algorithm, array('SHA-256', 'SHA'))) {
|
||||
$hashAlgorithm = 'sha256';
|
||||
$algorithm = 'SHA-256';
|
||||
} else if ($algorithm == 'SHA-384') {
|
||||
$hashAlgorithm = 'sha384';
|
||||
$algorithm = 'SHA-384';
|
||||
} else if ($algorithm == 'SHA-512') {
|
||||
$hashAlgorithm = 'sha512';
|
||||
$algorithm = 'SHA-512';
|
||||
}
|
||||
|
||||
$signature = hash($hashAlgorithm, $contentForSign . $signatureKey);
|
||||
|
||||
$signData = 'sender=' . $merchantPosId . ';algorithm=' . $algorithm . ';signature=' . $signature;
|
||||
|
||||
return $signData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function returns signature data object
|
||||
*
|
||||
* @param string $data
|
||||
*
|
||||
* @return null|array
|
||||
*/
|
||||
public static function parseSignature($data)
|
||||
{
|
||||
if (empty($data)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$signatureData = array();
|
||||
|
||||
$list = explode(';', rtrim($data, ';'));
|
||||
if (empty($list)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ($list as $value) {
|
||||
$explode = explode('=', $value);
|
||||
if (count($explode) != 2) {
|
||||
return null;
|
||||
}
|
||||
$signatureData[$explode[0]] = $explode[1];
|
||||
}
|
||||
|
||||
return $signatureData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function returns signature validate
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $signature
|
||||
* @param string $signatureKey
|
||||
* @param string $algorithm
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function verifySignature($message, $signature, $signatureKey, $algorithm = 'MD5')
|
||||
{
|
||||
if (isset($signature)) {
|
||||
if ($algorithm === 'MD5') {
|
||||
$hash = md5($message . $signatureKey);
|
||||
} else if (in_array($algorithm, array('SHA', 'SHA1', 'SHA-1'))) {
|
||||
$hash = sha1($message . $signatureKey);
|
||||
} else {
|
||||
$hash = hash('sha256', $message . $signatureKey);
|
||||
}
|
||||
|
||||
if (strcmp($signature, $hash) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function builds OpenPayU Json Document
|
||||
*
|
||||
* @param array $data
|
||||
* @param string $rootElement
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public static function buildJsonFromArray($data, $rootElement = '')
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!empty($rootElement)) {
|
||||
$data = array($rootElement => $data);
|
||||
}
|
||||
|
||||
$data = self::setSenderProperty($data);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @param bool $assoc
|
||||
* @return mixed|null
|
||||
*/
|
||||
public static function convertJsonToArray($data, $assoc = false)
|
||||
{
|
||||
if (empty($data)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($data, $assoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @return bool|stdClass
|
||||
*/
|
||||
public static function parseArrayToObject($array)
|
||||
{
|
||||
if (!is_array($array)) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
if (self::isAssocArray($array)) {
|
||||
$object = new stdClass();
|
||||
} else {
|
||||
$object = array();
|
||||
}
|
||||
|
||||
if (is_array($array) && count($array) > 0) {
|
||||
foreach ($array as $name => $value) {
|
||||
$name = trim($name);
|
||||
if (isset($name)) {
|
||||
if (is_numeric($name)) {
|
||||
$object[] = self::parseArrayToObject($value);
|
||||
} else {
|
||||
$object->$name = self::parseArrayToObject($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getRequestHeaders()
|
||||
{
|
||||
if (!function_exists('apache_request_headers')) {
|
||||
$headers = array();
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (substr($key, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))))] = $value;
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
} else {
|
||||
return apache_request_headers();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $array
|
||||
* @param string $namespace
|
||||
* @param array $outputFields
|
||||
* @return string
|
||||
*/
|
||||
public static function convertArrayToHtmlForm($array, $namespace = '', &$outputFields = [])
|
||||
{
|
||||
$i = 0;
|
||||
$htmlOutput = "";
|
||||
$assoc = self::isAssocArray($array);
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
|
||||
if ($namespace && $assoc) {
|
||||
$key = $namespace . '.' . $key;
|
||||
} elseif ($namespace && !$assoc) {
|
||||
$key = $namespace . '[' . $i++ . ']';
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
$htmlOutput .= self::convertArrayToHtmlForm($value, $key, $outputFields);
|
||||
} else {
|
||||
$htmlOutput .= sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />\n", $key, htmlspecialchars($value));
|
||||
$outputFields[$key] = $value;
|
||||
}
|
||||
}
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $arr
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAssocArray($arr)
|
||||
{
|
||||
$arrKeys = array_keys($arr);
|
||||
sort($arrKeys, SORT_NUMERIC);
|
||||
return $arrKeys !== range(0, count($arr) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
private static function setSenderProperty($data)
|
||||
{
|
||||
$data['properties'][0] = array(
|
||||
'name' => 'sender',
|
||||
'value' => OpenPayU_Configuration::getFullSenderName()
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function statusDesc($response)
|
||||
{
|
||||
|
||||
$msg = '';
|
||||
|
||||
switch ($response) {
|
||||
case 'SUCCESS':
|
||||
$msg = 'Request has been processed correctly.';
|
||||
break;
|
||||
case 'DATA_NOT_FOUND':
|
||||
$msg = 'Data indicated in the request is not available in the PayU system.';
|
||||
break;
|
||||
case 'WARNING_CONTINUE_3_DS':
|
||||
$msg = '3DS authorization required.Redirect the Buyer to PayU to continue the 3DS process by calling OpenPayU.authorize3DS().';
|
||||
break;
|
||||
case 'WARNING_CONTINUE_CVV':
|
||||
$msg = 'CVV/CVC authorization required. Call OpenPayU.authorizeCVV() method.';
|
||||
break;
|
||||
case 'ERROR_SYNTAX':
|
||||
$msg = 'BIncorrect request syntax. Supported formats are JSON or XML.';
|
||||
break;
|
||||
case 'ERROR_VALUE_INVALID':
|
||||
$msg = 'One or more required values are incorrect.';
|
||||
break;
|
||||
case 'ERROR_VALUE_MISSING':
|
||||
$msg = 'One or more required values are missing.';
|
||||
break;
|
||||
case 'BUSINESS_ERROR':
|
||||
$msg = 'PayU system is unavailable. Try again later.';
|
||||
break;
|
||||
case 'ERROR_INTERNAL':
|
||||
$msg = 'PayU system is unavailable. Try again later.';
|
||||
break;
|
||||
case 'GENERAL_ERROR':
|
||||
$msg = 'Unexpected error. Try again later.';
|
||||
break;
|
||||
}
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2018 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class OpenPayU_Order
|
||||
*/
|
||||
class OpenPayU_Order extends OpenPayU
|
||||
{
|
||||
const ORDER_SERVICE = 'orders/';
|
||||
const ORDER_TRANSACTION_SERVICE = 'transactions';
|
||||
const SUCCESS = 'SUCCESS';
|
||||
|
||||
/**
|
||||
* @var array Default form parameters
|
||||
*/
|
||||
protected static $defaultFormParams = array(
|
||||
'formClass' => '',
|
||||
'formId' => 'payu-payment-form',
|
||||
'submitClass' => '',
|
||||
'submitId' => '',
|
||||
'submitContent' => '',
|
||||
'submitTarget' => '_blank'
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates new Order
|
||||
* - Sends to PayU OrderCreateRequest
|
||||
*
|
||||
* @param array $order A array containing full Order
|
||||
* @return object $result Response array with OrderCreateResponse
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function create($order)
|
||||
{
|
||||
$data = OpenPayU_Util::buildJsonFromArray($order);
|
||||
|
||||
if (empty($data)) {
|
||||
throw new OpenPayU_Exception('Empty message OrderCreateRequest');
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE;
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'OrderCreateResponse');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves information about the order
|
||||
* - Sends to PayU OrderRetrieveRequest
|
||||
*
|
||||
* @param string $orderId PayU OrderId sent back in OrderCreateResponse
|
||||
* @return OpenPayU_Result $result Response array with OrderRetrieveResponse
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function retrieve($orderId)
|
||||
{
|
||||
if (empty($orderId)) {
|
||||
throw new OpenPayU_Exception('Empty value of orderId');
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE . $orderId;
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doGet($pathUrl, $authType), 'OrderRetrieveResponse');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves information about the order transaction
|
||||
* - Sends to PayU TransactionRetrieveRequest
|
||||
*
|
||||
* @param string $orderId PayU OrderId sent back in OrderCreateResponse
|
||||
* @return OpenPayU_Result $result Response array with TransactionRetrieveResponse
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function retrieveTransaction($orderId)
|
||||
{
|
||||
if (empty($orderId)) {
|
||||
throw new OpenPayU_Exception('Empty value of orderId');
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE . $orderId . '/' . self::ORDER_TRANSACTION_SERVICE;
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doGet($pathUrl, $authType), 'TransactionRetrieveResponse');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels Order
|
||||
* - Sends to PayU OrderCancelRequest
|
||||
*
|
||||
* @param string $orderId PayU OrderId sent back in OrderCreateResponse
|
||||
* @return OpenPayU_Result $result Response array with OrderCancelResponse
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function cancel($orderId)
|
||||
{
|
||||
if (empty($orderId)) {
|
||||
throw new OpenPayU_Exception('Empty value of orderId');
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE . $orderId;
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doDelete($pathUrl, $authType), 'OrderCancelResponse');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates Order status
|
||||
* - Sends to PayU OrderStatusUpdateRequest
|
||||
*
|
||||
* @param array $orderStatusUpdate A array containing full OrderStatus
|
||||
* @return OpenPayU_Result $result Response array with OrderStatusUpdateResponse
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function statusUpdate($orderStatusUpdate)
|
||||
{
|
||||
if (empty($orderStatusUpdate)) {
|
||||
throw new OpenPayU_Exception('Empty order status data');
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$data = OpenPayU_Util::buildJsonFromArray($orderStatusUpdate);
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::ORDER_SERVICE . $orderStatusUpdate['orderId'] . '/status';
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doPut($pathUrl, $data, $authType), 'OrderStatusUpdateResponse');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume notification message
|
||||
*
|
||||
* @access public
|
||||
* @param $data string Request array received from with PayU OrderNotifyRequest
|
||||
* @return null|OpenPayU_Result Response array with OrderNotifyRequest
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function consumeNotification($data)
|
||||
{
|
||||
if (empty($data)) {
|
||||
throw new OpenPayU_Exception('Empty value of data');
|
||||
}
|
||||
|
||||
$headers = OpenPayU_Util::getRequestHeaders();
|
||||
$incomingSignature = OpenPayU_HttpCurl::getSignature($headers);
|
||||
|
||||
self::verifyDocumentSignature($data, $incomingSignature);
|
||||
|
||||
return OpenPayU_Order::verifyResponse(array('response' => $data, 'code' => 200), 'OrderNotifyRequest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify response from PayU
|
||||
*
|
||||
* @param array $response
|
||||
* @param string $messageName
|
||||
* @return null|OpenPayU_Result
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Authorization
|
||||
* @throws OpenPayU_Exception_Network
|
||||
* @throws OpenPayU_Exception_ServerError
|
||||
* @throws OpenPayU_Exception_ServerMaintenance
|
||||
*/
|
||||
public static function verifyResponse($response, $messageName)
|
||||
{
|
||||
$data = array();
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
$message = OpenPayU_Util::convertJsonToArray($response['response'], true);
|
||||
|
||||
$data['status'] = isset($message['status']['statusCode']) ? $message['status']['statusCode'] : null;
|
||||
|
||||
if (json_last_error() == JSON_ERROR_SYNTAX) {
|
||||
$data['response'] = $response['response'];
|
||||
} elseif (isset($message[$messageName])) {
|
||||
unset($message[$messageName]['Status']);
|
||||
$data['response'] = $message[$messageName];
|
||||
} elseif (isset($message)) {
|
||||
$data['response'] = $message;
|
||||
unset($message['status']);
|
||||
}
|
||||
|
||||
$result = self::build($data);
|
||||
|
||||
if ($httpStatus == 200 || $httpStatus == 201 || $httpStatus == 422 || $httpStatus == 301 || $httpStatus == 302) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
OpenPayU_Http::throwHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a form body for hosted order
|
||||
*
|
||||
* @access public
|
||||
* @param array $order an array containing full Order
|
||||
* @param array $params an optional array with form elements' params
|
||||
* @return string Response html form
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function hostedOrderForm($order, $params = array())
|
||||
{
|
||||
$orderFormUrl = OpenPayU_Configuration::getServiceUrl() . 'orders';
|
||||
|
||||
$formFieldValuesAsArray = array();
|
||||
$htmlFormFields = OpenPayU_Util::convertArrayToHtmlForm($order, '', $formFieldValuesAsArray);
|
||||
|
||||
$signature = OpenPayU_Util::generateSignData(
|
||||
$formFieldValuesAsArray,
|
||||
OpenPayU_Configuration::getHashAlgorithm(),
|
||||
OpenPayU_Configuration::getMerchantPosId(),
|
||||
OpenPayU_Configuration::getSignatureKey()
|
||||
);
|
||||
|
||||
$formParams = array_merge(self::$defaultFormParams, $params);
|
||||
|
||||
$htmlOutput = sprintf("<form method=\"POST\" action=\"%s\" id=\"%s\" class=\"%s\">\n", $orderFormUrl, $formParams['formId'], $formParams['formClass']);
|
||||
$htmlOutput .= $htmlFormFields;
|
||||
$htmlOutput .= sprintf("<input type=\"hidden\" name=\"OpenPayu-Signature\" value=\"%s\" />", $signature);
|
||||
$htmlOutput .= sprintf("<button type=\"submit\" formtarget=\"%s\" id=\"%s\" class=\"%s\">%s</button>", $formParams['submitTarget'], $formParams['submitId'], $formParams['submitClass'], $formParams['submitContent']);
|
||||
$htmlOutput .= "</form>\n";
|
||||
|
||||
return $htmlOutput;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Refund extends OpenPayU
|
||||
{
|
||||
/**
|
||||
* Function make refund for order
|
||||
* @param $orderId
|
||||
* @param $description
|
||||
* @param null|int $amount Amount of refund in pennies
|
||||
* @param null|string $extCustomerId Marketplace external customer ID
|
||||
* @param null|string $extRefundId Marketplace external refund ID
|
||||
* @return null|OpenPayU_Result
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function create($orderId, $description, $amount = null, $extCustomerId = null, $extRefundId = null)
|
||||
{
|
||||
if (empty($orderId)) {
|
||||
throw new OpenPayU_Exception('Invalid orderId value for refund');
|
||||
}
|
||||
|
||||
if (empty($description)) {
|
||||
throw new OpenPayU_Exception('Invalid description of refund');
|
||||
}
|
||||
$refund = array(
|
||||
'orderId' => $orderId,
|
||||
'refund' => array('description' => $description)
|
||||
);
|
||||
|
||||
if (!empty($amount)) {
|
||||
$refund['refund']['amount'] = (int) $amount;
|
||||
}
|
||||
|
||||
if (!empty($extCustomerId)) {
|
||||
$refund['refund']['extCustomerId'] = $extCustomerId;
|
||||
}
|
||||
|
||||
if (!empty($extRefundId)) {
|
||||
$refund['refund']['extRefundId'] = $extRefundId;
|
||||
}
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl().'orders/'. $refund['orderId'] . '/refund';
|
||||
|
||||
$data = OpenPayU_Util::buildJsonFromArray($refund);
|
||||
|
||||
$result = self::verifyResponse(OpenPayU_Http::doPost($pathUrl, $data, $authType), 'RefundCreateResponse');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $response
|
||||
* @param string $messageName
|
||||
* @return OpenPayU_Result
|
||||
*/
|
||||
public static function verifyResponse($response, $messageName='')
|
||||
{
|
||||
$data = array();
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
$message = OpenPayU_Util::convertJsonToArray($response['response'], true);
|
||||
|
||||
$data['status'] = isset($message['status']['statusCode']) ? $message['status']['statusCode'] : null;
|
||||
|
||||
if (json_last_error() == JSON_ERROR_SYNTAX) {
|
||||
$data['response'] = $response['response'];
|
||||
} elseif (isset($message[$messageName])) {
|
||||
unset($message[$messageName]['Status']);
|
||||
$data['response'] = $message[$messageName];
|
||||
} elseif (isset($message)) {
|
||||
$data['response'] = $message;
|
||||
unset($message['status']);
|
||||
}
|
||||
|
||||
$result = self::build($data);
|
||||
|
||||
if ($httpStatus == 200 || $httpStatus == 201 || $httpStatus == 422 || $httpStatus == 302) {
|
||||
return $result;
|
||||
} else {
|
||||
OpenPayU_Http::throwHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Retrieve extends OpenPayU
|
||||
{
|
||||
|
||||
const PAYMETHODS_SERVICE = 'paymethods';
|
||||
|
||||
/**
|
||||
* Get Pay Methods from POS
|
||||
* @param string $lang
|
||||
* @return null|OpenPayU_Result
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function payMethods($lang = null)
|
||||
{
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
if (!$authType instanceof AuthType_Oauth) {
|
||||
throw new OpenPayU_Exception_Configuration('Retrieve works only with OAuth');
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::PAYMETHODS_SERVICE;
|
||||
if ($lang !== null) {
|
||||
$pathUrl .= '?lang=' . $lang;
|
||||
}
|
||||
|
||||
$response = self::verifyResponse(OpenPayU_Http::doGet($pathUrl, $authType));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $response
|
||||
* @return null|OpenPayU_Result
|
||||
*/
|
||||
public static function verifyResponse($response)
|
||||
{
|
||||
$data = array();
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
$message = OpenPayU_Util::convertJsonToArray($response['response'], true);
|
||||
|
||||
$data['status'] = isset($message['status']['statusCode']) ? $message['status']['statusCode'] : null;
|
||||
|
||||
if (json_last_error() == JSON_ERROR_SYNTAX) {
|
||||
$data['response'] = $response['response'];
|
||||
} elseif (isset($message)) {
|
||||
$data['response'] = $message;
|
||||
unset($message['status']);
|
||||
}
|
||||
|
||||
$result = self::build($data);
|
||||
|
||||
if ($httpStatus == 200 || $httpStatus == 201 || $httpStatus == 422 || $httpStatus == 302 || $httpStatus == 400 || $httpStatus == 404) {
|
||||
return $result;
|
||||
} else {
|
||||
OpenPayU_Http::throwHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Shop extends OpenPayU
|
||||
{
|
||||
const SHOPS_SERVICE = 'shops';
|
||||
|
||||
/**
|
||||
* Retrieving shop data
|
||||
* @param string $publicShopId
|
||||
* @return PayuShop
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function get($publicShopId)
|
||||
{
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
if (!$authType instanceof AuthType_Oauth) {
|
||||
throw new OpenPayU_Exception_Configuration('Get shop works only with OAuth');
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::SHOPS_SERVICE . '/' . $publicShopId;
|
||||
|
||||
return self::verifyResponse(OpenPayU_Http::doGet($pathUrl, $authType));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $response
|
||||
* @return PayuShop
|
||||
* @throws OpenPayU_Exception
|
||||
*/
|
||||
public static function verifyResponse($response)
|
||||
{
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
if ($httpStatus == 500) {
|
||||
$result = (new ResultError())
|
||||
->setErrorDescription($response['response']);
|
||||
OpenPayU_Http::throwErrorHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
|
||||
$message = json_decode($response['response'], true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_SYNTAX) {
|
||||
throw new OpenPayU_Exception_ServerError('Incorrect json response. Response: [' . $response['response'] . ']');
|
||||
}
|
||||
|
||||
if ($httpStatus == 200) {
|
||||
return (new PayuShop())
|
||||
->setShopId($message['shopId'])
|
||||
->setName($message['name'])
|
||||
->setCurrencyCode($message['currencyCode'])
|
||||
->setBalance(
|
||||
(new PayuShopBalance())
|
||||
->setCurrencyCode($message['balance']['currencyCode'])
|
||||
->setTotal($message['balance']['total'])
|
||||
->setAvailable($message['balance']['available'])
|
||||
);
|
||||
}
|
||||
|
||||
$result = (new ResultError())
|
||||
->setError($message['error'])
|
||||
->setErrorDescription($message['error_description']);
|
||||
|
||||
OpenPayU_Http::throwErrorHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2017 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
class OpenPayU_Token extends OpenPayU
|
||||
{
|
||||
|
||||
const TOKENS_SERVICE = 'tokens';
|
||||
|
||||
/**
|
||||
* Deleting a payment token
|
||||
* @param string $token
|
||||
* @return null|OpenPayU_Result
|
||||
* @throws OpenPayU_Exception
|
||||
* @throws OpenPayU_Exception_Configuration
|
||||
*/
|
||||
public static function delete($token)
|
||||
{
|
||||
|
||||
try {
|
||||
$authType = self::getAuth();
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
throw new OpenPayU_Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
if (!$authType instanceof AuthType_Oauth) {
|
||||
throw new OpenPayU_Exception_Configuration('Delete token works only with OAuth');
|
||||
}
|
||||
|
||||
if (OpenPayU_Configuration::getOauthGrantType() !== OauthGrantType::TRUSTED_MERCHANT) {
|
||||
throw new OpenPayU_Exception_Configuration('Token delete request is available only for trusted_merchant');
|
||||
}
|
||||
|
||||
$pathUrl = OpenPayU_Configuration::getServiceUrl() . self::TOKENS_SERVICE . '/' . $token;
|
||||
|
||||
$response = self::verifyResponse(OpenPayU_Http::doDelete($pathUrl, $authType));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $response
|
||||
* @return null|OpenPayU_Result
|
||||
*/
|
||||
public static function verifyResponse($response)
|
||||
{
|
||||
$data = array();
|
||||
$httpStatus = $response['code'];
|
||||
|
||||
$message = OpenPayU_Util::convertJsonToArray($response['response'], true);
|
||||
|
||||
$data['status'] = isset($message['status']['statusCode']) ? $message['status']['statusCode'] : null;
|
||||
|
||||
if (json_last_error() == JSON_ERROR_SYNTAX) {
|
||||
$data['response'] = $response['response'];
|
||||
} elseif (isset($message)) {
|
||||
$data['response'] = $message;
|
||||
unset($message['status']);
|
||||
}
|
||||
|
||||
$result = self::build($data);
|
||||
|
||||
if ($httpStatus == 204) {
|
||||
return $result;
|
||||
} else {
|
||||
OpenPayU_Http::throwHttpStatusException($httpStatus, $result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OpenPayU Standard Library
|
||||
* ver. 2.1.3
|
||||
*
|
||||
* @copyright Copyright (c) 2011-2016 PayU
|
||||
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
||||
* http://www.payu.com
|
||||
* http://developers.payu.com
|
||||
*/
|
||||
|
||||
include_once('OpenPayU/Configuration.php');
|
||||
include_once('OpenPayU/OpenPayUException.php');
|
||||
include_once('OpenPayU/Util.php');
|
||||
include_once('OpenPayU/OpenPayU.php');
|
||||
include_once('OpenPayU/OpenPayuOrderStatus.php');
|
||||
|
||||
include_once('OpenPayU/Result.php');
|
||||
|
||||
require_once('OpenPayU/Http.php');
|
||||
require_once('OpenPayU/HttpCurl.php');
|
||||
|
||||
require_once('OpenPayU/Oauth/Oauth.php');
|
||||
require_once('OpenPayU/Oauth/OauthGrantType.php');
|
||||
require_once('OpenPayU/Oauth/OauthResultClientCredentials.php');
|
||||
require_once('OpenPayU/Oauth/Cache/OauthCacheInterface.php');
|
||||
require_once('OpenPayU/Oauth/Cache/OauthCacheFile.php');
|
||||
require_once('OpenPayU/Oauth/Cache/OauthCacheMemcached.php');
|
||||
|
||||
require_once('OpenPayU/ResultError.php');
|
||||
|
||||
require_once('OpenPayU/AuthType/AuthType.php');
|
||||
require_once('OpenPayU/AuthType/Basic.php');
|
||||
require_once('OpenPayU/AuthType/TokenRequest.php');
|
||||
require_once('OpenPayU/AuthType/Oauth.php');
|
||||
|
||||
include_once('OpenPayU/v2/Refund.php');
|
||||
include_once('OpenPayU/v2/Order.php');
|
||||
include_once('OpenPayU/v2/Retrieve.php');
|
||||
include_once('OpenPayU/v2/Token.php');
|
||||
include_once('OpenPayU/v2/Shop.php');
|
||||
|
||||
include_once('OpenPayU/Model/PayuShop.php');
|
||||
include_once('OpenPayU/Model/PayuShop/PayuShopBalance.php');
|
||||
BIN
wp-content/plugins/woo-payu-payment-gateway/lang/payu-pl_PL.mo
Normal file
BIN
wp-content/plugins/woo-payu-payment-gateway/lang/payu-pl_PL.mo
Normal file
Binary file not shown.
500
wp-content/plugins/woo-payu-payment-gateway/lang/payu-pl_PL.po
Normal file
500
wp-content/plugins/woo-payu-payment-gateway/lang/payu-pl_PL.po
Normal file
@@ -0,0 +1,500 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PayU Payment Gateway\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-03-26 10:13+0000\n"
|
||||
"PO-Revision-Date: 2022-04-22 12:10+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Polski\n"
|
||||
"Language: pl_PL\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10 >= 2 && n%10<=4 "
|
||||
"&&(n%100<10||n%100 >= 20)? 1 : 2);\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Loco-Version: 2.5.8; wp-5.9\n"
|
||||
"X-Domain: payu"
|
||||
|
||||
#: includes/WC_PayUGateways.php:848 includes/WC_PayUGateways.php:1024
|
||||
msgid " for order: "
|
||||
msgstr " dla zamówienia: "
|
||||
|
||||
#: includes/WC_PayUGateways.php:162
|
||||
#, php-format
|
||||
msgid "<a href=\"%s\" target=\"_blank\">PayU privacy policy</a>"
|
||||
msgstr "<a href=\"%s\" target=\"_blank\">Polityce prywatności PayU</a>"
|
||||
|
||||
#: woocommerce-gateway-payu.php:342
|
||||
#, php-format
|
||||
msgid "[PayU] User %s accepted payment"
|
||||
msgstr "[PayU] Użytkownik %s zaakceptował płatność"
|
||||
|
||||
#: woocommerce-gateway-payu.php:353
|
||||
#, php-format
|
||||
msgid "[PayU] User %s rejected payment"
|
||||
msgstr "[PayU] Użytkownik %s odrzucił płatność"
|
||||
|
||||
#: includes/WC_PayUGateways.php:756
|
||||
msgid "Awaiting PayU payment."
|
||||
msgstr "Oczekiwanie na płatność PayU."
|
||||
|
||||
#: woocommerce-gateway-payu.php:203 woocommerce-gateway-payu.php:257
|
||||
msgid "Awaiting receipt of payment"
|
||||
msgstr "Oczekuje na odbiór płatności"
|
||||
|
||||
#: includes/PayUSettings.php:215
|
||||
msgid ""
|
||||
"Before enabling repayment, read <a target=\"_blank\" href=\"https://github."
|
||||
"com/PayU-EMEA/plugin_woocommerce#ponawianie-p%C5%82atno%C5%9Bci\">the "
|
||||
"documentation</a> and disable <strong>automatic collection</strong> in POS "
|
||||
"configuration."
|
||||
msgstr ""
|
||||
"Przed włączeniem ponowienia płatności przeczytaj <a target=\"_blank\" "
|
||||
"href=\"https://github.com/PayU-EMEA/plugin_woocommerce#ponawianie-"
|
||||
"p%C5%82atno%C5%9Bci\">dokumentację</a> i wyłącz <strong>autoodbiór</strong> "
|
||||
"w konfiguracji punktu płatności."
|
||||
|
||||
#: includes/WC_PayUGateways.php:215
|
||||
msgid "Blik"
|
||||
msgstr "Blik"
|
||||
|
||||
#: includes/WC_PayUGateways.php:228 includes/WC_PayUGateways.php:234
|
||||
msgid "Buy now, pay in 30 days."
|
||||
msgstr "Kup teraz zapłać za 30 dni. "
|
||||
|
||||
#: includes/WC_PayUGateways.php:149
|
||||
#, php-format
|
||||
msgid ""
|
||||
"By paying you accept <a href=\"%s\" target=\"_blank\">\"PayU Payment Terms\"."
|
||||
"</a>"
|
||||
msgstr ""
|
||||
"Płacąc akceptujesz <a href=\"%s\" target=\"_blank\">\"Zasady płatności "
|
||||
"PayU\".</a>"
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:80
|
||||
msgid "Card number"
|
||||
msgstr "Numer karty"
|
||||
|
||||
#: includes/WC_PayUGateways.php:203 includes/WC_PayUGateways.php:209
|
||||
msgid "Card payment with PayU"
|
||||
msgstr "Płatność kartą z PayU"
|
||||
|
||||
#: includes/WC_PayUGateways.php:198 includes/WC_Gateway_PayuListBanks.php:95
|
||||
msgid "Choose payment method."
|
||||
msgstr "Wybierz metodę płatności."
|
||||
|
||||
#: includes/PayUSettings.php:33 includes/PayUSettings.php:51
|
||||
msgid ""
|
||||
"Client Id for OAuth identifier from \"Configuration Keys\" section of PayU "
|
||||
"management panel."
|
||||
msgstr ""
|
||||
"Id punktu płatności do autentykacji Oauth z sekcji Klucze konfiguracji w "
|
||||
"panelu managera."
|
||||
|
||||
#: includes/WC_PayUGateways.php:317 includes/WC_PayUGateways.php:318
|
||||
msgid "Custom order, separate payment methods with commas"
|
||||
msgstr "Własna kolejność metod płatności, oddziel metody przecinkami"
|
||||
|
||||
#: includes/WC_PayUGateways.php:315
|
||||
msgid "Custom order:"
|
||||
msgstr "Własna kolejność"
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:92
|
||||
msgid "CVV"
|
||||
msgstr "CVV"
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:145
|
||||
msgid "Default on-hold status"
|
||||
msgstr "Domyślny status zamówienia"
|
||||
|
||||
#: includes/WC_PayUGateways.php:395
|
||||
msgid "Description of PayU Payment Gateway that users sees on Checkout page."
|
||||
msgstr "Opis płatności PayU widoczny przez kupującego na stronie zamówienia."
|
||||
|
||||
#: includes/WC_PayUGateways.php:393
|
||||
msgid "Description:"
|
||||
msgstr "Opis: "
|
||||
|
||||
#: woocommerce-gateway-payu.php:304
|
||||
msgid "Discard payment"
|
||||
msgstr "Odrzuć płatność"
|
||||
|
||||
#: woocommerce-gateway-payu.php:166
|
||||
msgid "Docs"
|
||||
msgstr "Dokumentacja"
|
||||
|
||||
#: includes/WC_PayUGateways.php:400
|
||||
msgid "Enable for shipping methods"
|
||||
msgstr "Włącz dla metod wysyłki"
|
||||
|
||||
#: includes/WC_PayUGateways.php:415
|
||||
msgid "Enable for virtual orders"
|
||||
msgstr "Włączone na zamówień wirtualnych "
|
||||
|
||||
#: includes/WC_PayUGateways.php:279
|
||||
msgid "Enable PayU payment method"
|
||||
msgstr "Włącz metodę płatności"
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:152
|
||||
msgid "Enable repayment"
|
||||
msgstr "Włącz ponawianie płatności"
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:86
|
||||
msgid "Expire date"
|
||||
msgstr "Ważna do"
|
||||
|
||||
#: includes/PayUSettings.php:38 includes/PayUSettings.php:56
|
||||
msgid "First key from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr "Pierwszy klucz (MD5) z sekcji Klucze konfiguracji w panelu managera."
|
||||
|
||||
#: includes/WC_PayUGateways.php:980
|
||||
msgid "has status"
|
||||
msgstr "ma status"
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "http://www.payu.com"
|
||||
msgstr "http://www.payu.com"
|
||||
|
||||
#. URI of the plugin
|
||||
msgid "https://github.com/PayU/plugin_woocommerce"
|
||||
msgstr "https://github.com/PayU/plugin_woocommerce"
|
||||
|
||||
#: includes/PayUSettings.php:23
|
||||
msgid "Id point of sales"
|
||||
msgstr "Id punktu płatności:"
|
||||
|
||||
#: includes/WC_PayUGateways.php:405
|
||||
msgid ""
|
||||
"If PayU is only available for certain methods, set it up here. Leave blank "
|
||||
"to enable for all methods."
|
||||
msgstr ""
|
||||
"Jeżeli PayU ma być dostępne tylko dla niektórych metod to ustaw je tutaj. "
|
||||
"Pozostaw puste, aby włączyć wszystkie metody."
|
||||
|
||||
#: includes/WC_PayUGateways.php:281
|
||||
#| msgid ""
|
||||
#| "If you do not already have PayU merchant account, <a href=\"https://www."
|
||||
#| "payu.pl/en/how-to-activate-payu\" target=\"_blank\" rel=\"nofollow\">"
|
||||
#| "please register in Production</a> or <a href=\"https://secure.snd.payu."
|
||||
#| "com/boarding/#/registerSandbox/?lang=en\" target=\"_blank\" "
|
||||
#| "rel=\"nofollow\">please register in Sandbox</a>."
|
||||
msgid ""
|
||||
"If you do not already have PayU merchant account, <a href=\"https://poland."
|
||||
"payu.com/en/how-to-activate-payu/\" target=\"_blank\" rel=\"nofollow\">"
|
||||
"please register in Production</a> or <a href=\"https://secure.snd.payu."
|
||||
"com/boarding/#/registerSandbox/?lang=en\" target=\"_blank\" rel=\"nofollow\">"
|
||||
"please register in Sandbox</a>."
|
||||
msgstr ""
|
||||
"Jeżeli nie posiadasz jeszcze konta w systemie PayU, <a href=\"https://www."
|
||||
"payu.pl/oferta-handlowa\" target=\"_blank\" rel=\"nofollow\">zarejestruj się "
|
||||
"w systemie produkcyjnym</a> lub <a href=\"https://secure.snd.payu."
|
||||
"com/boarding/#/registerSandbox/?lang=pl\" target=\"_blank\" rel=\"nofollow\">"
|
||||
"zarejestruj się w systemie sandbox</a>."
|
||||
|
||||
#: includes/WC_PayUGateways.php:1084
|
||||
msgid "If you have not yet paid for the order, you can do so by going to"
|
||||
msgstr ""
|
||||
"Jeżeli jeszcze nie opłaciłeś zamówienia możesz to zrobić przechodząc na"
|
||||
|
||||
#: includes/PayUSettings.php:32
|
||||
msgid "OAuth - client_id"
|
||||
msgstr "OAuth - client_id"
|
||||
|
||||
#: includes/PayUSettings.php:37
|
||||
msgid "OAuth - client_secret"
|
||||
msgstr "OAuth - client_secret"
|
||||
|
||||
#: includes/WC_PayUGateways.php:178
|
||||
msgid "Official PayU payment gateway for WooCommerce."
|
||||
msgstr "Moduł płatności PayU dla WooCommerce."
|
||||
|
||||
#: includes/WC_PayUGateways.php:191 includes/WC_PayUGateways.php:197
|
||||
msgid "Online payment by PayU"
|
||||
msgstr "Płatność online z PayU"
|
||||
|
||||
#: includes/WC_PayUGateways.php:227
|
||||
msgid "Pay letter with PayPo"
|
||||
msgstr "Płacę później z PayPo"
|
||||
|
||||
#: includes/WC_PayUGateways.php:233
|
||||
msgid "Pay letter with Twisto"
|
||||
msgstr "Płacę później z Twisto"
|
||||
|
||||
#: html/payu-repayment.php:4
|
||||
msgid "Pay with"
|
||||
msgstr "Zapłać z "
|
||||
|
||||
#: woocommerce-gateway-payu.php:278
|
||||
msgid "Pay with PayU"
|
||||
msgstr "Zapłać z PayU"
|
||||
|
||||
#: includes/WC_PayUGateways.php:771
|
||||
msgid "Payment error. Status code: "
|
||||
msgstr "Błąd płatności. Kod błędu: "
|
||||
|
||||
#: includes/WC_PayUGateways.php:776
|
||||
msgid "Payment error: "
|
||||
msgstr "Błąd płatności: "
|
||||
|
||||
#: includes/WC_PayUGateways.php:999
|
||||
msgid "Payment has been cancelled."
|
||||
msgstr "Płatność została anulowana."
|
||||
|
||||
#: includes/WC_PayUGateways.php:1013
|
||||
msgid ""
|
||||
"Payment has been put on hold - merchant must approve this payment manually."
|
||||
msgstr ""
|
||||
"Płatność została wstrzymana sprzedawca musi zaakceptować płatność ręcznie."
|
||||
|
||||
#: includes/WC_PayUGateways.php:144
|
||||
msgid ""
|
||||
"Payment is processed by PayU SA; The recipient's data, the payment title and "
|
||||
"the amount are provided to PayU SA by the recipient;"
|
||||
msgstr ""
|
||||
"Zlecenie realizacji płatności: Zlecenie wykonuje PayU SA; Dane odbiorcy, "
|
||||
"tytuł oraz kwota płatności dostarczane są PayU SA przez odbiorcę;"
|
||||
|
||||
#: includes/WC_PayUGateways.php:214
|
||||
msgid "PayU - Blik"
|
||||
msgstr "PayU - Blik"
|
||||
|
||||
#: includes/WC_PayUGateways.php:202
|
||||
msgid "PayU - credit card"
|
||||
msgstr "PayU - karta kredytowa"
|
||||
|
||||
#: includes/WC_PayUGateways.php:220
|
||||
msgid "PayU - installments"
|
||||
msgstr "PayU - raty"
|
||||
|
||||
#: includes/WC_PayUGateways.php:196
|
||||
msgid "PayU - list banks"
|
||||
msgstr "PayU - lista banków"
|
||||
|
||||
#: includes/WC_PayUGateways.php:226
|
||||
msgid "PayU - PayPo"
|
||||
msgstr "PayU - PayPo"
|
||||
|
||||
#: includes/WC_PayUGateways.php:208
|
||||
msgid "PayU - secure form"
|
||||
msgstr "PayU - secure form"
|
||||
|
||||
#: includes/WC_PayUGateways.php:190
|
||||
msgid "PayU - standard"
|
||||
msgstr "PayU - standard"
|
||||
|
||||
#: includes/WC_PayUGateways.php:232
|
||||
msgid "PayU - Twisto"
|
||||
msgstr "PayU - Twisto"
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:115
|
||||
msgid "PayU config global"
|
||||
msgstr "PayU ustawienia globalne"
|
||||
|
||||
#: includes/WC_PayUGateways.php:221
|
||||
#| msgid "PayU - installments"
|
||||
msgid "PayU installments"
|
||||
msgstr "Raty PayU"
|
||||
|
||||
#. Name of the plugin
|
||||
msgid "PayU Payment Gateway"
|
||||
msgstr "Płacę z PayU"
|
||||
|
||||
#. Description of the plugin
|
||||
msgid "PayU payment gateway for WooCommerce"
|
||||
msgstr "Wtyczka Płacę z PayU dla Woocommerce"
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "PayU SA"
|
||||
msgstr "PayU SA"
|
||||
|
||||
#. page_title
|
||||
#: includes/PayUSettings.php:68 includes/PayUSettings.php:69
|
||||
#: includes/PayUSettings.php:85
|
||||
msgid "PayU settings"
|
||||
msgstr "Ustawienia PayU"
|
||||
|
||||
#: includes/PayUSettings.php:24 includes/PayUSettings.php:42
|
||||
msgid ""
|
||||
"Pos identifier from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr "Id punktu płatności z sekcji Klucze konfiguracji w panelu managera."
|
||||
|
||||
#: includes/WC_PayUGateways.php:145 includes/WC_PayUGateways.php:154
|
||||
msgid "read more"
|
||||
msgstr "więcej"
|
||||
|
||||
#: woocommerce-gateway-payu.php:303
|
||||
msgid "Receive payment"
|
||||
msgstr "Odbierz płatność"
|
||||
|
||||
#: includes/WC_PayUGateways.php:848 includes/WC_PayUGateways.php:1023
|
||||
msgid "Refund of: "
|
||||
msgstr "Zwrot: "
|
||||
|
||||
#: includes/PayUSettings.php:41
|
||||
msgid "Sandbox - Id point of sales"
|
||||
msgstr "Sandbox - Id punktu płatności:"
|
||||
|
||||
#: includes/PayUSettings.php:50
|
||||
msgid "Sandbox - OAuth - client_id:"
|
||||
msgstr "Sandbox - OAuth - client_id:"
|
||||
|
||||
#: includes/PayUSettings.php:55
|
||||
msgid "Sandbox - OAuth - client_secret:"
|
||||
msgstr "Sandbox - OAuth - client_secret:"
|
||||
|
||||
#: includes/PayUSettings.php:46
|
||||
msgid "Sandbox - Second key (MD5):"
|
||||
msgstr "Sandbox - Drugi klucz MD5:"
|
||||
|
||||
#: includes/WC_PayUGateways.php:293
|
||||
msgid "Sandbox mode:"
|
||||
msgstr "Tryb sandbox:"
|
||||
|
||||
#: includes/PayUSettings.php:28
|
||||
msgid "Second key (MD5)"
|
||||
msgstr "Drugi klucz MD5"
|
||||
|
||||
#: includes/PayUSettings.php:29 includes/PayUSettings.php:47
|
||||
msgid ""
|
||||
"Second key from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr "Drugi klucz (MD5) z sekcji Klucze konfiguracji w panelu managera."
|
||||
|
||||
#: includes/WC_PayUGateways.php:410
|
||||
msgid "Select shipping methods"
|
||||
msgstr "Wybierz metody wysyłki"
|
||||
|
||||
#: includes/WC_PayUGateways.php:325
|
||||
msgid "show"
|
||||
msgstr "pokaż"
|
||||
|
||||
#: includes/WC_PayUGateways.php:322
|
||||
msgid "Show inactive methods:"
|
||||
msgstr "Pokaż nieaktywne metody płatności:"
|
||||
|
||||
#: includes/WC_PayUGateways.php:324
|
||||
msgid "Show inactive payment methods as grayed out"
|
||||
msgstr "Pokaż nieaktywne metody płatności jako wyszarzone"
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:79
|
||||
msgid "The card could not be sent"
|
||||
msgstr "Nie udało się przesłać karty"
|
||||
|
||||
#: includes/WC_PayUGateways.php:153
|
||||
msgid ""
|
||||
"The controller of your personal data is PayU S.A. with its registered office "
|
||||
"in Poznan (60-166), at Grunwaldzka Street 182 (\"PayU\")."
|
||||
msgstr ""
|
||||
"Administratorem Twoich danych osobowych jest PayU S.A. z siedzibą w Poznaniu "
|
||||
"(60-166), przy ul. Grunwaldzkiej 186."
|
||||
|
||||
#: includes/WC_PayUGateways.php:146
|
||||
msgid ""
|
||||
"The order is sent for processing when PayU SA receives your payment. The "
|
||||
"payment is transferred to the recipient within 1 hour, not later than until "
|
||||
"the end of the next business day; PayU SA does not charge any service fees."
|
||||
msgstr ""
|
||||
"Zlecenie jest przekazywane do realizacji po otrzymaniu przez PayU SA Państwa "
|
||||
"wpłaty. Płatność udostępniana jest odbiorcy w ciągu 1 godziny, nie później "
|
||||
"niż do końca następnego dnia roboczego; PayU SA nie pobiera opłaty od "
|
||||
"realizacji usługi."
|
||||
|
||||
#: includes/WC_PayUGateways.php:158
|
||||
msgid ""
|
||||
"The recipients of your personal data may be entities cooperating with PayU "
|
||||
"during processing the payment. Depending on the payment method you choose, "
|
||||
"these may include: banks, payment institutions, loan institutions, payment "
|
||||
"card organizations, payment schemes), as well as suppliers supporting PayU’s "
|
||||
"activity providing: IT infrastructure, payment risk analysis tools and also "
|
||||
"entities that are authorised to receive it under the applicable provisions "
|
||||
"of law, including relevant judicial authorities. Your personal data may be "
|
||||
"shared with merchants to inform them about the status of the payment."
|
||||
msgstr ""
|
||||
"Odbiorcami Twoich danych osobowych mogą być podmioty współpracujące z PayU w "
|
||||
"procesie realizacji płatności. W zależności od wybranej przez Ciebie metody "
|
||||
"płatności mogą to być: banki, instytucje płatnicze, instytucje pożyczkowe, "
|
||||
"organizacje kart płatniczych, schematy płatnicze), ponadto podmioty "
|
||||
"wspierające działalność PayU tj. dostawcy infrastruktury IT, dostawcy "
|
||||
"narzędzi do analizy ryzyka płatności a także podmiotom uprawnionym do ich "
|
||||
"otrzymania na mocy obowiązujących przepisów prawa, w tym właściwym organom "
|
||||
"wymiaru sprawiedliwości. Twoje dane mogą zostać udostępnione akceptantom "
|
||||
"celem poinformowania ich o statusie realizacji płatności."
|
||||
|
||||
#: includes/WC_PayUGateways.php:1086 includes/WC_PayUGateways.php:1087
|
||||
msgid "the website"
|
||||
msgstr "stronę"
|
||||
|
||||
#: includes/WC_PayUGateways.php:288
|
||||
msgid "Title of PayU Payment Gateway that users sees on Checkout page."
|
||||
msgstr "Nazwa płatności PayU widoczna przez kupującego na stronie zamówienia."
|
||||
|
||||
#: includes/WC_PayUGateways.php:286
|
||||
msgid "Title:"
|
||||
msgstr "Nazwa:"
|
||||
|
||||
#: includes/WC_PayUGateways.php:301
|
||||
msgid "Use global values."
|
||||
msgstr "Użyj wartości globalnych."
|
||||
|
||||
#: includes/WC_PayUGateways.php:299
|
||||
msgid "Use global values:"
|
||||
msgstr "Użyj wartości globalnych:"
|
||||
|
||||
#: includes/WC_PayUGateways.php:295
|
||||
msgid "Use sandbox environment."
|
||||
msgstr "Używaj środowiska sandbox."
|
||||
|
||||
#: includes/WC_PayUGateways.php:414
|
||||
msgid "Virtual orders"
|
||||
msgstr "Wirtualne zamówienia"
|
||||
|
||||
#: includes/WC_PayUGateways.php:160
|
||||
msgid ""
|
||||
"You have the right to access, rectify, restrict or oppose the processing of "
|
||||
"data, not to be subject to automated decision making, including profiling, "
|
||||
"or to transfer and erase Your personal data. Providing personal data is "
|
||||
"voluntary however necessary for the processing the payment and failure to "
|
||||
"provide the data may result in the rejection of the payment. For more "
|
||||
"information on how PayU processes your personal data, please click "
|
||||
msgstr ""
|
||||
"Przysługuje Tobie prawo dostępu do danych, a także do ich sprostowania, "
|
||||
"ograniczenia ich przetwarzania, zgłoszenia sprzeciwu wobec ich przetwarzania,"
|
||||
" niepodlegania zautomatyzowanemu podejmowaniu decyzji w tym profilowania "
|
||||
"oraz do przenoszenia i usunięcia danych. Podanie danych jest dobrowolne "
|
||||
"jednak niezbędne do realizacji płatności, a brak podania danych może "
|
||||
"skutkować odrzuceniem płatności. Więcej informacji o zasadach przetwarzania "
|
||||
"Twoich danych osobowych przez PayU znajdziesz w "
|
||||
|
||||
#: includes/WC_PayUGateways.php:210
|
||||
msgid "You may be redirected to a payment confirmation page."
|
||||
msgstr "Może być konieczne przekierowany na stronę potwierdzenia płatności."
|
||||
|
||||
#: includes/WC_PayUGateways.php:204
|
||||
msgid "You will be redirected to a card form."
|
||||
msgstr "Przekierujemy Cię do formularza danych karty."
|
||||
|
||||
#: includes/WC_PayUGateways.php:192
|
||||
msgid "You will be redirected to a payment method selection page."
|
||||
msgstr "Przekierujemy Cię na stronę wyboru metody płatności."
|
||||
|
||||
#: includes/WC_PayUGateways.php:222
|
||||
msgid "You will be redirected to an installment payment application."
|
||||
msgstr "Przekierujemy Cię na stronę wniosku ratalnego."
|
||||
|
||||
#: includes/WC_PayUGateways.php:216
|
||||
msgid "You will be redirected to BLIK."
|
||||
msgstr "Przekierujemy Cię na stronę wprowadzenia kodu BLIK."
|
||||
|
||||
#: includes/WC_PayUGateways.php:156
|
||||
msgid ""
|
||||
"Your personal data will be processed for purposes of processing payment "
|
||||
"transaction, notifying You about the status of this payment, dealing with "
|
||||
"complaints and also in order to fulfill the legal obligations imposed on "
|
||||
"PayU."
|
||||
msgstr ""
|
||||
"Twoje dane osobowe będą przetwarzane w celu realizacji transakcji płatniczej,"
|
||||
" powiadamiania Cię o statusie realizacji Twojej płatności, rozpatrywania "
|
||||
"reklamacji, a także w celu wypełnienia obowiązków prawnych ciążących na PayU."
|
||||
449
wp-content/plugins/woo-payu-payment-gateway/lang/payu.pot
Normal file
449
wp-content/plugins/woo-payu-payment-gateway/lang/payu.pot
Normal file
@@ -0,0 +1,449 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PayU Payment Gateway\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-04-22 12:09+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: PayU\n"
|
||||
"Language-Team: \n"
|
||||
"Language: \n"
|
||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Loco-Version: 2.5.2; wp-5.7\n"
|
||||
"X-Domain: payu"
|
||||
|
||||
#: includes/WC_PayUGateways.php:848 includes/WC_PayUGateways.php:1024
|
||||
msgid " for order: "
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:162
|
||||
#, php-format
|
||||
msgid "<a href=\"%s\" target=\"_blank\">PayU privacy policy</a>"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:342
|
||||
#, php-format
|
||||
msgid "[PayU] User %s accepted payment"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:353
|
||||
#, php-format
|
||||
msgid "[PayU] User %s rejected payment"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:756
|
||||
msgid "Awaiting PayU payment."
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:203 woocommerce-gateway-payu.php:257
|
||||
msgid "Awaiting receipt of payment"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:215
|
||||
msgid ""
|
||||
"Before enabling repayment, read <a target=\"_blank\" href=\"https://github."
|
||||
"com/PayU-EMEA/plugin_woocommerce#ponawianie-p%C5%82atno%C5%9Bci\">the "
|
||||
"documentation</a> and disable <strong>automatic collection</strong> in POS "
|
||||
"configuration."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:215
|
||||
msgid "Blik"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:228 includes/WC_PayUGateways.php:234
|
||||
msgid "Buy now, pay in 30 days."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:149
|
||||
#, php-format
|
||||
msgid ""
|
||||
"By paying you accept <a href=\"%s\" target=\"_blank\">\"PayU Payment Terms\"."
|
||||
"</a>"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:80
|
||||
msgid "Card number"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:203 includes/WC_PayUGateways.php:209
|
||||
msgid "Card payment with PayU"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:198 includes/WC_Gateway_PayuListBanks.php:95
|
||||
msgid "Choose payment method."
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:33 includes/PayUSettings.php:51
|
||||
msgid ""
|
||||
"Client Id for OAuth identifier from \"Configuration Keys\" section of PayU "
|
||||
"management panel."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:317 includes/WC_PayUGateways.php:318
|
||||
msgid "Custom order, separate payment methods with commas"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:315
|
||||
msgid "Custom order:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:92
|
||||
msgid "CVV"
|
||||
msgstr ""
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:145
|
||||
msgid "Default on-hold status"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:395
|
||||
msgid "Description of PayU Payment Gateway that users sees on Checkout page."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:393
|
||||
msgid "Description:"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:304
|
||||
msgid "Discard payment"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:166
|
||||
msgid "Docs"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:400
|
||||
msgid "Enable for shipping methods"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:415
|
||||
msgid "Enable for virtual orders"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:279
|
||||
msgid "Enable PayU payment method"
|
||||
msgstr ""
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:152
|
||||
msgid "Enable repayment"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:86
|
||||
msgid "Expire date"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:38 includes/PayUSettings.php:56
|
||||
msgid "First key from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:980
|
||||
msgid "has status"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin
|
||||
msgid "http://www.payu.com"
|
||||
msgstr ""
|
||||
|
||||
#. URI of the plugin
|
||||
msgid "https://github.com/PayU/plugin_woocommerce"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:23
|
||||
msgid "Id point of sales"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:405
|
||||
msgid ""
|
||||
"If PayU is only available for certain methods, set it up here. Leave blank "
|
||||
"to enable for all methods."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:281
|
||||
msgid ""
|
||||
"If you do not already have PayU merchant account, <a href=\"https://poland."
|
||||
"payu.com/en/how-to-activate-payu/\" target=\"_blank\" rel=\"nofollow\">"
|
||||
"please register in Production</a> or <a href=\"https://secure.snd.payu."
|
||||
"com/boarding/#/registerSandbox/?lang=en\" target=\"_blank\" rel=\"nofollow\">"
|
||||
"please register in Sandbox</a>."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:1084
|
||||
msgid "If you have not yet paid for the order, you can do so by going to"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:32
|
||||
msgid "OAuth - client_id"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:37
|
||||
msgid "OAuth - client_secret"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:178
|
||||
msgid "Official PayU payment gateway for WooCommerce."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:191 includes/WC_PayUGateways.php:197
|
||||
msgid "Online payment by PayU"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:227
|
||||
msgid "Pay letter with PayPo"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:233
|
||||
msgid "Pay letter with Twisto"
|
||||
msgstr ""
|
||||
|
||||
#: html/payu-repayment.php:4
|
||||
msgid "Pay with"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:278
|
||||
msgid "Pay with PayU"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:771
|
||||
msgid "Payment error. Status code: "
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:776
|
||||
msgid "Payment error: "
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:999
|
||||
msgid "Payment has been cancelled."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:1013
|
||||
msgid ""
|
||||
"Payment has been put on hold - merchant must approve this payment manually."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:144
|
||||
msgid ""
|
||||
"Payment is processed by PayU SA; The recipient's data, the payment title and "
|
||||
"the amount are provided to PayU SA by the recipient;"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:214
|
||||
msgid "PayU - Blik"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:202
|
||||
msgid "PayU - credit card"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:220
|
||||
msgid "PayU - installments"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:196
|
||||
msgid "PayU - list banks"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:226
|
||||
msgid "PayU - PayPo"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:208
|
||||
msgid "PayU - secure form"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:190
|
||||
msgid "PayU - standard"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:232
|
||||
msgid "PayU - Twisto"
|
||||
msgstr ""
|
||||
|
||||
#. id
|
||||
#: includes/PayUSettings.php:115
|
||||
msgid "PayU config global"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:221
|
||||
msgid "PayU installments"
|
||||
msgstr ""
|
||||
|
||||
#. Name of the plugin
|
||||
msgid "PayU Payment Gateway"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin
|
||||
msgid "PayU payment gateway for WooCommerce"
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin
|
||||
msgid "PayU SA"
|
||||
msgstr ""
|
||||
|
||||
#. page_title
|
||||
#: includes/PayUSettings.php:68 includes/PayUSettings.php:69
|
||||
#: includes/PayUSettings.php:85
|
||||
msgid "PayU settings"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:24 includes/PayUSettings.php:42
|
||||
msgid ""
|
||||
"Pos identifier from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:145 includes/WC_PayUGateways.php:154
|
||||
msgid "read more"
|
||||
msgstr ""
|
||||
|
||||
#: woocommerce-gateway-payu.php:303
|
||||
msgid "Receive payment"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:848 includes/WC_PayUGateways.php:1023
|
||||
msgid "Refund of: "
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:41
|
||||
msgid "Sandbox - Id point of sales"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:50
|
||||
msgid "Sandbox - OAuth - client_id:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:55
|
||||
msgid "Sandbox - OAuth - client_secret:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:46
|
||||
msgid "Sandbox - Second key (MD5):"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:293
|
||||
msgid "Sandbox mode:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:28
|
||||
msgid "Second key (MD5)"
|
||||
msgstr ""
|
||||
|
||||
#: includes/PayUSettings.php:29 includes/PayUSettings.php:47
|
||||
msgid ""
|
||||
"Second key from \"Configuration Keys\" section of PayU management panel."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:410
|
||||
msgid "Select shipping methods"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:325
|
||||
msgid "show"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:322
|
||||
msgid "Show inactive methods:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:324
|
||||
msgid "Show inactive payment methods as grayed out"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_Gateway_PayuSecureForm.php:79
|
||||
msgid "The card could not be sent"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:153
|
||||
msgid ""
|
||||
"The controller of your personal data is PayU S.A. with its registered office "
|
||||
"in Poznan (60-166), at Grunwaldzka Street 182 (\"PayU\")."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:146
|
||||
msgid ""
|
||||
"The order is sent for processing when PayU SA receives your payment. The "
|
||||
"payment is transferred to the recipient within 1 hour, not later than until "
|
||||
"the end of the next business day; PayU SA does not charge any service fees."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:158
|
||||
msgid ""
|
||||
"The recipients of your personal data may be entities cooperating with PayU "
|
||||
"during processing the payment. Depending on the payment method you choose, "
|
||||
"these may include: banks, payment institutions, loan institutions, payment "
|
||||
"card organizations, payment schemes), as well as suppliers supporting PayU’s "
|
||||
"activity providing: IT infrastructure, payment risk analysis tools and also "
|
||||
"entities that are authorised to receive it under the applicable provisions "
|
||||
"of law, including relevant judicial authorities. Your personal data may be "
|
||||
"shared with merchants to inform them about the status of the payment."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:1086 includes/WC_PayUGateways.php:1087
|
||||
msgid "the website"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:288
|
||||
msgid "Title of PayU Payment Gateway that users sees on Checkout page."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:286
|
||||
msgid "Title:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:301
|
||||
msgid "Use global values."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:299
|
||||
msgid "Use global values:"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:295
|
||||
msgid "Use sandbox environment."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:414
|
||||
msgid "Virtual orders"
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:160
|
||||
msgid ""
|
||||
"You have the right to access, rectify, restrict or oppose the processing of "
|
||||
"data, not to be subject to automated decision making, including profiling, "
|
||||
"or to transfer and erase Your personal data. Providing personal data is "
|
||||
"voluntary however necessary for the processing the payment and failure to "
|
||||
"provide the data may result in the rejection of the payment. For more "
|
||||
"information on how PayU processes your personal data, please click "
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:210
|
||||
msgid "You may be redirected to a payment confirmation page."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:204
|
||||
msgid "You will be redirected to a card form."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:192
|
||||
msgid "You will be redirected to a payment method selection page."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:222
|
||||
msgid "You will be redirected to an installment payment application."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:216
|
||||
msgid "You will be redirected to BLIK."
|
||||
msgstr ""
|
||||
|
||||
#: includes/WC_PayUGateways.php:156
|
||||
msgid ""
|
||||
"Your personal data will be processed for purposes of processing payment "
|
||||
"transaction, notifying You about the status of this payment, dealing with "
|
||||
"complaints and also in order to fulfill the legal obligations imposed on "
|
||||
"PayU."
|
||||
msgstr ""
|
||||
115
wp-content/plugins/woo-payu-payment-gateway/readme.txt
Normal file
115
wp-content/plugins/woo-payu-payment-gateway/readme.txt
Normal file
@@ -0,0 +1,115 @@
|
||||
=== WooCommerce PayU EU Payment Gateway ===
|
||||
Contributors: payusa
|
||||
Tags: woocommerce, PayU, payment, payment gateway, platnosci, PayU Poland, PayU EU
|
||||
Requires at least: 4.4
|
||||
Tested up to: 5.9
|
||||
Stable tag: 2.0.13
|
||||
Requires PHP: 7.0
|
||||
License: GPLv2
|
||||
|
||||
== Description ==
|
||||
**PayU payment module for WooCommerce**
|
||||
|
||||
The plugin offers the following payment methods:
|
||||
|
||||
* PayU - standard - payer will be redirected to PayU's hosted payment page where any available payment type configured on your POS can be chosen
|
||||
* PayU - bank list - payment type list will be displayed, depending on chosen type the payer will be either redirected directly to the bank or to PayU's hosted payment page
|
||||
* PayU - payment card - payer will be redirected to PayU's hosted card form where credit, debit or prepaid card data can be securely entered
|
||||
* PayU - secure form - a secure form collecting credit, debit or prepaid card data will be displayed
|
||||
* PayU - Blik - payer will be redirected to Blik's page
|
||||
* PayU - installments - payer will be redirected to installment payment form
|
||||
* PayU - PayPo - payer will be redirected to PayPo payment form
|
||||
* PayU - Twisto - payer will be redirected to Twisto payment form
|
||||
|
||||
Detailed information about each method and its configuration [can be found here](https://github.com/PayU-EMEA/plugin_woocommerce).
|
||||
|
||||
== Installation ==
|
||||
If you have any questions or would like to raise an issue please contact [our technical support](https://www.payu.pl/pomoc).
|
||||
|
||||
= Minimum Requirements =
|
||||
PayU merchant account - if you do not have an account you can [**register a production account**](https://poland.payu.com/en/how-to-activate-payu/) or [**register a sandbox account**](https://registration-merch-prod.snd.payu.com/boarding/#/registerSandbox/?lang=en)
|
||||
|
||||
**Note:** Module works only with `REST API` POS type (POS type is configured in PayU merchant panel after you register).
|
||||
|
||||
Following PHP libraries are required: cURL i hash.
|
||||
|
||||
= Automatic installation =
|
||||
Use [automatic installation and activation](https://wordpress.org/support/article/managing-plugins/#automatic-plugin-installation) available in Wordpress admin panel. Module name is `WooCommerce PayU EU Payment Gateway`.
|
||||
|
||||
= Updating =
|
||||
Upon plugin update from version 1.X to version 2.X the existing config data will be automatically converted.
|
||||
|
||||
== Changelog ==
|
||||
= 2.0.13 =
|
||||
* Fix method available for virtual products
|
||||
* Separate Twisto and PayPo
|
||||
= 2.0.12 =
|
||||
* Fix calculate total for check min/max
|
||||
* Possibility to enable for virtual orders
|
||||
* Fix #43 php notice
|
||||
* Update Visa logo
|
||||
= 2.0.11 =
|
||||
* Remove manual stock reduced
|
||||
* Remove unused REJECTED
|
||||
* Add filter woocommerce_payu_status_cancelled
|
||||
= 2.0.10 =
|
||||
* PayU terms - info instead of checkbox
|
||||
* Better check shipping method, clean up
|
||||
= 2.0.9 =
|
||||
* Fix not show installments, blik, card as separated method
|
||||
= 2.0.8 =
|
||||
* Send mail to customer when status change from payu-waiting to processing
|
||||
= 2.0.7 =
|
||||
* Fix show paymethods when WPML is active
|
||||
= 2.0.6 =
|
||||
* Fix hide inactive method
|
||||
= 2.0.5 =
|
||||
* Translate fix
|
||||
* Add filters for multicurrency support
|
||||
* Notice fix
|
||||
= 2.0.4 =
|
||||
* Fix size gateway logotypes in some themes
|
||||
= 2.0.3 =
|
||||
* Better js and css enqueue and optimize load methods
|
||||
* Better UX for bank icons
|
||||
= 2.0.2 =
|
||||
* Fix #31 js loading dependency
|
||||
* Fix #30 remove 100% layout width
|
||||
* Fix #27 fix registration url
|
||||
= 2.0.1 =
|
||||
* Fix change order status for virtual products
|
||||
= 2.0.0 =
|
||||
* New version introducing many additional features e.g. many payment types, enhanced configuration options, order repayment.
|
||||
= 1.3.1 =
|
||||
* Fix WPML compatibility
|
||||
= 1.3.0 =
|
||||
* Add shipping method selector
|
||||
= 1.2.9 =
|
||||
* Fix error when Multi-currency support is disabled in WPML
|
||||
= 1.2.8 =
|
||||
* Moved lang to buyer
|
||||
* Fixed notice in notification
|
||||
= 1.2.7 =
|
||||
* Added support for multicurrency provided by WPML
|
||||
= 1.2.6 =
|
||||
* Sandbox added
|
||||
* Cleanup code
|
||||
= 1.2.5 =
|
||||
* PayU SDK update
|
||||
= 1.2.4 =
|
||||
* Fix calculate price in products
|
||||
* Update SDK
|
||||
= 1.2.3 =
|
||||
* Fix for WooCommerce 3.x
|
||||
= 1.2.2 =
|
||||
* added language to redirect URI
|
||||
* added e-mail notification
|
||||
* added stock reduce
|
||||
= 1.2.1 =
|
||||
* Fixed extOrderId when other plugin changes WooCommerce order number
|
||||
= 1.2.0 =
|
||||
* Add Oauth support
|
||||
= 1.1.1 =
|
||||
* fix notifications
|
||||
= 1.1.0 =
|
||||
* remove many pos config for currency
|
||||
@@ -0,0 +1,360 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: PayU Payment Gateway
|
||||
* Plugin URI: https://github.com/PayU/plugin_woocommerce
|
||||
* GitHub Plugin URI: https://github.com/PayU-EMEA/plugin_woocommerce_dev
|
||||
* Description: PayU payment gateway for WooCommerce
|
||||
* Version: 2.0.13
|
||||
* Author: PayU SA
|
||||
* Author URI: http://www.payu.com
|
||||
* License: LGPL 3.0
|
||||
* Text Domain: payu
|
||||
* Domain Path: /lang
|
||||
* WC requires at least: 3.0
|
||||
* WC tested up to: 6.3
|
||||
*/
|
||||
|
||||
define('PAYU_PLUGIN_VERSION', '2.0.13');
|
||||
define('PAYU_PLUGIN_FILE', __FILE__);
|
||||
define('PAYU_PLUGIN_STATUS_WAITING', 'payu-waiting');
|
||||
|
||||
add_action('plugins_loaded', 'init_gateway_payu');
|
||||
add_action('admin_init', 'move_old_payu_settings');
|
||||
|
||||
/**
|
||||
* Init function that runs after plugin install.
|
||||
*/
|
||||
|
||||
function init_gateway_payu()
|
||||
{
|
||||
if (!class_exists('WC_Payment_Gateway')) {
|
||||
return;
|
||||
}
|
||||
load_plugin_textdomain('payu', false, dirname(plugin_basename(__FILE__)) . '/lang/');
|
||||
|
||||
require_once('includes/WC_PayUGateways.php');
|
||||
require_once('includes/PayUSettings.php');
|
||||
require_once('includes/WC_Gateway_PayuCreditCard.php');
|
||||
require_once('includes/WC_Gateway_PayuListBanks.php');
|
||||
require_once('includes/WC_Gateway_PayuStandard.php');
|
||||
require_once('includes/WC_Gateway_PayuSecureForm.php');
|
||||
require_once('includes/WC_Gateway_PayuBlik.php');
|
||||
require_once('includes/WC_Gateway_PayuInstallments.php');
|
||||
require_once('includes/WC_Gateway_PayuPaypo.php');
|
||||
require_once('includes/WC_Gateway_PayuTwistoPl.php');
|
||||
|
||||
add_filter('woocommerce_payment_gateways', 'add_payu_gateways');
|
||||
add_filter('woocommerce_valid_order_statuses_for_payment_complete', 'payu_filter_woocommerce_valid_order_statuses_for_payment_complete', 10, 2 );
|
||||
add_filter('woocommerce_email_actions', 'add_payu_order_status_to_email_notifications');
|
||||
add_filter('woocommerce_email_classes', 'add_payu_order_status_to_email_notifications_triger');
|
||||
|
||||
if (!is_admin() && isset($_GET['pay_for_order'], $_GET['key'])) {
|
||||
add_filter('woocommerce_valid_order_statuses_for_payment',
|
||||
'payu_filter_woocommerce_valid_order_statuses_for_payment',
|
||||
10, 2);
|
||||
}
|
||||
add_filter('plugin_row_meta', 'plugin_row_meta', 10, 2);
|
||||
}
|
||||
|
||||
//enable pbl and standard if first install
|
||||
register_activation_hook(__FILE__, 'payu_plugin_on_activate');
|
||||
function payu_plugin_on_activate()
|
||||
{
|
||||
if (!get_option('woocommerce_payu_settings') && !get_option('_payu_plugin_version')) {
|
||||
add_option('_payu_plugin_version', PAYU_PLUGIN_VERSION);
|
||||
add_option('woocommerce_payulistbanks_settings', ['enabled' => 'yes']);
|
||||
add_option('woocommerce_payucreditcard_settings', ['enabled' => 'yes']);
|
||||
add_option('payu_settings_option_name', ['global_default_on_hold_status' => 'on-hold']);
|
||||
}
|
||||
}
|
||||
|
||||
function move_old_payu_settings()
|
||||
{
|
||||
if ($old_payu = get_option('woocommerce_payu_settings')) {
|
||||
unset($old_payu['payu_feedback']);
|
||||
|
||||
$global = [];
|
||||
$standard = [];
|
||||
foreach ($old_payu as $key => $value) {
|
||||
if (!in_array($key, ['enabled', 'title', 'sandbox'])) {
|
||||
$global['global_' . $key] = $value;
|
||||
}
|
||||
}
|
||||
$global['global_default_on_hold_status'] = 'on-hold';
|
||||
update_option('payu_settings_option_name', $global);
|
||||
foreach ($old_payu as $key => $value) {
|
||||
if (!in_array($key, ['enabled', 'title', 'sandbox', 'description', 'enable_for_shipping'])) {
|
||||
$standard[$key] = '';
|
||||
} else {
|
||||
$standard[$key] = $value;
|
||||
}
|
||||
}
|
||||
$standard['use_global'] = 'yes';
|
||||
update_option('woocommerce_payustandard_settings', $standard);
|
||||
update_option('_payu_plugin_version', PAYU_PLUGIN_VERSION);
|
||||
delete_option('woocommerce_payu_settings');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function payu_filter_woocommerce_valid_order_statuses_for_payment()
|
||||
{
|
||||
return ['pending', 'failed', 'on-hold', PAYU_PLUGIN_STATUS_WAITING];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $statuses
|
||||
* @return array
|
||||
*/
|
||||
function payu_filter_woocommerce_valid_order_statuses_for_payment_complete($statuses)
|
||||
{
|
||||
$statuses[] = 'payu-waiting';
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $gateways
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_payu_gateways($gateways)
|
||||
{
|
||||
$gateways[] = 'WC_Gateway_PayuCreditCard';
|
||||
$gateways[] = 'WC_Gateway_PayuListBanks';
|
||||
$gateways[] = 'WC_Gateway_PayUStandard';
|
||||
$gateways[] = 'WC_Gateway_PayuSecureForm';
|
||||
$gateways[] = 'WC_Gateway_PayuBlik';
|
||||
$gateways[] = 'WC_Gateway_PayuInstallments';
|
||||
$gateways[] = 'WC_Gateway_PayuPaypo';
|
||||
$gateways[] = 'WC_Gateway_PayuTwistoPl';
|
||||
return $gateways;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $actions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_payu_order_status_to_email_notifications($actions)
|
||||
{
|
||||
$actions[] = 'woocommerce_order_status_'.PAYU_PLUGIN_STATUS_WAITING.'_to_processing';
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $clases
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function add_payu_order_status_to_email_notifications_triger($clases)
|
||||
{
|
||||
if ($clases['WC_Email_Customer_Processing_Order']) {
|
||||
add_action('woocommerce_order_status_' . PAYU_PLUGIN_STATUS_WAITING . '_to_processing_notification', array($clases['WC_Email_Customer_Processing_Order'], 'trigger'), 10, 2);
|
||||
}
|
||||
|
||||
return $clases;
|
||||
}
|
||||
|
||||
function plugin_row_meta($links, $plugin_file) {
|
||||
if (strpos($plugin_file, 'woo-payu-payment-gateway') === false) {
|
||||
return $links;
|
||||
}
|
||||
$row_meta = array(
|
||||
'docs' => '<a href="' . esc_url( 'https://github.com/PayU-EMEA/plugin_woocommerce' ) . '">' . esc_html__( 'Docs', 'payu' ) . '</a>'
|
||||
);
|
||||
|
||||
return array_merge( $links, $row_meta );
|
||||
}
|
||||
|
||||
//enqueue assets
|
||||
function enqueue_payu_admin_assets()
|
||||
{
|
||||
wp_enqueue_script('payu-admin', plugins_url( '/assets/js/payu-admin.js', PAYU_PLUGIN_FILE ), ['jquery'], PAYU_PLUGIN_VERSION);
|
||||
wp_enqueue_style('payu-admin', plugins_url( '/assets/css/payu-admin.css', PAYU_PLUGIN_FILE ), [], PAYU_PLUGIN_VERSION);
|
||||
}
|
||||
|
||||
if (is_admin()) {
|
||||
add_action('admin_enqueue_scripts', 'enqueue_payu_admin_assets');
|
||||
}
|
||||
|
||||
add_action('woocommerce_view_order', 'view_order');
|
||||
function view_order($order_id)
|
||||
{
|
||||
wp_enqueue_style('payu-gateway', plugins_url( '/assets/css/payu-gateway.css', PAYU_PLUGIN_FILE ),
|
||||
[], PAYU_PLUGIN_VERSION);
|
||||
|
||||
$order = wc_get_order($order_id);
|
||||
$payu_gateways = WC_PayUGateways::gateways_list();
|
||||
if (in_array($order->get_status(), ['on-hold', 'pending', 'failed'])) {
|
||||
if (@$payu_gateways[$order->get_payment_method()] && isset(get_option('payu_settings_option_name')['global_repayment'])) {
|
||||
include('html/payu-repayment.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Register new status
|
||||
function register_waiting_payu_order_status()
|
||||
{
|
||||
register_post_status('wc-'. PAYU_PLUGIN_STATUS_WAITING,
|
||||
[
|
||||
'label' => __('Awaiting receipt of payment', 'payu'),
|
||||
'public' => true,
|
||||
'exclude_from_search' => false,
|
||||
'show_in_admin_all_list' => true,
|
||||
'show_in_admin_status_list' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function woocommerce_payu_is_wmpl_active_and_configure()
|
||||
{
|
||||
global $woocommerce_wpml;
|
||||
|
||||
return $woocommerce_wpml
|
||||
&& property_exists($woocommerce_wpml, 'multi_currency')
|
||||
&& $woocommerce_wpml->multi_currency
|
||||
&& count($woocommerce_wpml->multi_currency->get_currency_codes()) > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function woocommerce_payu_is_currency_custom_config()
|
||||
{
|
||||
return apply_filters('woocommerce_payu_multicurrency_active', false)
|
||||
&& count(apply_filters('woocommerce_payu_get_currency_codes', [])) > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function woocommerce_payu_get_currencies()
|
||||
{
|
||||
global $woocommerce_wpml;
|
||||
|
||||
$currencies = [];
|
||||
|
||||
if (woocommerce_payu_is_wmpl_active_and_configure()) {
|
||||
$currencies = $woocommerce_wpml->multi_currency->get_currency_codes();
|
||||
} elseif (woocommerce_payu_is_currency_custom_config()) {
|
||||
$currencies = apply_filters('woocommerce_payu_get_currency_codes', []);
|
||||
}
|
||||
|
||||
return $currencies;
|
||||
}
|
||||
|
||||
add_action('init', 'register_waiting_payu_order_status');
|
||||
|
||||
// Add to list of WC Order statuses
|
||||
function add_waiting_payu_to_order_statuses($order_statuses)
|
||||
{
|
||||
$order_statuses['wc-'.PAYU_PLUGIN_STATUS_WAITING] = __('Awaiting receipt of payment', 'payu');
|
||||
return $order_statuses;
|
||||
}
|
||||
|
||||
add_filter('wc_order_statuses', 'add_waiting_payu_to_order_statuses');
|
||||
|
||||
//remove pay button
|
||||
function filter_woocommerce_my_account_my_orders_actions($actions, $order)
|
||||
{
|
||||
// Get status
|
||||
$order_status = $order->get_status();
|
||||
|
||||
if (in_array($order_status,
|
||||
[
|
||||
'failed',
|
||||
PAYU_PLUGIN_STATUS_WAITING,
|
||||
get_option('payu_settings_option_name')['global_default_on_hold_status']
|
||||
])) {
|
||||
$payu_gateways = WC_PayUGateways::gateways_list();
|
||||
if (@$payu_gateways[$order->get_payment_method()] && isset(get_option('payu_settings_option_name')['global_repayment'])) {
|
||||
$actions['repayu'] = [
|
||||
'name' => __('Pay with PayU', 'payu'),
|
||||
'url' => wc_get_endpoint_url('order-pay', $order->get_id(),
|
||||
wc_get_checkout_url()) . '?pay_for_order=true&key=' . $order->get_order_key()
|
||||
];
|
||||
unset($actions['pay']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
add_filter('woocommerce_my_account_my_orders_actions', 'filter_woocommerce_my_account_my_orders_actions', 10, 2);
|
||||
add_action('woocommerce_order_item_add_action_buttons', 'wc_order_item_add_action_buttons_callback', 10, 1);
|
||||
|
||||
function wc_order_item_add_action_buttons_callback($order)
|
||||
{
|
||||
$payu_gateways = WC_PayUGateways::gateways_list();
|
||||
if (@$payu_gateways[$order->get_payment_method()] && !isset(get_option('payu_settings_option_name')['global_repayment']) && get_post_meta($order->get_id(),
|
||||
'_payu_order_status')) {
|
||||
$payu_statuses = WC_PayUGateways::clean_payu_statuses(get_post_meta($order->get_id(), '_payu_order_status'));
|
||||
if ((!in_array(OpenPayuOrderStatus::STATUS_COMPLETED,
|
||||
$payu_statuses) && !in_array(OpenPayuOrderStatus::STATUS_CANCELED,
|
||||
$payu_statuses)) && in_array(OpenPayuOrderStatus::STATUS_WAITING_FOR_CONFIRMATION,
|
||||
$payu_statuses)) {
|
||||
$label_receive_payment = esc_html__('Receive payment', 'payu');
|
||||
$label_discard_payment = esc_html__('Discard payment', 'payu');
|
||||
$slug_receive_payment = 'receive-payment';
|
||||
$slug_discard_payment = 'discard-payment';
|
||||
$url_receive = add_query_arg([
|
||||
'post' => $order->get_id(),
|
||||
'action' => 'edit',
|
||||
'receive-payment' => 1
|
||||
], admin_url('post.php'));
|
||||
$url_discard = add_query_arg([
|
||||
'post' => $order->get_id(),
|
||||
'action' => 'edit',
|
||||
'discard-payment' => 1
|
||||
], admin_url('post.php'));
|
||||
?>
|
||||
<a href="<?php echo $url_receive ?>" type="button"
|
||||
class="button <?php echo $slug_receive_payment; ?>"><?php echo $label_receive_payment; ?></a>
|
||||
<a href="<?php echo $url_discard ?>" type="button"
|
||||
class="button <?php echo $slug_discard_payment; ?>"><?php echo $label_discard_payment; ?></a>
|
||||
<?php
|
||||
$url_return = add_query_arg([
|
||||
'post' => $order->get_id(),
|
||||
'action' => 'edit',
|
||||
], admin_url('post.php'));
|
||||
if (is_admin() && (isset($_GET['receive-payment']) || isset($_GET['discard-payment']))) {
|
||||
global $current_user;
|
||||
wp_get_current_user();
|
||||
|
||||
if (isset($_GET['receive-payment'])) {
|
||||
$orderId = $order->get_transaction_id();
|
||||
$status_update = [
|
||||
"orderId" => $orderId,
|
||||
"orderStatus" => OpenPayuOrderStatus::STATUS_COMPLETED
|
||||
];
|
||||
$payment_method_name = $order->get_payment_method();
|
||||
$payment_init = WC_PayUGateways::gateways_list()[$payment_method_name]['api'];
|
||||
$payment = new $payment_init;
|
||||
$payment->init_OpenPayU($order->get_currency());
|
||||
OpenPayU_Order::statusUpdate($status_update);
|
||||
$order->add_order_note(sprintf(__('[PayU] User %s accepted payment', 'payu'),
|
||||
$current_user->user_login));
|
||||
wp_redirect($url_return);
|
||||
}
|
||||
if (isset($_GET['discard-payment'])) {
|
||||
$payment_method_name = $order->get_payment_method();
|
||||
$payment_init = WC_PayUGateways::gateways_list()[$payment_method_name]['api'];
|
||||
$payment = new $payment_init;
|
||||
$payment->init_OpenPayU($order->get_currency());
|
||||
$orderId = $order->get_transaction_id();
|
||||
OpenPayU_Order::cancel($orderId);
|
||||
$order->add_order_note(sprintf(__('[PayU] User %s rejected payment', 'payu'),
|
||||
$current_user->user_login));
|
||||
wp_redirect($url_return);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user