Skip to content

Commit

Permalink
Merge pull request #12 from epayco/release/v5.2.0
Browse files Browse the repository at this point in the history
Release/v5.2.0
  • Loading branch information
danielquiroz87 authored Mar 22, 2023
2 parents acdc384 + 9e9b9b9 commit 163f012
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@
* [ePayco plugin WooCommerce v4.9](https://github.com/epayco/suscripciones_woocommerce/releases/tag/v4.9).
* [ePayco plugin WooCommerce v5.0](https://github.com/epayco/suscripciones_woocommerce/releases/tag/v5.0)
* [ePayco plugin WooCommerce v5.1](https://github.com/epayco/suscripciones_woocommerce/releases/tag/v5.1)
* [ePayco plugin WooCommerce v5.2](https://github.com/epayco/suscripciones_woocommerce/releases/tag/v5.2)

9 changes: 5 additions & 4 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ jQuery( function( $ ) {
var $form = $(this);
function getPosts() {
return new Promise(function(resolve, reject) {
ePayco.token.create($form, function(error, token) {
ePayco.token.create($form, function(error, token) {
if(!error) {
enviarData(token)
} else {
Expand All @@ -324,7 +324,8 @@ jQuery( function( $ ) {
$("#web-checkout-content").addClass("animated shake");
document.getElementById('the-card-number-element').classList.add('inputerror')
reject('credit card number incorrect or empty')
}

}

}
}else{
Expand Down Expand Up @@ -375,8 +376,8 @@ jQuery( function( $ ) {
}else{

loadoverlay_.style.display='block';
getPosts().then(r =>{
debugger

getPosts().then(r =>{
$checkout_form.find('input[name=my-custom-form-field__card-number]').remove();
$checkout_form.find('input[name=cvc]').remove();
$checkout_form.find('input[name=year]').remove();
Expand Down
20 changes: 12 additions & 8 deletions epayco-class-subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ public function subscription_epayco(array $params)
$customerData = $this->paramsBilling($subscriptions, $order, $customerName);
$customerData['token_card'] = $token;
$sql_ = 'SELECT * FROM '.$table_name_setings.' WHERE id_payco = '.$this->custIdCliente.' AND email = '.$customerData['email'];
$customerGetData = $wpdb->get_results($sql_, OBJECT);
$customerGetData = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM $table_name_setings WHERE id_payco = %d AND email = %s",
$this->custIdCliente,
$customerData['email']
)
);
if (count($customerGetData) == 0){
$customer = $this->customerCreate($customerData);
if ($customer->data->status == 'error' || !$customer->status){
Expand Down Expand Up @@ -198,7 +204,7 @@ public function getPlanById($plan_id)
}


public function validatePlan($create=null,$order_id,array $plans,$subscriptions,$customer,$confirm_url,$order ,$confirm = null,$update = null,$getPlans = null){
public function validatePlan($create,$order_id,array $plans,$subscriptions,$customer,$confirm_url,$order ,$confirm = null,$update = null,$getPlans = null){

if($create)
{
Expand Down Expand Up @@ -825,7 +831,8 @@ public function process_payment_epayco(array $plans,array $customerData, $confir
$customerId = isset($subsCreated->customer->_id) ? $subsCreated->customer->_id : null;
$suscriptionId = isset($subsCreated->id) ? $subsCreated->id : null;
$planId = isset($subsCreated->data->idClient) ? $subsCreated->data->idClient : null;
if($sub->status || $sub->success){
$validation = !is_null($sub->status)?$sub->status:$sub->success;
if($validation){
$messageStatus = $this->handleStatusSubscriptions($subs, $subscriptions, $customerData,$order,$customerId,$suscriptionId, $planId);

$response_status = [
Expand All @@ -835,11 +842,8 @@ public function process_payment_epayco(array $plans,array $customerData, $confir
'url' => $order->get_checkout_order_received_url()
];
}else {
if(count($sub->data->errors)>1){
$errorMessage = $sub->data->errors[0]->errorMessage;
}else{
$errorMessage = $sub->data->errors;
}

$errorMessage = $sub->data->errors;
$response_status = [
'ref_payco'=> null,
'status' => false,
Expand Down
6 changes: 3 additions & 3 deletions epayco-subscription-epayco.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function receipt_page($order_id){
$order = wc_get_order( $order_id );
$order_data = $order->get_data(); // The Order data
$name_billing=$subscription->get_billing_first_name().' '.$subscription->get_billing_last_name();
$email_billing=$subscription->billing_email;
$email_billing=$subscription->get_billing_email();
$redirect_url =get_site_url() . "/";
$redirect_url = add_query_arg( 'wc-api', get_class( $this ), $redirect_url );
$redirect_url = add_query_arg('order_id',$order_id,$redirect_url);
Expand Down Expand Up @@ -632,7 +632,7 @@ function ePaycoSub_successful_request($validationData)
$subscription = new Subscription_Epayco_SE();
$order_id= $_REQUEST["order_id"];

if($_REQUEST["confirmation"]){
if( isset($_REQUEST["confirmation"]) ){
$subscription->subscription_epayco_confirm($_REQUEST);
die();
}else{
Expand All @@ -643,7 +643,7 @@ function ePaycoSub_successful_request($validationData)
}
}
if(!$data['status']){
wc_add_notice( $data['message'][0], 'error' );
wc_add_notice( $data['message'], 'error' );
$order = new WC_Order($order_id);
if (version_compare( WOOCOMMERCE_VERSION, '2.1', '>=')) {
$redirect = array(
Expand Down

0 comments on commit 163f012

Please sign in to comment.