|
@@ -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 = {
|