|
@@ -870,6 +870,7 @@ import addressAutoComplete from "../../shared/addressAutoComplete";
|
870
|
870
|
import Alert from "../../shared/alert.vue";
|
871
|
871
|
import Log from "../../../assets/Log";
|
872
|
872
|
import _ from "lodash";
|
|
873
|
+import md5 from "js-md5";
|
873
|
874
|
|
874
|
875
|
export default {
|
875
|
876
|
name: "TimeshareToSell",
|
|
@@ -1000,6 +1001,57 @@ export default {
|
1000
|
1001
|
var pubDate = new Date(fixedDate).toISOString();
|
1001
|
1002
|
return pubDate;
|
1002
|
1003
|
},
|
|
1004
|
+ generatePayment(id) {
|
|
1005
|
+ var myData = [];
|
|
1006
|
+ // Merchant details
|
|
1007
|
+ myData["merchant_id"] = "10000100";
|
|
1008
|
+ myData["merchant_key"] = "46f0cd694581a";
|
|
1009
|
+ myData["return_url"] = "https://www.univateproperties.co.za/#/payments/success";
|
|
1010
|
+ myData["cancel_url"] = "https://www.univateproperties.co.za/#/";
|
|
1011
|
+ myData["notify_url"] = "http://www.yourdomain.co.za/notify_url";
|
|
1012
|
+ // Buyer details
|
|
1013
|
+ myData["name_first"] = this.indiv.name;
|
|
1014
|
+ myData["name_last"] = this.indiv.surname;
|
|
1015
|
+ myData["email_address"] = this.indiv.emailAddress;
|
|
1016
|
+ // Transaction details
|
|
1017
|
+ //myData["m_payment_id"] = "1234";
|
|
1018
|
+ myData["amount"] = this.getListingFee.amount.toString();
|
|
1019
|
+ myData["item_name"] =
|
|
1020
|
+ "Uni-Vate Week sale. Resort: " + this.sellItem.resort + " Referemce: #" + id.toString();
|
|
1021
|
+ myData["signature"] = this.generateSignature(myData);
|
|
1022
|
+ //console.log(paymentObj);
|
|
1023
|
+ //axios.post("https://sandbox.payfast.co.za/eng/process", paymentObj);
|
|
1024
|
+ //console.log(myData);
|
|
1025
|
+ var paymentObj = Object.assign({}, myData);
|
|
1026
|
+ console.log("Twas here");
|
|
1027
|
+ console.log(paymentObj);
|
|
1028
|
+ this.$router.push({
|
|
1029
|
+ name: "PayFast",
|
|
1030
|
+ params: {
|
|
1031
|
+ paymentObj: paymentObj
|
|
1032
|
+ }
|
|
1033
|
+ });
|
|
1034
|
+ },
|
|
1035
|
+ generateSignature(data, passPhrase = null) {
|
|
1036
|
+ let pfOutput = "";
|
|
1037
|
+ for (let key in data) {
|
|
1038
|
+ if (data.hasOwnProperty(key)) {
|
|
1039
|
+ if (data[key] !== "") {
|
|
1040
|
+ pfOutput += `${key}=${encodeURIComponent(data[key].trim()).replace(/%20/g, "+")}&`;
|
|
1041
|
+ }
|
|
1042
|
+ }
|
|
1043
|
+ }
|
|
1044
|
+
|
|
1045
|
+ let getString = pfOutput.slice(0, -1);
|
|
1046
|
+ if (passPhrase !== null) {
|
|
1047
|
+ getString += `&passphrase=${encodeURIComponent(passPhrase.trim()).replace(/%20/g, "+")}`;
|
|
1048
|
+ }
|
|
1049
|
+ var hash = md5.create();
|
|
1050
|
+ hash.update(getString);
|
|
1051
|
+ console.log(hash.hex());
|
|
1052
|
+ console.log(getString);
|
|
1053
|
+ return hash.toString();
|
|
1054
|
+ },
|
1003
|
1055
|
submitSale() {
|
1004
|
1056
|
this.boolError = false;
|
1005
|
1057
|
if (this.userLoggedIn) {
|
|
@@ -1087,9 +1139,13 @@ export default {
|
1087
|
1139
|
if (!this.boolError) {
|
1088
|
1140
|
this.saveWeek(this.sellItem)
|
1089
|
1141
|
.then(fulfilled => {
|
1090
|
|
- // this.$router.push({ name: "PaymentOption", params: { week: fulfilled, indiv: this.indiv } });
|
|
1142
|
+ // this.$router.push({
|
|
1143
|
+ // name: "PaymentOption",
|
|
1144
|
+ // params: { week: fulfilled, indiv: this.indiv }
|
|
1145
|
+ // });
|
1091
|
1146
|
this.$router.push({ name: "EFTPage", params: { week: fulfilled } });
|
1092
|
1147
|
//this.paygateRedirect();
|
|
1148
|
+ //this.generatePayment(fulfilled.id);
|
1093
|
1149
|
})
|
1094
|
1150
|
.catch(ex => {
|
1095
|
1151
|
this.errorOccurred = "ERRORHTML";
|