Bladeren bron

Minor Fixes & Changes

master
30117125 4 jaren geleden
bovenliggende
commit
dfded38955

BIN
dist.zip Bestand weergeven


+ 55
- 3
src/components/financial/paymentOption.vue Bestand weergeven

@@ -9,7 +9,7 @@
9 9
               <option value="CC">Credit/Debit Card</option>
10 10
               <option value="EFT">EFT</option>
11 11
             </select>
12
-            <button class="btn-solid-blue mt-5" @click="pushToApi()">Continue</button>
12
+            <button class="btn-solid-blue mt-5" @click="pushToApi()">CONTINUE</button>
13 13
           </div>
14 14
         </div>
15 15
       </div>
@@ -41,12 +41,14 @@
41 41
 import { mapState, mapActions, mapGetters } from "vuex";
42 42
 import carousel from "vue-owl-carousel";
43 43
 import Log from "../../assets/Log";
44
+import md5 from "js-md5";
44 45
 export default {
45 46
   components: {
46 47
     carousel
47 48
   },
48 49
   props: {
49
-    week: {}
50
+    week: {},
51
+    indiv: {}
50 52
   },
51 53
   data() {
52 54
     return {
@@ -62,7 +64,8 @@ export default {
62 64
     ...mapActions("myWeeks", ["editSave"]),
63 65
     pushToApi() {
64 66
       if (this.selectedOption == "CC") {
65
-        this.paygateRedirect();
67
+        //this.paygateRedirect();
68
+        this.generatePayment(this.week.id);
66 69
       } else {
67 70
         this.week.statusId = 1033; // change this value to link with status
68 71
         if (this.week.owner.telephone === "") {
@@ -74,6 +77,55 @@ export default {
74 77
         });
75 78
       }
76 79
     },
80
+    generatePayment(id) {
81
+      var myData = [];
82
+      // Merchant details
83
+      myData["merchant_id"] = "10000100";
84
+      myData["merchant_key"] = "46f0cd694581a";
85
+      myData["return_url"] = "https://www.univateproperties.co.za/#/payments/success";
86
+      myData["cancel_url"] = "https://www.univateproperties.co.za/#/";
87
+      myData["notify_url"] = "http://www.yourdomain.co.za/notify_url";
88
+      // Buyer details
89
+      myData["name_first"] = this.indiv.name;
90
+      myData["name_last"] = this.indiv.surname;
91
+      myData["email_address"] = this.indiv.emailAddress;
92
+      // Transaction details
93
+      //myData["m_payment_id"] = "1234";
94
+      myData["amount"] = this.getListingFee.amount.toString();
95
+      myData["item_name"] = id.toString();
96
+      myData["signature"] = this.generateSignature(myData);
97
+      //console.log(paymentObj);
98
+      //axios.post("https://sandbox.payfast.co.za​/eng/process", paymentObj);
99
+      //console.log(myData);
100
+      var paymentObj = Object.assign({}, myData);
101
+      console.log(paymentObj);
102
+      this.$router.push({
103
+        name: "PayFast",
104
+        params: {
105
+          paymentObj: paymentObj
106
+        }
107
+      });
108
+    },
109
+    generateSignature(data, passPhrase = null) {
110
+      let pfOutput = "";
111
+      for (let key in data) {
112
+        if (data.hasOwnProperty(key)) {
113
+          if (data[key] !== "") {
114
+            pfOutput += `${key}=${encodeURIComponent(data[key].trim()).replace(/%20/g, "+")}&`;
115
+          }
116
+        }
117
+      }
118
+
119
+      let getString = pfOutput.slice(0, -1);
120
+      if (passPhrase !== null) {
121
+        getString += `&passphrase=${encodeURIComponent(passPhrase.trim()).replace(/%20/g, "+")}`;
122
+      }
123
+      var hash = md5.create();
124
+      hash.update(getString);
125
+      console.log(hash.hex());
126
+      console.log(getString);
127
+      return hash.toString();
128
+    },
77 129
     paygateRedirect() {
78 130
       var amount = this.getListingFee.amount;
79 131
       var paymentObj = {

+ 6
- 1
src/components/timeshare/sell/contentSection.vue Bestand weergeven

@@ -988,6 +988,7 @@ export default {
988 988
       const rx = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im;
989 989
       return rx.test(String(number));
990 990
     },
991
+
991 992
     submitSale() {
992 993
       this.boolError = false;
993 994
       if (this.userLoggedIn) {
@@ -1058,13 +1059,17 @@ export default {
1058 1059
         var fixedDate = new Date(isoDate).setHours(+4);
1059 1060
         var pubDate = new Date(fixedDate).toISOString();
1060 1061
         this.sellItem.pulbishedDate = pubDate;
1062
+        if (this.sellItem.originalPurchasePrice === "") {
1063
+          this.sellItem.originalPurchasePrice = 0;
1064
+        }
1061 1065
         //console.log(this.sellItem.ownerObject);
1062 1066
         console.log(this.sellItem);
1063 1067
         console.log(JSON.stringify(this.sellItem));
1068
+
1064 1069
         if (!this.boolError) {
1065 1070
           this.saveWeek(this.sellItem)
1066 1071
             .then(fulfilled => {
1067
-              // this.$router.push({ name: "PaymentOption", params: { week: fulfilled } });
1072
+              // this.$router.push({ name: "PaymentOption", params: { week: fulfilled, indiv: this.indiv } });
1068 1073
               this.$router.push({ name: "EFTPage", params: { week: fulfilled } });
1069 1074
               //this.paygateRedirect();
1070 1075
             })

+ 10
- 1
src/components/user/updateAgentProfile.vue Bestand weergeven

@@ -252,7 +252,16 @@ export default {
252 252
           this.agent.user.role === "Managing Agent"
253 253
         ) {
254 254
           this.updateAgent(this.agent).then(() => {
255
-            this.$router.go(-1);
255
+            var newPerson = {
256
+              id: JSON.parse(localStorage.getItem("person")).id,
257
+              email: this.agent.email,
258
+              fullname: this.agent.name + " " + this.agent.surname,
259
+              name: this.agent.name,
260
+              surname: this.agent.surnmame
261
+            };
262
+            localStorage.setItem("person", JSON.stringify(newPerson));
263
+            console.log(newPerson);
264
+            this.$router.push("/");
256 265
           });
257 266
         } else {
258 267
           this.saveAgent(this.agent)

+ 2
- 2
src/components/user/updateProfileInfo.vue Bestand weergeven

@@ -589,7 +589,7 @@ export default {
589 589
               if (Log.getUser().role === "Super Admin") {
590 590
                 // console.log(this.individual);
591 591
                 // console.log(JSON.parse(localStorage.getItem("person")));
592
-                if (this.individual.id === JSON.parse(localStorage.getItem("person"))) {
592
+                if (this.individual.id === JSON.parse(localStorage.getItem("person")).id) {
593 593
                   var newPerson = {
594 594
                     id: JSON.parse(localStorage.getItem("person")).id,
595 595
                     email: this.individual.email,
@@ -597,8 +597,8 @@ export default {
597 597
                     name: this.individual.name,
598 598
                     surname: this.individual.surname
599 599
                   };
600
-                  this.$router.go();
601 600
                   localStorage.setItem("person", JSON.stringify(newPerson));
601
+                  this.$router.go();
602 602
                 }
603 603
                 this.$router.push("/status/userManagementPage");
604 604
               } else {

Laden…
Annuleren
Opslaan