Parcourir la source

Payfast signature update

master
30117125 il y a 4 ans
Parent
révision
bc9576c262
1 fichiers modifiés avec 37 ajouts et 37 suppressions
  1. 37
    37
      src/components/timeshare/sell/contentSectionPF.vue

+ 37
- 37
src/components/timeshare/sell/contentSectionPF.vue Voir le fichier

@@ -976,6 +976,35 @@ export default {
976 976
       this.weekId = 0;
977 977
       this.getBlankWeek();
978 978
     },
979
+    generatePayment(id) {
980
+      var myData = [];
981
+      // Merchant details
982
+      myData["merchant_id"] = "10000100";
983
+      myData["merchant_key"] = "46f0cd694581a";
984
+      myData["return_url"] = "https://www.univateproperties.co.za/#/payments/success";
985
+      myData["cancel_url"] = "https://www.univateproperties.co.za/#/";
986
+      myData["notify_url"] = "http://www.yourdomain.co.za/notify_url";
987
+      // Buyer details
988
+      myData["name_first"] = this.indiv.name;
989
+      myData["name_last"] = this.indiv.surname;
990
+      myData["email_address"] = this.indiv.emailAddress;
991
+      // Transaction details
992
+      //myData["m_payment_id"] = "1234";
993
+      myData["amount"] = this.getListingFee.amount.toString();
994
+      myData["item_name"] = id.toString();
995
+      myData["signature"] = this.generateSignature(myData);
996
+      //console.log(paymentObj);
997
+      //axios.post("https://sandbox.payfast.co.za​/eng/process", paymentObj);
998
+      //console.log(myData);
999
+      var paymentObj = Object.assign({}, myData);
1000
+      console.log(paymentObj);
1001
+      this.$router.push({
1002
+        name: "PayFast",
1003
+        params: {
1004
+          paymentObj: paymentObj
1005
+        }
1006
+      });
1007
+    },
979 1008
     generateSignature(data, passPhrase = null) {
980 1009
       let pfOutput = "";
981 1010
       for (let key in data) {
@@ -997,33 +1026,6 @@ export default {
997 1026
       return hash.toString();
998 1027
     },
999 1028
     submitSale() {
1000
-      var myData = [];
1001
-      // Merchant details
1002
-      myData["merchant_id"] = "10000100";
1003
-      myData["merchant_key"] = "46f0cd694581a";
1004
-      myData["return_url"] = "http://www.yourdomain.co.za/return_url";
1005
-      myData["cancel_url"] = "http://www.yourdomain.co.za/cancel_url";
1006
-      myData["notify_url"] = "http://www.yourdomain.co.za/notify_url";
1007
-      // Buyer details
1008
-      myData["name_first"] = "First Name";
1009
-      myData["name_last"] = "Last Name";
1010
-      myData["email_address"] = "test@test.com";
1011
-      // Transaction details
1012
-      //myData["m_payment_id"] = "1234";
1013
-      myData["amount"] = "10.00";
1014
-      myData["item_name"] = "Order#123";
1015
-      myData["signature"] = this.generateSignature(myData);
1016
-      //console.log(paymentObj);
1017
-      //axios.post("https://sandbox.payfast.co.za​/eng/process", paymentObj);
1018
-      //console.log(myData);
1019
-      var paymentObj = Object.assign({}, myData);
1020
-      console.log(paymentObj);
1021
-      this.$router.push({
1022
-        name: "PayFast",
1023
-        params: {
1024
-          paymentObj: paymentObj
1025
-        }
1026
-      });
1027 1029
       if (this.userLoggedIn) {
1028 1030
         this.sellItem.ownerObject = this.indiv;
1029 1031
         this.sellItem.weekStatus = "For Sale";
@@ -1033,16 +1035,14 @@ export default {
1033 1035
             this.sellItem.statusId = status.id;
1034 1036
           }
1035 1037
         });
1036
-        // this.saveWeek(this.sellItem)
1037
-        //   .then(fulfilled => {
1038
-        //     console.log(fulfilled);
1039
-        //     // this.$router.push({ name: "PaymentOption", params: { week: fulfilled } });
1040
-        //     this.$router.push({ name: "EFTPage", params: { week: fulfilled } });
1041
-        //     //this.paygateRedirect();
1042
-        //   })
1043
-        //   .catch(ex => {
1044
-        //     this.profileEmailError = true;
1045
-        //   });
1038
+        this.saveWeek(this.sellItem)
1039
+          .then(fulfilled => {
1040
+            console.log(fulfilled);
1041
+            this.generatePayment(fulfilled.id);
1042
+          })
1043
+          .catch(ex => {
1044
+            this.profileEmailError = true;
1045
+          });
1046 1046
       } else {
1047 1047
         this.$router.push("/user/login");
1048 1048
       }

Chargement…
Annuler
Enregistrer